[R] error fitting coxph model

David Winsemius dwinsemius at comcast.net
Thu May 3 16:00:50 CEST 2012


On May 2, 2012, at 3:02 PM, Jessica Myers wrote:

> Hi,
>
> I am using coxph from the survival package to fit a large model  
> (100,000 observations, ~35 covariates) using both ridge regression  
> (on binary covariates) and penalized splines (for continuous  
> covariates).
>
> In fitting, I get a strange error:
>
> Error in if (abs((y[nx] - target)/(y[nx - 1] - target)) > 0.6)  
> doing.well <- FALSE else doing.well <- TRUE :
>  missing value where TRUE/FALSE needed

You appear to have missing values in 'y', 'nx', or `target`. This  
could be a case of the newbie error of using if(){}else{} when  
ifelse() should have been used. Without at least the code we probably  
cannot resolve those two possibilities.
>
> Unfortunately, I can't reproduce this error without handing over my  
> entire dataset,

Why not? If the removal of missing values is unsuccessful and you were  
not committing the error I mentioned, then run it on two halves. Pick  
the one with the error. Rinse, lather, repeat.

> but I thought it would be worth checking if anyone had any insight.   
> I should note that the outcome that I'm using has almost everyone  
> having an event (~98,000 events out of 100,000).  I have fit other  
> models like this with no problem, but on one particular dataset it  
> fails.
>
> Thanks!
>
> Jessica Myers
> Instructor in Medicine

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list