[R] A question about stepwise procedures: step function

Li, Jia LI at nsabp.pitt.edu
Wed Jun 14 20:14:26 CEST 2006


Dear all,

I tried to use "step"  function to do model selection, but I got an error massage.  What I don't understand is that data as data.frame worked well for my other programs, how come I cannot make it run this time. Could you please tell me how I can fix it?

***************************************************************************************************

>all<-data.frame(z1,z2,z3)

>fit.model.all<- coxph(Surv(t,cen) ~z1+z2+z3,data=all)

> reg.model.all<-step(fit.model.all)
Start:  AIC= 689.1 
 Surv(t, cen) ~ z1 + z2 + z3 
Error in as.data.frame.default(data) : cannot coerce class "function" into a data.frame
***************************************************************************************************
Thanks a lot!
 
Jia



More information about the R-help mailing list