Learn R Programming

VGAM (version 1.1-9)

truncweibull: Truncated Weibull Distribution Family Function

Description

Maximum likelihood estimation of the 2-parameter Weibull distribution with lower truncation. No observations should be censored.

Usage

truncweibull(lower.limit = 1e-5,
             lAlpha = "loglink", lBetaa = "loglink",
             iAlpha = NULL,   iBetaa = NULL,
             nrfs = 1, probs.y = c(0.2, 0.5, 0.8),
             imethod = 1, zero = "Betaa")

Value

An object of class "vglmff"

(see vglmff-class). The object is used by modelling functions such as vglm, and vgam.

Arguments

lower.limit

Positive lower truncation limits. Recycled to the same dimension as the response, going across rows first. The default, being close to 0, should mean effectively the same results as weibullR if there are no response values that are smaller.

lAlpha, lBetaa

Parameter link functions applied to the (positive) parameters Alpha (called \(\alpha\) below) and (positive) Betaa (called \(\beta\) below). See Links for more choices.

iAlpha, iBetaa

See CommonVGAMffArguments.

imethod, nrfs, zero, probs.y

Details at weibullR and CommonVGAMffArguments.

Author

T. W. Yee

Warning

This function may be converted to the same parameterization as weibullR at any time. Yet to do: one element of the EIM may be wrong (due to two interpretations of a formula; but it seems to work). Convergence is slower than usual and this may imply something is wrong; use argument maxit. In fact, it's probably because pgamma.deriv.unscaled is inaccurate at q = 1 and q = 2. Also, convergence should be monitored, especially if the truncation means that a large proportion of the data is lost compared to an ordinary Weibull distribution.

Details

MLE of the two parameters of the Weibull distribution are computed, subject to lower truncation. That is, all response values are greater than lower.limit, element-wise. For a particular observation this is any known positive value. This function is currently based directly on Wingo (1989) and his parameterization is used (it differs from weibullR.) In particular, \(\beta = a\) and \(\alpha = (1/b)^a\) where \(a\) and \(b\) are as in weibullR and dweibull.

Upon fitting the extra slot has a component called lower.limit which is of the same dimension as the response. The fitted values are the mean, which are computed using pgamma.deriv and pgamma.deriv.unscaled.

References

Wingo, D. R. (1989). The left-truncated Weibull distribution: theory and computation. Statistical Papers, 30(1), 39--48.

See Also

weibullR, dweibull, pgamma.deriv, pgamma.deriv.unscaled.

Examples

Run this code
nn <- 5000; prop.lost <- 0.40   # Proportion lost to truncation
wdata <- data.frame(x2 = runif(nn))  # Complete Weibull data
wdata <- transform(wdata,
         Betaa = exp(1))  # > 2 okay (satisfies regularity conds)
wdata <- transform(wdata, Alpha = exp(0.5 - 1 * x2))
wdata <- transform(wdata, Shape = Betaa,
#                         aaa   = Betaa,
#                         bbb   = 1 / Alpha^(1 / Betaa),
                          Scale = 1 / Alpha^(1 / Betaa))
wdata <- transform(wdata, y2 = rweibull(nn, Shape, scale = Scale))
summary(wdata)

# Proportion lost:
lower.limit2 <- with(wdata, quantile(y2, prob = prop.lost))
# Smaller due to truncation:
wdata <- subset(wdata, y2 > lower.limit2)

fit1 <- vglm(y2 ~ x2, maxit = 100, trace = TRUE,
             truncweibull(lower.limit = lower.limit2), wdata)
coef(fit1, matrix = TRUE)
summary(fit1)
vcov(fit1)
head(fit1@extra$lower.limit)

Run the code above in your browser using DataLab