[R] cannot update polr model if I specify "start" parameters

Kevin Coombes kevin.r.coombes at gmail.com
Thu May 6 17:42:35 CEST 2010


Hi,

I am trying to build an ordinal regression model using polr (from the 
MASS package).  In order to construct an initial model (without an error 
aborting it) in my setting, I must pass in a "start" parameter.  I would 
then like to use the "step" function to remove unnecessary variables 
from the model.  However, this fails with the error message:

 > mod1 <- step(model)
Start:  AIC=42
PathCR ~ Cluster + [[stuff omitted]]
Error in polr(formula = PathCR ~ [[stuff omitted]] :
  'start' is not of the correct length

The underlying problem appears to be that "step" calls "drop1" which 
calls "update" on the formula with an omitted term.  The "update" fails 
with the same error message:

 > update(model, ~ . - Cluster)
Error in polr(formula = PathCR ~ [[stuff omitted]] :
  'start' is not of the correct length

Since "update" extracts the initial function call from the model, it 
apparently passes the "start" parameters along to "polr" to refit the 
model.  Since one variable has been dropped, there are now too many 
parameters in the "start" parameter and the "update" fails.

Does anyone have a way around this difficulty?  (For an individual 
update, I could probably hack the "call" object inside the existing 
model, but I really don't see how to do that using 'step".)

Thanks,
    Kevin

 > sessionInfo()
R version 2.10.0 (2009-10-26)
i386-pc-mingw32

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252  
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                         
[5] LC_TIME=English_United States.1252   

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base    

other attached packages:
[1] MASS_7.3-4

loaded via a namespace (and not attached):
[1] tools_2.10.0



More information about the R-help mailing list