betageometric: Beta-geometric Distribution Family Function In VGAM: Vector Generalized Linear and Additive Models

Description

Maximum likelihood estimation for the beta-geometric distribution.

Usage

 ```1 2 3``` ```betageometric(lprob = "logitlink", lshape = "loglink", iprob = NULL, ishape = 0.1, moreSummation = c(2, 100), tolerance = 1.0e-10, zero = NULL) ```

Arguments

 `lprob, lshape` Parameter link functions applied to the parameters prob and phi (called `prob` and `shape` below). The former lies in the unit interval and the latter is positive. See `Links` for more choices. `iprob, ishape` Numeric. Initial values for the two parameters. A `NULL` means a value is computed internally. `moreSummation` Integer, of length 2. When computing the expected information matrix a series summation from 0 to `moreSummation[1]*max(y)+moreSummation[2]` is made, in which the upper limit is an approximation to infinity. Here, `y` is the response. `tolerance` Positive numeric. When all terms are less than this then the series is deemed to have converged. `zero` An integer-valued vector specifying which linear/additive predictors are modelled as intercepts only. If used, the value must be from the set {1,2}.

Details

A random variable Y has a 2-parameter beta-geometric distribution if P(Y=y) = prob * (1-prob)^y for y=0,1,2,... where prob are generated from a standard beta distribution with shape parameters `shape1` and `shape2`. The parameterization here is to focus on the parameters prob and phi = 1/(shape1+shape2), where phi is `shape`. The default link functions for these ensure that the appropriate range of the parameters is maintained. The mean of Y is E(Y) = shape2 / (shape1-1) = (1-prob) / (prob-phi) if `shape1 > 1`, and if so, then this is returned as the fitted values.

The geometric distribution is a special case of the beta-geometric distribution with phi=0 (see `geometric`). However, fitting data from a geometric distribution may result in numerical problems because the estimate of log(phi) will 'converge' to `-Inf`.

Value

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

Note

The first iteration may be very slow; if practical, it is best for the `weights` argument of `vglm` etc. to be used rather than inputting a very long vector as the response, i.e., `vglm(y ~ 1, ..., weights = wts)` is to be preferred over `vglm(rep(y, wts) ~ 1, ...)`. If convergence problems occur try inputting some values of argument `ishape`.

If an intercept-only model is fitted then the `misc` slot of the fitted object has list components `shape1` and `shape2`.

T. W. Yee

References

Paul, S. R. (2005). Testing goodness of fit of the geometric distribution: an application to human fecundability data. Journal of Modern Applied Statistical Methods, 4, 425–433.

`geometric`, `betaff`, `rbetageom`.

Examples

 ``` 1 2 3 4 5 6 7 8 9 10``` ```bdata <- data.frame(y = 0:11, wts = c(227,123,72,42,21,31,11,14,6,4,7,28)) fitb <- vglm(y ~ 1, betageometric, data = bdata, weight = wts, trace = TRUE) fitg <- vglm(y ~ 1, geometric, data = bdata, weight = wts, trace = TRUE) coef(fitb, matrix = TRUE) Coef(fitb) sqrt(diag(vcov(fitb, untransform = TRUE))) fitb@misc\$shape1 fitb@misc\$shape2 # Very strong evidence of a beta-geometric: pchisq(2 * (logLik(fitb) - logLik(fitg)), df = 1, lower.tail = FALSE) ```

Example output

```Loading required package: stats4
Applying Greenstadt modification to 12 matrices
VGLM    linear loop  1 :  loglikelihood = -1156.0501
Applying Greenstadt modification to 12 matrices
VGLM    linear loop  2 :  loglikelihood = -1145.9299
VGLM    linear loop  3 :  loglikelihood = -1146.517
Taking a modified step.
VGLM    linear loop  3 :  loglikelihood = -1145.5232
VGLM    linear loop  4 :  loglikelihood = -1145.381
VGLM    linear loop  5 :  loglikelihood = -1145.3727
VGLM    linear loop  6 :  loglikelihood = -1145.367
VGLM    linear loop  7 :  loglikelihood = -1145.3652
VGLM    linear loop  8 :  loglikelihood = -1145.3643
VGLM    linear loop  9 :  loglikelihood = -1145.364
VGLM    linear loop  10 :  loglikelihood = -1145.3638
VGLM    linear loop  11 :  loglikelihood = -1145.3638
VGLM    linear loop  12 :  loglikelihood = -1145.3637
Warning message:
In checkwz(wz, M = M, trace = trace, wzepsilon = control\$wzepsilon) :
12 diagonal elements of the working weights variable 'wz' have been replaced by 1.819e-12
VGLM    linear loop  1 :  loglikelihood = -1152.8512
VGLM    linear loop  2 :  loglikelihood = -1152.8511
logit(prob) loge(shape)
(Intercept)  -0.5492485   -2.594857
prob      shape
0.36603877 0.07465652
prob      shape
0.02020690 0.03114032
[1] 4.926248
[1] 8.539336
[1] 0.0001089575
```

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