2

I'm using:

library(car)
boxTidwell(y, ...)

mydata = my data frame 

When I try:

boxTidwell(response~variable1+variable2+...varibalen, ~categoricalvariable, data=mydata)

it comes up with this error:

Error in lm.fit(cbind(1, x1.p, x2), y, ...) : NA/NaN/Inf in 'x'

I run boxTidwell(y,x3,x2=NULL) and get the following error:

Error in model.frame.default(formula = y ~ cbind(x1, x2), drop.unused.levels = TRUE) : 
  invalid type (NULL) for variable 'y'

where:

y = mydata$response 
x1 = mydata[,-response] then x3 = x1[,-categoricalvariable] (i used head(x1) and head(x3) to check this worked)
x2 = mydata$categoricalvariable (i only have one so this can be done)

the categorical variable or the response is not included in x1.

I have read the help file but am really not sure whats wrong. I also tried converting the above to matrix form (model.matrix) instead of data frames (i checked using class) but that threw up the same errors as above.

Any ideas on why this isn't working and how I can fix it?

Thomas
  • 43,637
  • 12
  • 109
  • 140
Dino Abraham
  • 151
  • 8

0 Answers0