\HeaderA{predict.survreg}{Predicted Values for a `survreg' Object}{predict.survreg}
\methaliasA{predict.survreg.penal}{predict.survreg}{predict.survreg.penal}
\keyword{survival}{predict.survreg}
\begin{Description}\relax
Predicted values for a \code{survreg} object
\end{Description}
\begin{Usage}
\begin{verbatim}
## 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),...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object}] result of a model fit using the \code{survreg} function. 

\item[\code{newdata}] data for prediction.  If absent predictions are for the 
subjects used in the original fit. 

\item[\code{type}] the type of predicted value.  
This can be on the original scale of the data (response), 
the linear predictor (\code{"linear"}, with \code{"lp"} as an allowed abbreviation), 
a predicted quantile on the original scale of the data (\code{"quantile"}), 
a quantile on the linear predictor scale (\code{"uquantile"}),
or the matrix of terms for the linear predictor (\code{"terms"}).
At this time \code{"link"} and linear predictor (\code{"lp"}) are identical. 

\item[\code{se.fit}] if \code{TRUE}, include the standard errors of the prediction in the result. 

\item[\code{terms}] subset of terms.  The default for residual type \code{"terms"} is a matrix with 
one column for every term (excluding the intercept) in the model. 

\item[\code{p}] vector of percentiles.  This is used only for quantile predictions. 

\item[\code{...}] for future methods
\end{ldescription}
\end{Arguments}
\begin{Value}
a vector or matrix of predicted values.
\end{Value}
\begin{References}\relax
Escobar and Meeker (1992). Assessing influence in regression analysis with 
censored data. \emph{Biometrics,} 48, 507-528.
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{survreg}{survreg}},  \code{\LinkA{residuals.survreg}{residuals.survreg}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
# 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) 

# Predicted Weibull survival curve for a lung cancer subject with
#  ECOG score of 2
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)
\end{ExampleCode}
\end{Examples}

