0

I use Cox regression to model survival data. My dataset has 345 observations and 78 events. The number of predictors in the Cox model is 124. All 124 variables are continuous Now, I want to do variable selection.The forward selection works fine. However, the stepwise and backward selection give the following error:

    Error in coxph.wtest(fit$var[nabeta, nabeta], temp, control$toler.chol) : 
    NA/NaN/Inf in foreign function call (arg 3)

Here is a sample of the code (unfortunatelly I cannot provide any data):

    fit <- coxph(Surv(time,Status) ~ .  , data=data1)
    final <- step(fit, direction="both")

Anyone knows what is the problem/what is the meaning of this error? Is it the number of predictors maybe?

D_C
  • 53
  • 10
  • The `coxph` class is generally built by 'survival' pkg functions but it doesn't expose the `wtest` function to the casual user, so what you are doing is hopelessly obscure unless you edit the question to include the code that produced this error and a better description of the 124 variables. I'm not sure that the survival package supports backward selection. Most of the the experts in R and statistics think backward selection is statistically invalid. – IRTFM Apr 11 '17 at 23:55
  • I just edited my question. My intention wasn't to use backward selection. I decided to try it, when I show the error I got from the stepwise. Because forward selection works fine, I believe that the problem is when the procedure tries to remove variables from the model (which is something that both backward and stepwise selection do). – D_C Apr 12 '17 at 00:55
  • I found a code here:https://r-forge.r-project.org/scm/viewvc.php/pkg/survival/noweb/coxph.Rnw?view=markup&root=survival which I believe can be used to find the source of my error. – D_C Apr 12 '17 at 01:25

0 Answers0