# [R] predicted HR in coxph with psline

Terry Therneau therneau at mayo.edu
Fri Jan 25 16:06:38 CET 2013

```The normalization is the same as is found when you have type="terms" from a gam model:
each term is centered so that mean(predicted) = 0.  For a simple linear term beta*age this
implies that the predicted value will be 0 at the mean of age, for a polynomial or spline
this does not translate to a defined centering point.

The key idea is that if you were to replace age with "age + 10" the figure should not change.

By the way, thanks for including such clear example code for your question.

Terry T.

----- begin included message ----------
I have some questions about the predicted HR in coxph function including
psline covariate.

If just fitting covariate as linear form, by default, the reference value
for each of predictions type (linear predictor, risk and terms) is the mean
covariate within strata.

If the psline is specified for the covariate, what's the reference value
for the predictions?
I did some test code below:
###
par(mfrow = c(1,3))
test = coxph(Surv(time, status) ~ age, cancer)
test2 = coxph(Surv(time, status) ~ pspline(age, df=2), cancer)
test3 = coxph(Surv(time, status) ~ pspline(age, df=5), cancer)
pptest3=predict(test3, type="lp")
pptest2= predict(test2, type="lp")
pptest = predict(test, type="lp")
plot(cancer\$age, exp(pptest))
abline(v=mean(cancer\$age))
abline(h=1)
plot(cancer\$age, exp(pptest2))
abline(v=mean(cancer\$age))
abline(h=1)
plot(cancer\$age, exp(pptest3))
abline(v=mean(cancer\$age))
abline(h=1)

In the first model, age is just fitted as linear, and in the plot, when HR
=1 when age equals to the mean of age. However, it's not the case when age
is fitted as using psline.

So what are the reference value of age when psline is used? Any help or
idea will be very much appreciated!

Best,
Carrie--

```