[R] stepAIC function

David Winsemius dwinsemius at comcast.net
Fri Dec 4 16:49:56 CET 2009


On Dec 4, 2009, at 9:29 AM, Ashta wrote:

> 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"

Perhaps you have not loaded the package that contains that function?


>
> 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,

Not exactly sure what that means. Kaplan-Meier estimate of ... what?
> 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

If you have a dataset with 300-400 events out of 3000-4000 subject,  
then why are you expressing surprise that you do not get a non- 
parametric estimate of the median survival? The median is the time at  
which half of the subjects would have experienced an event and you  
only have 1/10 of them with events.

-- 

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list