[R] some question about partial prediction in survival

coldeyes.Rhelp coldeyes.rhelp at gmail.com
Mon Oct 15 05:10:53 CEST 2007

Hi there:
i got a problem to get the prediction from a model recently.  for 
example if i use a survival analysis to predict the risk. i use the code 
like below: i found the the prediction is not equal to (coef * x + coef 
* sex) , could someone help me with why this happened? and  can someone 
explain to me how this command "predict(f, type="terms")" works? is 
every partial prediction equal to coef*x=predict(f,type="terms")[,1] and 
coef*sex=predict(f,type="terms")[,2]?  it looks like they did not match.
how should i understand this. thanks so much for your help

test1 <- list(time=  c(4, 1,1,2,2,3),
                x=     c(0,1,1,1,0,0),
                sex=   c(0,0,0,1,1,1))
f<-coxph( Surv(time, status) ~ x + sex, test1)

coxph(formula = Surv(time, status) ~ x + sex, data = test1)

      coef exp(coef) se(coef)      z    p
x    1.713     5.546     1.34  1.282 0.20
sex -0.154     0.857     1.45 -0.106 0.92

Likelihood ratio test=1.85  on 2 df, p=0.397  n= 6


More information about the R-help mailing list