[R] Error in stepAIC function using a survival model

Teddy Petrou greeksquared at hotmail.com
Thu Jun 23 22:03:43 CEST 2005


I keep getting the same error in my survival analysis. I have access to a 
very large database but am just using small subsets to get some results. In 
this particular subset there is 50 explanatory variables(both factors of 
many levels and covariates) and 117 data pieces with some of the data being 
censored.  I am using the stepAIC command to find my model.  My initial 
model is built from all variables that are solely significant in the cox PH 
model.  Well, the stepAIC command works for this particular dataset but it 
crashes when I bootstrap and I come up with a different model set. I get 
another dataset in the following way:

samp = sample(1:117, 117, replace =T)
newdataset = dataset[samp,]

The error I get is

         Error in fitter(X, Y, strats, offset, init, control, weights = 
weights,  :
         NA/NaN/Inf in foreign function call (arg 6)

The dataset that is inputted into the model is itself rid from all NA 
values.  The initial model put into the stepAIC function is comprised of 
about 20 different variables.  When solely modeled by a coxph using:

coxph(Surv(time, censored)~ var1, data = dataset)

a satisfactory result is ouputted.  But when running an additive model with 
many more variables, I get something to the following effect:


                              coef exp(coef) se(coef)      z       p

var1Unknown     0.000  1.00e+00   0.0000    NaN     NaN
varlevel2     -3.242  3.91e-02   2.5701 -1.262 2.1e-01
var2level3      4.730  1.13e+02   3.7318  1.267 2.1e-01
varr2level4      0.314  1.37e+00   2.9936  0.105 9.2e-01
var2level5      0.000  1.00e+00   0.0000    NaN     NaN

This is just cut from the output. Even though it seems the data I am working 
with is not the best, I am still confused as to why the stepAIC function is 
crashing.  It appears to be with the variables that have an NaN for their 
p-values.  But when the variables are modeled separately the model produces 
nice results.

thanks for any help




More information about the R-help mailing list