betageometric(lprob = "logit", lshape = "loge",
iprob = NULL, ishape = 0.1,
moreSummation=c(2,100), tolerance=1.0e-10, zero=NULL)
prob
and shape
below).
The former lies in the unit interval and the latter is positive.
See Links
foNULL
means a value is computed internally.moreSummation[1]*max(y)+moreSummation[2]
is made, in which the
upper limit is an approximation to infinity.
Here, y
is the"vglmff"
(see vglmff-class
).
The object is used by modelling functions such as vglm
,
and vgam
.shape1
and shape2
.
The parameterization here is to focus on the parameters
$p$ 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-p) / (p-\phi)$. 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
.
geometric
,
betaff
,
rbetageom
.bg.data = data.frame(y = 0:11, wts = c(227,123,72,42,21,31,11,14,6,4,7,28))
fit = vglm(y ~ 1, betageometric, bg.data, weight = wts, trace = TRUE)
fitg = vglm(y ~ 1, geometric, bg.data, weight = wts, trace = TRUE)
coef(fit, matrix = TRUE)
Coef(fit)
sqrt(diag(vcov(fit, untransform = TRUE)))
fit@misc$shape1
fit@misc$shape2
# Very strong evidence of a beta-geometric:
pchisq(2*(logLik(fit) - logLik(fitg)), df = 1, lower.tail = FALSE)
Run the code above in your browser using DataLab