# [R] Evaluation of survival analysis

Tue Nov 30 16:16:14 CET 2010

```Sorry that the first attachment didn't work, my fault.
Any suggestion or example about survival analysis, model evaluation or
R code for plot will be really appreciated.

>> Hello Mike,
>
> May i describe the analysis more clearly?
> My data is ecology data and my task is to 1) relate the 8 candidate (life
> history) varaibles with the lifespan of each subject and 2) use the known
> variables to predict lifespan.
> For the 1st task, i used Cox regression "coxph()" to  do uni-variate
> analysis first. However, most variables are correlated with each other. For
> involving more variables, principle component analysis is applied. After PAC
> "principal()", I chose three vairalbes according to the results (instead of
> the derived principle components since the interpretation of the original
> variables is easier) .
> For the 2nd task, i wanted to use the chosen variables to predict the
> lifespan. "predict(survreg())" is used to get the values.
> I attached parts of the results which are the residuals plot and predcited
> values vs. predictors derived from Cox regression and parametric
> survival model respectively.
>
> My problem: 1) not sure if the methods are correct for the tasks since the
> residuals plots are not totally randomly and the predicted hazard is less
> than 0.  2) i dont know how to explain/compare the fitness of the model.

> Any suggestion about the methods or results will be really appreciate. Thank you again.

> Best wishes,
> He
-------------- next part --------------
# The model with coxph()
fm1<-coxph(Surv(l,e)~pspline(x1)+pspline(x7)+pspline(x3)+strata(d\$age1brut))

Call:
coxph(formula = Surv(l, e) ~ pspline(x1) + pspline(x7) + pspline(x3) +
strata(d\$age1brut))

n=467 (49 observations deleted due to missingness)
coef     se(coef) se2     Chisq DF   p
pspline(x1), linear  0.04402 0.00978  0.00975 20.27 1.00 6.7e-06
pspline(x1), nonlin                           11.65 3.04 9.0e-03
pspline(x7), linear -0.63959 0.22292  0.22190  8.23 1.00 4.1e-03
pspline(x7), nonlin                           14.24 3.01 2.6e-03
pspline(x3), linear -0.00822 0.00915  0.00912  0.81 1.00 3.7e-01
pspline(x3), nonlin                           13.30 3.00 4.0e-03

exp(coef) exp(-coef) lower .95 upper .95
ps(x1)2     0.6014     1.6628  2.04e-01     1.776
ps(x1)3     0.3770     2.6523  7.87e-02     1.806
ps(x1)4     0.3332     3.0010  6.66e-02     1.668
ps(x1)5     0.4675     2.1392  9.81e-02     2.228
ps(x1)6     0.6939     1.4412  1.45e-01     3.309
ps(x1)7     0.7743     1.2915  1.60e-01     3.741
ps(x1)8     0.6818     1.4667  1.40e-01     3.326
ps(x1)9     0.8127     1.2305  1.60e-01     4.117
ps(x1)10    1.4829     0.6744  2.75e-01     7.994
ps(x1)11    3.0899     0.3236  5.18e-01    18.422
ps(x1)12    6.3947     0.1564  7.80e-01    52.425
ps(x1)13   13.2295     0.0756  7.61e-01   229.872
ps(x7)2     0.6142     1.6281  1.16e-01     3.247
ps(x7)3     0.3832     2.6093  2.63e-02     5.586
ps(x7)4     0.2615     3.8235  1.09e-02     6.249
ps(x7)5     0.1696     5.8977  6.37e-03     4.513
ps(x7)6     0.0776    12.8888  3.12e-03     1.931
ps(x7)7     0.0359    27.8438  1.51e-03     0.857
ps(x7)8     0.0295    33.8888  1.24e-03     0.704
ps(x7)9     0.0288    34.7161  1.19e-03     0.695
ps(x7)10    0.0311    32.1617  1.27e-03     0.760
ps(x7)11    0.0392    25.5043  1.55e-03     0.993
ps(x7)12    0.0549    18.2032  1.74e-03     1.732
ps(x7)13    0.0796    12.5607  1.27e-03     4.981
ps(x3)2     0.5954     1.6797  1.24e-01     2.866
ps(x3)3     0.3501     2.8567  3.21e-02     3.823
ps(x3)4     0.2147     4.6578  1.51e-02     3.061
ps(x3)5     0.1328     7.5306  9.57e-03     1.842
ps(x3)6     0.1040     9.6167  7.80e-03     1.386
ps(x3)7     0.1316     7.5980  9.85e-03     1.758
ps(x3)8     0.2031     4.9247  1.49e-02     2.758
ps(x3)9     0.1676     5.9673  1.17e-02     2.399
ps(x3)10    0.0965    10.3617  5.59e-03     1.665
ps(x3)11    0.0472    21.1933  1.72e-03     1.296
ps(x3)12    0.0219    45.7020  3.21e-04     1.491
ps(x3)13    0.0101    98.7665  3.58e-05     2.865

Iterations: 5 outer, 19 Newton-Raphson
Theta= 0.834
Theta= 0.734
Theta= 0.715
Degrees of freedom for terms= 4 4 4
Rsquare= 0.148   (max possible= 0.985 )
Likelihood ratio test= 75  on 12.1 df,   p=3.8e-11
Wald test            = 78  on 12.1 df,   p=1.07e-11

Iterations: 5 outer, 19 Newton-Raphson
Theta= 0.834
Theta= 0.734
Theta= 0.715
Degrees of freedom for terms= 4 4 4
Rsquare= 0.148   (max possible= 0.985 )
Likelihood ratio test= 75  on 12.1 df,   p=3.8e-11
Wald test            = 78  on 12.1 df,   p=1.07e-11

# The model with survreg()
fm2<-survreg(Surv(l,e)~pspline(x1)+pspline(x7)+pspline(x3)+strata(d\$age1brut))

survreg(formula = Surv(l, e) ~ pspline(x1) + pspline(x7) + pspline(x3) +
strata(d\$age1brut))

coef     se(coef) se2     Chisq DF   p
(Intercept)          1.05340 0.66521  0.49670  2.51 1.00 1.1e-01
pspline(x1), linear -0.01567 0.00258  0.00258 36.84 1.00 1.3e-09
pspline(x1), nonlin                           10.92 3.05 1.3e-02
pspline(x7), linear  0.23378 0.06078  0.06039 14.80 1.00 1.2e-04
pspline(x7), nonlin                            9.41 3.02 2.5e-02
pspline(x3), linear  0.00196 0.00254  0.00252  0.60 1.00 4.4e-01
pspline(x3), nonlin                           14.52 3.02 2.3e-03

Scale:
d\$age1brut=2 d\$age1brut=3 d\$age1brut=4 d\$age1brut=5
0.319        0.291        0.233        0.293

Iterations: 8 outer, 28 Newton-Raphson
Theta= 0.985
Theta= 0.973
Theta= 0.965
Degrees of freedom for terms= 0.6 4.1 4.0 4.0 3.9
Likelihood ratio test=89.1  on 11.5 df, p=4.36e-14
n=467 (49 observations deleted due to missingness)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graphs of residuals and predicts.pdf
Type: application/pdf
Size: 205877 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20101130/06c2f762/attachment.pdf>
```