# truncweibull: Truncated Weibull Distribution Family Function In VGAM: Vector Generalized Linear and Additive Models

## Description

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

## Usage

 ```1 2 3 4 5``` ```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") ```

## 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 α below) and (positive) `Betaa` (called β below). See `Links` for more choices. `iAlpha, iBetaa` See `CommonVGAMffArguments`. `imethod, nrfs, zero, probs.y` Details at `weibullR` and `CommonVGAMffArguments`.

## 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, β = a and α = (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`.

## Value

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

## 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.

## Note

More improvements need to be made, e.g., initial values are currently based on no truncation. This VGAM family function handles multiple responses.

T. W. Yee

## References

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

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

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21``` ```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 is 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 = Shape, scale = Scale)) summary(wdata) lower.limit2 <- with(wdata, quantile(y2, prob = prop.lost)) # Proportion lost wdata <- subset(wdata, y2 > lower.limit2) # Smaller due to truncation fit1 <- vglm(y2 ~ x2, maxit = 100, trace = TRUE, truncweibull(lower.limit = lower.limit2), data = wdata) coef(fit1, matrix = TRUE) summary(fit1) vcov(fit1) head(fit1@extra\$lower.limit) ```

### Example output

```Loading required package: stats4
x2               Betaa           Alpha            Shape
Min.   :0.000252   Min.   :2.718   Min.   :0.6067   Min.   :2.718
1st Qu.:0.254160   1st Qu.:2.718   1st Qu.:0.7700   1st Qu.:2.718
Median :0.518305   Median :2.718   Median :0.9819   Median :2.718
Mean   :0.508729   Mean   :2.718   Mean   :1.0341   Mean   :2.718
3rd Qu.:0.761403   3rd Qu.:2.718   3rd Qu.:1.2787   3rd Qu.:2.718
Max.   :0.999654   Max.   :2.718   Max.   :1.6483   Max.   :2.718
Scale              y2
Min.   :0.8321   Min.   :0.0397
1st Qu.:0.9135   1st Qu.:0.6254
Median :1.0068   Median :0.8749
Mean   :1.0090   Mean   :0.8971
3rd Qu.:1.1009   3rd Qu.:1.1418
Max.   :1.2018   Max.   :2.3815
VGLM    linear loop  1 :  loglikelihood = 10.9799481
VGLM    linear loop  2 :  loglikelihood = 209.495657
VGLM    linear loop  3 :  loglikelihood = 239.571138
VGLM    linear loop  4 :  loglikelihood = 252.353429
VGLM    linear loop  5 :  loglikelihood = 266.271145
VGLM    linear loop  6 :  loglikelihood = 281.842825
VGLM    linear loop  7 :  loglikelihood = 298.534958
VGLM    linear loop  8 :  loglikelihood = 314.202625
VGLM    linear loop  9 :  loglikelihood = 324.405765
VGLM    linear loop  10 :  loglikelihood = 327.184726
VGLM    linear loop  11 :  loglikelihood = 327.325204
VGLM    linear loop  12 :  loglikelihood = 327.325748
VGLM    linear loop  13 :  loglikelihood = 327.325749
loge(Alpha) loge(Betaa)
(Intercept)   0.4120722    1.016316
x2           -0.9118621    0.000000

Call:
vglm(formula = y2 ~ x2, family = truncweibull(lower.limit = lower.limit2),
data = wdata, maxit = 100, trace = TRUE)

Pearson residuals:
Min      1Q   Median     3Q    Max
loge(Alpha)  -2.627 -0.8832 0.006401 0.8285 2.4132
loge(Betaa) -10.814 -0.1810 0.245476 0.5109 0.7284

Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept):1  0.41207    0.04933   8.353   <2e-16 ***
(Intercept):2  1.01632    0.03005  33.815   <2e-16 ***
x2            -0.91186    0.06486 -14.059   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Number of linear predictors:  2

Names of linear predictors: loge(Alpha), loge(Betaa)

Log-likelihood: 327.3257 on 5997 degrees of freedom

Number of iterations: 13
(Intercept):1 (Intercept):2            x2
(Intercept):1   0.002433847 -0.0009081770 -0.0017173321
(Intercept):2  -0.000908177  0.0009033028 -0.0004537653
x2             -0.001717332 -0.0004537653  0.0042065200
[,1]
[1,] 0.7758356
[2,] 0.7758356
[3,] 0.7758356
[4,] 0.7758356
[5,] 0.7758356
[6,] 0.7758356
```

VGAM documentation built on Jan. 16, 2021, 5:21 p.m.