\HeaderA{survreg}{Regression for a Parametric Survival Model}{survreg}
\aliasA{anova.survreg}{survreg}{anova.survreg}
\aliasA{anova.survreglist}{survreg}{anova.survreglist}
\aliasA{labels.survreg}{survreg}{labels.survreg}
\aliasA{model.frame.survreg}{survreg}{model.frame.survreg}
\aliasA{print.summary.survreg}{survreg}{print.summary.survreg}
\aliasA{print.survreg.penal}{survreg}{print.survreg.penal}
\aliasA{survReg}{survreg}{survReg}
\aliasA{vcov.survreg}{survreg}{vcov.survreg}
\keyword{survival}{survreg}
\begin{Description}\relax
Fit a parametric survival regression model.
These are location-scale models for an arbitrary transform of the time
variable; the most common cases use a log transformation, leading to
accelerated failure time models.
\end{Description}
\begin{Usage}
\begin{verbatim}
survreg(formula, data, weights, subset, 
        na.action, dist="weibull", init=NULL, scale=0, 
        control,parms=NULL,model=FALSE, x=FALSE,
        y=TRUE, robust=FALSE, score=FALSE, ...)

\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{formula}] a formula expression as for other regression models. 
The response is usually a survival object as returned by the \code{Surv} function. 
See the documentation for \code{Surv}, \code{lm} and \code{formula} for details. 

\item[\code{data}] a data frame in which to interpret the variables named in 
the \code{formula}, \code{weights} or the \code{subset} arguments. 

\item[\code{weights}] optional vector of case weights
\item[\code{subset}] subset of the observations to be used in the fit

\item[\code{na.action}] a missing-data filter function, applied to the model.frame, after any 
\code{subset} argument has been used.  Default is \code{options()\$na.action}. 

\item[\code{dist}] assumed distribution for y variable. 
If the argument is a character string, then it is assumed to name an
element from \code{\LinkA{survreg.distributions}{survreg.distributions}}. These include
\code{"weibull"}, \code{"exponential"}, \code{"gaussian"},
\code{"logistic"},\code{"lognormal"} and \code{"loglogistic"}.
Otherwise, it is assumed to be a user defined list conforming to the
format described in \code{\LinkA{survreg.distributions}{survreg.distributions}}.

\item[\code{parms}] a list of fixed parameters.  For the t-distribution for instance this is
the degrees of freedom; most of the distributions have no parameters.

\item[\code{init}] optional vector of initial values for the parameters.

\item[\code{scale}] optional fixed value for the scale.  If set to \textless{}=0 then the scale is
estimated.

\item[\code{control}] a list of control values, in the format producted by
\code{\LinkA{survreg.control}{survreg.control}}. The default value is \code{survreg.control()}

\item[\code{model,x,y}] flags to control what is returned.  If any of these is true, then the
model frame, the model matrix, and/or the vector of response times will be
returned as components of the final result, with the same names as the
flag arguments.
\item[\code{score}] return the score vector. (This is expected to be zero upon
successful convergence.)

\item[\code{robust}] Use robust 'sandwich' standard errors, based on
independence of individuals if there is no \code{cluster()} term in
the formula, based on independence of clusters if there is.
\item[\code{...}] other arguments which will be passed to \code{survreg.control}.

\end{ldescription}
\end{Arguments}
\begin{Value}
an object of class \code{survreg} is returned.
\end{Value}
\begin{SeeAlso}\relax
\code{\LinkA{survreg.object}{survreg.object}}, \code{\LinkA{survreg.distributions}{survreg.distributions}},
\code{\LinkA{pspline}{pspline}}, \code{\LinkA{frailty}{frailty}}, \code{\LinkA{ridge}{ridge}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
# Fit an exponential model: these are all the same
survreg(Surv(futime, fustat) ~ ecog.ps + rx, ovarian, dist='weibull',scale=1)
survreg(Surv(futime, fustat) ~ ecog.ps + rx, ovarian,
        dist="exponential")

# There are multiple ways to parameterize a Weibull distribution. The survreg 
# function imbeds it in a general location-scale familiy, which is a 
# different parameterization than the rweibull function, and often leads
# to confusion.
#   survreg's scale  =    1/(rweibull shape)
#   survreg's intercept = log(rweibull scale)
#   For the log-likelihood all parameterizations lead to the same value.
y <- rweibull(1000, shape=2, scale=5)
survreg(Surv(y)~1, dist="weibull")

# Economists fit a model called `tobit regression', which is a standard
# linear regression with Gaussian errors, but with left censored data.
tobinfit <- survreg(Surv(durable, durable>0, type='left') ~ age + quant,
                    data=tobin, dist='gaussian')
\end{ExampleCode}
\end{Examples}

