[R] error fitting coxph model

Jessica Myers JMYERS6 at PARTNERS.ORG
Thu May 3 16:48:16 CEST 2012


Hi David,

Thanks for your input.  My first thought was to look for missing  
values, but I can tell you there are no missing values in the input.   
The error is occurring somewhere deep inside coxpenal.fit, so I can't  
identify how any NAs might be created.  Also, the if/else syntax is  
from coxpenal.fit, so I'm assuming they've done it right.

But I like your idea about searching for the error in data halves.   
It's also worth mentioning that when I changed the df parameter on my  
pspline terms to df = 3, it worked fine, but the error below occurred  
with both df = 2 and df = 4.

Thanks,
Jessica

On May 3, 2012, at 10:00 AM, David Winsemius wrote:

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



The information in this e-mail is intended only for the ...{{dropped:7}}



More information about the R-help mailing list