[R] stepAIC function

Ashta sewashm at gmail.com
Fri Dec 4 15:29:24 CET 2009


Hi All,

I am trying to run the following script  but have problem,

coxm<- coxph(Surv(sdat$time, sdat$cens)~hd+nawtg+nwwg+ntpg+cy+nseas,data=sdat)
coxm<-stepAIC(coxm,~.^2)

The error message is
Error: could not find function "stepAIC"

I tried to install the package  but I could not find it. Where can i get it?


The other question is that I want to get the Kaplan-Meier Estimate
for each covariate in the model,
Like
covaraite   n     Events   Mean, S.E.(mean) ,Median, 95% LCL, 95% UCL
   0             14      10       2.87       .03              2.2
    1.938         infi
   1             11      9          1.06      .67              1.1
     0.29           2.48

I used

sdat.fit0 <- survfit(Surv(sdat$time, sdat$cens)~sdat$ntpg, data = sdat,
type = "kaplan-meier", conf.type="plain")
sdat.fit0

Instead I got the following,


Call: survfit(formula = Surv(sdat$time, sdat$cens) ~ sdat$ntpg, data = sdat,
    type = "kaplan-meier", conf.type = "plain")

                       records  n.max   n.start  events   median
0.95LCL   0.95UCL
sdat$ntpg=0    3576  3576    3576    311          NA              NA          NA
sdat$ntpg=1    4851  4851    4851    466          NA              NA          NA


I would appreciate if some one can help me.

thanks




More information about the R-help mailing list