Coxph Model Error: NA/NaN/Inf in foreign function call (arg 6)
0
0
Entering edit mode
3.5 years ago
jack.henry ▴ 50

I have been trying to test a coxph model using the survival R package but I get an error saying:

Error in coxph.fit(X, Y, istrat, offset, init, control, weights = weights, : NA/NaN/Inf in foreign function call (arg 6).

Could anyone help with trying to figure out why I am getting this error? Any help would be greatly appreciated.

I don't have any NA/NAN in my data. Arg 6 to coxph.fit looks like it is the "control" arg but I do not change this from the default so I don't see why it would be NA.

My call is:

coxph(Surv(time, status) ~ a + b + c + d + e + f + g + h + i + j, data = data)

An small sample of the data that still breaks coxph:

        patient status time          a           b           c           d           e           f            g           h           i           j
TCGA-KL-8329      0 2752  0.5959293 -0.32985431  0.01111783  1.10744153 -0.70773316  2.33015904  1.463100812 -0.58329411  1.20687773 -0.28295541
TCGA-KN-8434      0 1797 -0.6500944  0.25498091 -0.35169400  2.81911736 -0.74883154  0.02330166  0.433175800 -0.45768414 -0.89713134  0.18003018
TCGA-KL-8339      1   64  0.4846779 -0.75415243  3.50603746 -0.35936700  0.45428359 -0.29873596  0.208140421  0.24296338  2.75467922 -0.83665793
TCGA-KM-8639      0  953  1.2930386 -0.75202936 -1.00069583  0.06050088  0.87667520  0.47147489 -0.831912681  1.04654568 -0.92575102  1.09891592
TCGA-KO-8410      0 3136  1.8160216  0.51484920  0.68337395  0.74592256 -0.55317283  0.55056419 -1.633187319  0.42832081  1.36152850  1.21369366
TCGA-KL-8345      0 1665  0.3655134  3.23947546 -0.82069294 -0.35579843 -0.10348039 -0.82487417  0.013001415 -0.73867513  0.51427163  1.60462114
TCGA-KM-8440      0 1366  1.3503198  0.68554209 -0.96563911 -0.75209746 -1.08852060 -0.73716727  0.620474898 -0.62548400  1.01743809 -0.04577739
TCGA-KN-8421      0 2674 -0.5999773 -0.92812435 -1.29402171 -1.04209357 -0.36470615 -0.80856206  0.138467144  0.91260631 -0.48853208 -0.05385749
TCGA-KO-8408      1   46 -0.7966362 -0.11108162 -0.09734132 -0.38926814 -0.08648102 -0.61187352  1.512610975 -0.02434646 -0.74341457 -0.93328251
TCGA-KM-8441      1  876  1.2476346  0.43054579  1.53359773  0.75223889 -0.70809878  0.24186658 -0.715544302  2.06504650 -1.42195827  1.39850139
TCGA-KN-8429      1 1989  0.6442450  0.12417443 -0.35520555 -0.67192046 -1.18596161 -0.38605648 -0.137363593 -0.42482600 -0.03640180 -0.21118608
TCGA-KN-8436      0 1288 -0.6045523 -0.66475787 -0.83244185 -0.61951029 -0.91843257 -0.52746350 -0.936507918  0.11748090  0.52896542  3.44647470
TCGA-KL-8323      1  758 -0.2876298  1.33759944  0.16933643 -0.86583167 -0.54652573 -0.45429365  1.038946771 -0.45015524 -0.24543396 -0.72123023
TCGA-KL-8335      0 2815  0.4643741 -0.47734933 -0.04148033 -0.94716189 -0.28416727 -0.11869188  0.001081911 -0.55421354 -0.19709587 -0.25093850
TCGA-KL-8342      0 2248 -0.6811296  1.06989305 -0.49154196  0.63527974 -0.16349934  0.81882058  0.479408563 -0.67364006  0.52097891 -0.60018980
TCGA-KL-8341      1  175  2.2993460  0.97148499 -1.08338334 -0.92154221 -0.79875858 -0.77990396 -0.772255184 -0.12252440 -0.82129263  1.43929478
TCGA-KN-8418      0 3935  0.5880805 -0.48058398 -0.60444151 -0.54974512 -0.57916121 -0.76058574  0.079354544 -0.36879020  1.16583457 -0.74584643
TCGA-KN-8433      0  341 -0.4327167 -1.39590608 -0.13868336 -0.02066941  0.52908383  0.52553709  0.049420802 -0.60782703 -1.39598026 -0.97120928
TCGA-KN-8427      0   30 -1.5261003 -2.21321280  3.61366151 -0.51032389  2.86850530  3.08845149 -0.286512019  4.42491129 -1.43815488 -0.71139085
TCGA-KN-8424      0 1983  0.1435498  1.29565513 -0.66865805  0.46317412 -0.49096263 -0.02104489  0.199648419 -0.54121811 -0.03600989  0.09847712
TCGA-KO-8404      1  148 -2.0367819 -2.29722822  0.48869237  0.61002742  0.73853424  0.01084746  2.922209321  1.46432769 -1.67244955 -0.93391669
TCGA-KL-8340      0 2024 -0.1763127 -0.21485371 -0.47613539 -0.48815605 -0.64883055 -0.56352292  1.098792615 -0.50637297 -0.23458907 -0.76127933
TCGA-KL-8328      0 3127 -0.7045284 -0.20443384  0.29524477 -0.90285461  1.11553049 -0.87844712  1.163996186 -0.01651090  0.43666672 -0.37453769
TCGA-KN-8419      0  714  2.1128842 -0.28858802  0.07314872 -0.91032357  0.65266749  0.76179219 -1.539406675 -0.48882948 -0.95832164  2.16468136
TCGA-KL-8332      0 2582 -0.2857939 -0.27370677 -0.19269890  0.07785714 -0.12539035  0.10739666  0.156789028 -0.30346481 -0.10040207  0.08045569
TCGA-KN-8435      0 3498 -0.3589219  0.06624912 -0.90719877 -0.84942279 -0.82143889 -0.74310721 -0.141505591 -0.07659146  1.25014257 -0.76830040

Thanks in advance.

r coxph survival • 3.8k views
ADD COMMENT
0
Entering edit mode

Here is some points:

  • It complains about the model size: with the default setting it works fine with 8 features, but feeding the model with all 9 features (a+b+c.....) , returning the same error. Maybe tuning different coxph parameters , can help.

  • Here is a similar post that might give you some insights

  • you missed data, before = data in your code, but I assumed this is some thing related to pasting your code here.
ADD REPLY

Login before adding your answer.

Traffic: 1894 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6