Last chance! 50% off unlimited learning
Sale ends in
survreg
object## S3 method for class 'survreg':
predict(object, newdata,
type=c("response", "link", "lp", "linear", "terms", "quantile",
"uquantile"),
se.fit=FALSE, terms=NULL, p=c(0.1, 0.9),...)
survreg
function."linear"
, with "lp"
as an allowed abbreviation),
a predicted quantile on the original scale of the data ("quantil
"terms"
is a matrix with
one column for every term (excluding the intercept) in the model.survreg
, residuals.survreg
# Draw figure 1 from Escobar and Meeker
fit <- survreg(Surv(time,status) ~ age + age^2, data=stanford2,
dist='lognormal')
plot(stanford2$age, stanford2$time, xlab='Age', ylab='Days',
xlim=c(0,65), ylim=c(.01, 10^6), log='y')
pred <- predict(fit, newdata=list(age=1:65), type='quantile',
p=c(.1, .5, .9))
matlines(1:65, pred, lty=c(2,1,2), col=1)
Run the code above in your browser using DataLab