[R] treatment of factors and errors in ridge() function with coxph

From: Jessica Myers <jmyers6_at_PARTNERS.ORG>
Date: Wed, 27 Apr 2011 12:16:50 -0400


I am trying to fit a large Cox model with many predictors. Because there are many predictors, I would like to use the ridge() function to get penalized ml estimates for all coefficients. The problems are that:

  1. When I include a factor (like race) in the ridge() function, dummy variables are not created. The resulting model has a single coefficient for the race variable, and I have no idea what is the interpretation of this coefficient. Obviously, I can create the dummy variables myself, but it would be better not to.
  2. When I include a large number of predictors in ridge() [> ~ 35], coxph does not complete and I get the error: Error in model.matrix.default(Terms, m) : model frame and formula mismatch in model.matrix() Using a smaller subset of the same covariates, I don't get this error and it doesn't seem to matter which subset of covariates I use.

Any help with these problems would be greatly appreciated!

Thanks,

Jessica Myers
Instructor in Medicine
Division of Pharmacoepidemiology
Brigham and Women's Hospital

The information in this e-mail is intended only for the ...{{dropped:7}}



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 27 Apr 2011 - 18:10:10 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 27 Apr 2011 - 18:10:34 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive