\HeaderA{dsurvreg}{Distributions available in survreg.}{dsurvreg}
\aliasA{psurvreg}{dsurvreg}{psurvreg}
\aliasA{qsurvreg}{dsurvreg}{qsurvreg}
\keyword{distribution}{dsurvreg}
\begin{Description}\relax
Density, cumulative probability, and quantiles for the set of distributions
supported by the \code{survreg} function.
\end{Description}
\begin{Usage}
\begin{verbatim}
dsurvreg(x, mean, scale=1, distribution='weibull', parms)
psurvreg(q, mean, scale=1, distribution='weibull', parms)
qsurvreg(p, mean, scale=1, distribution='weibull', parms)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] vector of quantiles. 
Missing values (\code{NA}s) are allowed. 

\item[\code{q}] vector of quantiles. 
Missing values (\code{NA}s) are allowed. 

\item[\code{p}] vector of probabilities. 
Missing values (\code{NA}s) are allowed. 

\item[\code{mean}] vector of means. 
This is replicated to be the same length as \code{p} 
or \code{q}.

\item[\code{scale}] vector of (positive) scale factors.
This is replicated to be the same length as \code{p} 
or \code{q}.

\item[\code{distribution}] character string giving the name of the distribution.  This must be one
of the elements of \code{survreg.distributions}

\item[\code{parms}] optional parameters, if any, of the distribution.  For the t-distribution
this is the degrees of freedom.

\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Elements of \code{q} or 
\code{p} that are missing will cause the corresponding 
elements of the result to be missing. 

The \code{mean} and \code{scale}
values are as they would be for \code{survreg}.
In particular, if
the distribution is one that involves a transformation, then they are the
mean and scale of the transformed distribution.  
For example, the Weibull distribution is fit using the
Extreme value distribution along with a log transformation.
Letting \eqn{F(t) = 1 - \exp[-(at)^p]}{}
be the cumulative distribution of the
Weibull, the mean corresponds to \eqn{-\log(a)}{} and the scale
to \eqn{1/p}{} 
(Kalbfleish and Prentice, section 2.2.2).
\end{Details}
\begin{Value}
density (\code{dsurvreg}), 
probability (\code{psurvreg}), 
quantile (\code{qsurvreg}), or 
for the requested distribution with mean and scale
parameters \code{mean} and 
\code{sd}.
\end{Value}
\begin{Section}{References}
Kalbfleish, J. D. and Prentice, R. L. (1970). 
\emph{The Statistical Analysis of Failure Time Data}
Wiley, New York.
\end{Section}
\begin{SeeAlso}\relax
\code{\LinkA{survreg}{survreg}}, 
\code{\LinkA{Normal}{Normal}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
# List of distributions available
names(survreg.distributions)
## Not run: 
 [1] "extreme"     "logistic"    "gaussian"    "weibull"     "exponential"
 [6] "rayleigh"    "loggaussian" "lognormal"   "loglogistic" "t"          
## End(Not run)
# Compare results
all.equal(dsurvreg(1:10, 2, 5, dist='lognormal'), dlnorm(1:10, 2, 5))

# Hazard function for a Weibull distribution
x   <- seq(.1, 3, length=30)
haz <- dsurvreg(x, 2, 3)/ (1-psurvreg(x, 2, 3))
## Not run: 
plot(x, haz, log='xy', ylab="Hazard") #line with slope (1/scale -1)
## End(Not run)
\end{ExampleCode}
\end{Examples}

