survReg
.
survReg
function.
dsurvReg(x, mean, scale=1, distribution='weibull') psurvReg(q, mean, scale=1, distribution='weibull') qsurvReg(p, mean, scale=1, distribution='weibull')
NA
s) are allowed.
NA
s) are allowed.
NA
s) are allowed.
p
or
q
.
p
or
q
.
survReg.distributions
dsurvReg
),
probability (
psurvReg
),
quantile (
qsurvReg
), or
for the requested distribution with mean and scale
parameters
mean
and
sd
.
Elements of
q
or
p
that are missing will cause the corresponding
elements of the result to be missing.
The
mean
and
scale
values are as they would be for
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 F(t) = 1 - exp(-(at)^p) be the cumulative distribution of the
Weibull, the mean corresponds to -log(a) and the scale to 1/p
(Kalbfleisch and Prentice, 1980, section 2.2.2).
Kalbfleisch, J. D. and Prentice, R. L. (1980). The Statistical Analysis of Failure Time Data Wiley, New York.
# List of distributions available names(survReg.distributions) # Shows: # [1] "extreme" "logistic" "gaussian" "weibull" "exponential" # [6] "rayleigh" "loggaussian" "lognormal" "loglogistic" "t" # Compare results all.equal(dsurvReg(1:10, 2, 5, dist='lognormal'), dlnorm(1:10, 2, 5)) # Hazard function for a Weibull distribution x <- seq(0.1, 3, length=30) haz <- dsurvReg(x, 2, 3)/(1-psurvReg(x, 2, 3)) plot(x, haz, log='xy', ylab="Hazard") # line with slope (1/scale - 1)