I'm running a coxph model with a spline using the cph wrapper {rms} and rcs as follows:
y <- cph(Surv(time, event) ~ rcs(data$z, df=4) + Age_recruitment + factor(eth) + bmi + factor(dm) , na.action=na.omit, data=data)
I'm afraid I can't post even a sample of the data as it is sensitive health info. data$z is a continuous variable. I get an error as follows:
Error in nact$nmiss : $ operator is invalid for atomic vectors
I understand this to mean that nact is a vector and therefore cannot be used with the $ - but not sure why this is happening since it is 'internal' to the cph call - i.e. not something I've created. I've tried removing the spline element in case that was the issue, but the same error occurs. Can anyone shed any light on this for me?
My goal is to run a series of coxph models using a different RCS each time and output the results meaningfully.
Thanks.