Questions tagged [mass]

MASS is an R package used in support of "Modern Applied Statistics with S" (Venables and Ripley). Use with the [r] tag.

70 questions
1
vote
1 answer

Finding high density zones in a 2D Histogram in R

I have a series of 2D Histograms that I created using the kde2d function of MASS in the following way: # Loading libraries library(MASS) library(RcolorBrewer) # Loading data data <- as.matrix(read.table('data.dat')) # Create…
webbynator
  • 31
  • 5
1
vote
0 answers

stepAIC error: AIC is -infinity

I am using stepAIC in the MASS package for model selection and receive an error: “AIC is -infinity for this model, so 'step' cannot proceed” when including all candidate predictor variables. I am able to successfully execute stepAIC when specifying…
viridius
  • 477
  • 5
  • 17
1
vote
1 answer

unable to reinstall mass package

I'm working with R Version 3.3.0 where the most installed packages have the versions 3.3.0, 3.3.2, 3.3.3. Unfortunately, it seems that I have overwritten the MASS package with the actual version. I needed the "vars" package and therefore a newer…
Tobias93
  • 11
  • 1
0
votes
0 answers

Strangely different results doing Box Cox transform with R Optim and with MASS package

using optim in R, We don't uderstand why We have not the same result than lambda Box Cox in Mass package ? Is the problem whith the linear model ? Please find the code below. Do you have any idea? Thanks a lot for your help. Have a nice…
user3619937
  • 85
  • 2
  • 6
0
votes
0 answers

Error when using lmomco and MASS packages to develop a new package

I am trying to check a package I have created in R that uses functions from the lmomco package. When I use the "check" option in Rstudio I get the following error: byte-compile and prepare package for lazy loading Error : package or namespace load…
Bondo
  • 43
  • 3
0
votes
0 answers

Comparison of Model Selection Criteria: Same Models using step (and stepAIC) Functions

Well, I have been trying to use the functions step() and stepAIC() to compare models using different criteria for variable selection. However, the results yield the same models. I am uncertain whether this is highly unlikely but possible, or if…
G_biof
  • 27
  • 6
0
votes
0 answers

Add Linear Discriminant Analysis Line and Show Equation on ggplot

Rather than using an incorrect line generated by lm using geom_smooth(method = lm), I wanted to plot the line that a linear discriminant analysis would consider "0." I understand how to get the output data with LD1 and LD2, but not the specific…
Zard22
  • 13
  • 2
0
votes
0 answers

Y-axis (ld2) seems inverted on ggplot of LDA (Linear Discriminant Analysis) (Rstudio)

I am attempting to create a ggplot2 plot of a linear discriminant analysis of my data. I have done so without issues in the past. However, I notice that the plotted data appears 'inverted'--points that should be below zero on the Y axis/the…
Zard22
  • 13
  • 2
0
votes
0 answers

Error in stepAIC() model building function in R

I have built a logistic regression model with the dependent variable WinParty, which outputs fine. Then when trying to do variable selection with stepAIC I keep getting this error Data Structure tibble [2,467 × 25] (S3: tbl_df/tbl/data.frame) $…
0
votes
0 answers

"Error in make.unique(bi, sep = sep): 'names' must be a character vector"? Any suggestions to solve it?

I need your help in solving an error related to vector name I'm trying to define the function- ginv2 in r to convert a matrix output into fraction format but, I got an error related to 'names'. `Error in make.unique(bi, sep = sep) : 'names' must be…
Arpitha
  • 27
  • 3
0
votes
1 answer

Is the a way to regenerate data for 500 times?

library(MASS) # set seed and create data vectors #set.seed(98989) <- for replicating results of betas in 1-2 1-3 sample_size <- 200 sample_meanvector <- c(3, 4) …
Renee
  • 13
  • 2
0
votes
1 answer

How do I find the scores at which the LDA function from MASS specifies to which class an observation belongs?

I have a dataset of body measurements for birds and I'm using the lda function from the MASS package to find out the extent of sexual dimorphism. Eventually, I want to end up with an equation and critical score that can be used in the field (without…
AnneA
  • 25
  • 4
0
votes
0 answers

model selection using StepAIC; how can I see other models besides my final model?

I am conducting model selection on my dataset using the package MASS and the function stepAIC. This is the current code I am using: mod <- lm(Distance~DiffAge + DiffR + DiffSize + DiffRep + DiffSeason + Diff.Bkp + Diff.Fzp + Diff.AO +…
Cam
  • 449
  • 2
  • 7
0
votes
0 answers

How to plot a graph for parallel regression assumption of ordered logit?

I want to do a plot for my ordered logit model to check if the assumption of parallel regression holds or not. But I really do not now how to code it or where to begin. I wanted to do a similarly to this using R(RStudio) to see if my model is…
rr19
  • 79
  • 1
  • 9
0
votes
0 answers

Can gtsummary be used to predict an ordinal variable (several predictors of all kinds in one model), adjusted for confounding factors

i am trying to bulid a prediction model for an oridinal variable. I now that MASS:polr() function tragets this issue but i want to present it in a more approchable way. i thought gtsummary package may be sutiable my code- reg_tb<-tbl_uvregression( …