therneau / survival

Survival package for R
390 stars 106 forks source link

NA coef in coxp.zph #185

Open OdeHein opened 2 years ago

OdeHein commented 2 years ago

Hello,

Firstly, I thank you for your great work.

I frequently use the your survival package and I have recently updated it and have seen you have had changed something in the way you take into account NA coeff in the cox.zph function (since update 3.1-12).

I think, there could be issues with following lines :

186 else temp[j, i] <- fit$coefficients[j]

and

212 if (length(j) ==1) sresid[,i] <- sresid[,i] + fit$coefficients[j]

because j is an asgn value which was modified at line 71 if there are NA in coef in fit object. And so the new asgn indicies don't correspond anymore with the original ones in fit$coefficients

Sorry, I don't have any example to illustrate it.

Am I right ?

Best,