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. however "predict(f)=predict(f,type="terms")[,1]+predict(f,type="terms")[,2]" how should i understand this. thanks so much for your help
test1 <- list(time= c(4, 1,1,2,2,3), status=c(1,1,0,1,1,0), x= c(0,1,1,1,0,0), sex= c(0,0,0,1,1,1)) f<-coxph( Surv(time, status) ~ x + sex, test1) Call: 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 bests; T.D ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.