[R] StepAIC with coxph

Ravi Varadhan rvaradhan at jhmi.edu
Wed Jan 28 18:17:05 CET 2009


Michele,

This error means that some of the variables in your formula have missing values, and hence when these terms or added/dropped you have a different sample size.  Hence, the AIC cannot be compared between different models.  The solution is to create a compelete-data dataframe for the largest model, i.e none of the variables in the largest model should have any missing values.  Then run stepAIC on this dataframe. 

Best,
Ravi.

____________________________________________________________________

Ravi Varadhan, Ph.D.
Assistant Professor,
Division of Geriatric Medicine and Gerontology
School of Medicine
Johns Hopkins University

Ph. (410) 502-2619
email: rvaradhan at jhmi.edu


----- Original Message -----
From: Michele Santacatterina <miksanta at gmail.com>
Date: Wednesday, January 28, 2009 9:51 am
Subject: [R] StepAIC with coxph
To: R-help at r-project.org


> Hi,
>  
>  i'm trying to apply StepAIC with coxph...but i have the same error:
>  
>  stepAIC(fitBMT)
>  Start:  AIC=327.77
>  Surv(TEMPO,morto==1) ˜ VOD + SESSO + ETA + ........
>  
>  Error in dropterm.default(fit,scope$drop, scale=scale,trace=max(0,  :
>  number of rows in use has changed: remove missing values?
>  
>  anybody know this error??
>  
>  Thanks.
>  
>  Michele
>  
>  	[[alternative HTML version deleted]]
>   
> ______________________________________________
>  R-help at r-project.org mailing list
>  
>  PLEASE do read the posting guide 
>  and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list