Density, cumulative distribution function, quantile function and random
generation for the set of distributions
supported by the survreg
function.
dsurvreg(x, mean, scale=1, distribution='weibull', parms)
psurvreg(q, mean, scale=1, distribution='weibull', parms)
qsurvreg(p, mean, scale=1, distribution='weibull', parms)
rsurvreg(n, mean, scale=1, distribution='weibull', parms)
density (dsurvreg
),
probability (psurvreg
),
quantile (qsurvreg
), or
for the requested distribution with mean and scale
parameters mean
and
sd
.
vector of quantiles.
Missing values (NA
s) are allowed.
vector of quantiles.
Missing values (NA
s) are allowed.
vector of probabilities.
Missing values (NA
s) are allowed.
number of random deviates to produce
vector of location (linear predictor) parameters for the model.
This is replicated to be the same length as p
, q
or n
.
vector of (positive) scale factors.
This is replicated to be the same length as p
,
q
or n
.
character string giving the name of the distribution. This must be one
of the elements of survreg.distributions
optional parameters, if any, of the distribution. For the t-distribution this is the degrees of freedom.
Elements of q
or
p
that are missing will cause the corresponding
elements of the result to be missing.
The location
and scale
values are as they would be for survreg
.
The label "mean" was an unfortunate choice (made in mimicry of qnorm);
a more correct label would be "linear predictor".
Since almost none of these distributions are symmetric the location
parameter is not actually a mean.
The survreg
routines use the parameterization found in chapter
2 of Kalbfleisch and Prentice.
Translation to the usual parameterization found in a textbook is not
always obvious.
For example, the Weibull distribution has cumulative distribution
function
\(F(t) = 1 - e^{-(\lambda t)^p}\)1 - exp((-lambda t)^p).
The actual fit uses the fact that \(\log(t)\) has an extreme
value distribution, with location and scale of
\(\alpha, \sigma\), which are the location and scale parameters
reported by the survreg
function.
The parameters are related by \(\sigma= 1/p\) and
\(\alpha = -\log(\lambda\).
The stats::dweibull
routine is parameterized in terms of
shape and scale parameters which correspond to \(p\) and
\(1/\lambda\) in the K and P notation.
Combining these we see that shape = \(1/\sigma\) and
scale = \(\exp{alpha}\).
Kalbfleisch, J. D. and Prentice, R. L., The statistical analysis of failure time data, Wiley, 2002.
survreg
,
Normal