survival (version 3.5-8)

dsurvreg: Distributions available in survreg.

Description

Density, cumulative distribution function, quantile function and random generation for the set of distributions supported by the survreg function.

Usage

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)

Value

density (dsurvreg), probability (psurvreg), quantile (qsurvreg), or for the requested distribution with mean and scale parameters mean and sd.

Arguments

x

vector of quantiles. Missing values (NAs) are allowed.

q

vector of quantiles. Missing values (NAs) are allowed.

p

vector of probabilities. Missing values (NAs) are allowed.

n

number of random deviates to produce

mean

vector of location (linear predictor) parameters for the model. This is replicated to be the same length as p, q or n.

scale

vector of (positive) scale factors. This is replicated to be the same length as p, q or n.

distribution

character string giving the name of the distribution. This must be one of the elements of survreg.distributions

parms

optional parameters, if any, of the distribution. For the t-distribution this is the degrees of freedom.

Details

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}\). 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}\).

References

Kalbfleisch, J. D. and Prentice, R. L., The statistical analysis of failure time data, Wiley, 2002.

See Also

survreg, Normal