Sorry, I still cannot find what's wrong with it. And it seems that
nothing is wrong with t.
 
Jia
 
> z1<-rnorm(N,0,1)
> z2<-rnorm(N,3,5)
> z3<-rbinom(N,1,0.6)
> 
> prop.cens<-0.45                   
> cen<-rbinom(N,1,1-prop.cens)     #<-- censor indicator:45% censor in
the data.
> t<- rexp(N)

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

        coef exp(coef) se(coef)       z    p
z1  0.057466     1.059   0.1377  0.4173 0.68
z2  0.000907     1.001   0.0332  0.0273 0.98
z3 -0.349273     0.705   0.2867 -1.2184 0.22
 
Likelihood ratio test=1.81  on 3 df, p=0.613  n= 100 
> reg.model.all<-step(fit.model.all)
Start:  AIC= 376.39 
 Surv(t, cen) ~ z1 + z2 + z3 
 
Error in as.data.frame.default(data) : cannot coerce class "function"
into a data.frame


  _____  

From: Hong Ooi [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 15, 2006 10:53 AM
To: Li, Jia
Subject: RE: [R] A question about stepwise procedures: step function



Note: This e-mail is subject to the disclaimer contained at the bottom
of this message.

  _____  

t is the name of a function. If you have a variable called t in your
dataset, try renaming it.
 

  _____  

From: [EMAIL PROTECTED] on behalf of Li, Jia
Sent: Thu 15/06/2006 11:52 PM
To: [email protected]; [EMAIL PROTECTED]
Subject: Re: [R] A question about stepwise procedures: step function



Hi,

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

Jia

  _____ 

From: Ritwik Sinha [mailto:[EMAIL PROTECTED]
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 < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> >
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
       
        ______________________________________________
        [email protected] 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]]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html


  _____  

The information transmitted in this message and its attachme...{{dropped}}

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to