[R] linear predictors and survreg function
carol white
wht_crl at yahoo.com
Tue Feb 9 14:04:40 CET 2010
Hi,
I calculated the linear predictors derived from weibull model using ovarian data sets. I calculated the linear predictors as the sum of covariates weighted by the weibull coefficients and compared to the linear predictors generated by survreg function. Why are they different? note that the first element of coefficients vector is intercept was excluded in my calculation.
Look forward to your reply,
Carol
--------------------------------------------------
data(ovarian)
library(survival)
survreg.obj = survreg(Surv(ovarian[,1],ovarian[,2])~age +resid.ds +rx +ecog.ps,ovarian, dist = "weibull", scale = 1)
> survreg.obj$linear.predictors
[1] 5.298074 5.108976 5.558852 7.584172 7.221841 7.202655 7.019320 6.764081
[9] 6.011550 7.939097 7.174129 8.634805 6.783737 7.261585 8.955989 8.366687
[17] 7.970807 8.489844 8.302639 8.385361 7.553247 4.855690 7.851908 7.235689
[25] 6.616655 7.917497
*******************
lp = survreg.obj$coefficients[2:5]%*%t(ovarian[,3:6])
> lp
1 2 3 4 5 6 7
[1,] -7.484549 -7.673647 -7.223771 -5.198451 -5.560782 -5.579968 -5.763303
8 9 10 11 12 13 14
[1,] -6.018542 -6.771073 -4.843526 -5.608495 -4.147818 -5.998886 -5.521038
15 16 17 18 19 20 21
[1,] -3.826634 -4.415936 -4.811816 -4.292779 -4.479984 -4.397262 -5.229376
22 23 24 25 26
[1,] -7.926933 -4.930715 -5.546934 -6.165968 -4.865126
More information about the R-help
mailing list