Dear All, I want to generate survival curve with cox model but I want to estimate the coefficients using glmnet. However, I also want to include a strata() term in the model. Could anyone please tell me how to have this strata() effect in the model in glmnet? I tried converting a formula with strata() to a design matrix and feeding to glmnet, but glmnet just treats the strata() term with one independent variable... I know that if there is no such strata(), I can estimate coefficients from glmnet and use "...init=selectedBeta,iter=0)" in the coxph. Please advise me or also correct me if I'm wrong. Thank you very much! Best, Jieyue [[alternative HTML version deleted]]
Aaron Mackey
2013-Dec-09 13:39 UTC
[R] combine glmnet and coxph (and survfit) with strata()
I'm also curious how to use glmnet with survfit -- specifically, for use with interval regression (which, under the hood, is implemented using survfit). Can you show how you converted your Surv object formula to a design matrix for use with glmnet? Thanks, -Aaron On Sun, Dec 8, 2013 at 12:45 AM, Jieyue Li <jieyueli82@gmail.com> wrote:> Dear All, > > I want to generate survival curve with cox model but I want to estimate the > coefficients using glmnet. However, I also want to include a strata() term > in the model. Could anyone please tell me how to have this strata() effect > in the model in glmnet? I tried converting a formula with strata() to a > design matrix and feeding to glmnet, but glmnet just treats the strata() > term with one independent variable... > > I know that if there is no such strata(), I can estimate coefficients from > glmnet and use "...init=selectedBeta,iter=0)" in the coxph. Please advise > me or also correct me if I'm wrong. > > Thank you very much! > > Best, > > Jieyue > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. >[[alternative HTML version deleted]]