Hi,
 
Step works for a Cox model. And I got the same error massage using
stepAIC.
 
Jia

  _____  

From: Ritwik Sinha [mailto:ritwik.sinha@gmail.com] 
Sent: Thursday, June 15, 2006 12:12 AM
To: Li, Jia
Subject: Re: [R] A question about stepwise procedures: step function


Hi,

The step documentation says 

"object: an object representing a model of an appropriate class
          (mainly '"lm"' and '"glm"'). This is used as the initial
          model in the stepwise search. 
"
I wonder if it will work for a cox proportional hazard model. You could
try stepAIC in MASS.




On 6/14/06, Li, Jia < LI@nsabp.pitt.edu <mailto:LI@nsabp.pitt.edu> >
wrote: 

	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
	
	______________________________________________
	R-help@stat.math.ethz.ch mailing list
	https://stat.ethz.ch/mailman/listinfo/r-help 
	PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
	




-- 
Ritwik Sinha
Graduate Student 
Epidemiology and Biostatistics
Case Western Reserve University

http://darwin.cwru.edu/~rsinha 

	[[alternative HTML version deleted]]

