我想学习如何从R“ survival”的weibull survreg模型的值和标准误差的预测中获得置信区间。
R doc for predict.survreg的示例显示了一个图,它不仅给出了fit
的韦伯Survreg模型预测,而且给出了fit+2*se.fit
和fit-2*se.fit
。那么从fit-2*se.fit
到fit+2*se.fit
的范围对应于什么置信区间?对于给定的置信区间,如何为fit +/- n*se.fit
选择 n 以获得该置信区间?以下是代码:
lfit <- survreg(Surv(time, status) ~ ph.ecog, data=lung)
pct <- 1:98/100 # The 100th percentile of predicted survival is at +infinity
ptime <- predict(lfit, newdata=data.frame(ph.ecog=2), type='quantile', p=pct, se=TRUE)
matplot(cbind(ptime$fit, ptime$fit + 2*ptime$se.fit, ptime$fit - 2*ptime$se.fit)/30.5, 1-pct, xlab="Months", ylab="Survival", type='l', lty=c(1,2,2), col=1)
对于正态分布,我认为对于95%的置信区间,可以使用fit +/- 1.96*se.fit
。我不确定它是否适用于weibull survreg模型。