[R] plotting spline term when frailty term is included
Conor Edward Little
cli at ifs.ku.dk
Tue Mar 1 11:59:51 CET 2016
I'd very much appreciate your help in resolving a problem that I'm having with plotting a spline term.
I have a Cox PH model including a smoothing spline and a frailty term as follows:
fit<-coxph(Surv(start,end,exit) ~ x + pspline(z) + frailty(a))
When I run a model without a frailty term, I use the following in order to plot the splines:
termplot(fit, term = 2, se = TRUE, ylab = "Log Hazard", rug=TRUE, xlab = "z_name")
However, when the frailty term is included, it gives this error:
Error in pred[, first] : subscript out of bounds
What am I doing wrong here? Or is it the case that termplot does not work when splines and frailty are included?
A similar question was asked a number of years ago - as far as I can see it didn't receive an answer (online, at least).
Department of Political Science, University of Copenhagen
[[alternative HTML version deleted]]
More information about the R-help