zageometric(lpobs0 = "logit", lprob = "logit",
type.fitted = c("mean", "pobs0", "onempobs0"),
imethod = 1, ipobs0 = NULL, iprob = NULL, zero = NULL)
zageometricff(lprob = "logit", lonempobs0 = "logit",
type.fitted = c("mean", "pobs0", "onempobs0"),
imethod = 1, iprob = NULL, ionempobs0 = NULL, zero = -2)
pobs0
or phi
here.
See Links
for more choices.prob
or $p$.
See Links
for more choices.CommonVGAMffArguments
and fittedvlm
for information."vglmff"
(see vglmff-class
).
The object is used by modelling functions such as vglm
,
and vgam
.
The fitted.values
slot of the fitted object,
which should be extracted by the generic function fitted
, returns
the mean $\mu$ (default) which is given by
type.fitted = "pobs0"
then $p_0$ is returned.
Inference obtained from summary.vglm
and summary.vgam
may or may not be correct. In particular, the p-values, standard errors
and degrees of freedom may need adjustment. Use simulation on artificial
data to check that these are reasonable.
The input can be a matrix (multiple responses).
By default, the two linear/additive predictors
of zageometric
are $(logit(\phi), logit(p))^T$.
The zageometricff()
has a few
changes compared to zageometric()
.
These are:
(i) the order of the linear/additive predictors is switched so the
geometric probability comes first;
(ii) argument onempobs0
is now 1 minus the probability of an observed 0,
i.e., the probability of the positive geometric distribution,
i.e., onempobs0
is 1-pobs0
;
(iii) argument zero
has a new default so that the pobs0
is intercept-only by default.
Now zageometricff()
is generally recommended over
zageometric()
.
Both functions implement Fisher scoring and can handle
multiple responses.
dzageom
,
geometric
,
zigeometric
,
dgeom
,
CommonVGAMffArguments
.zdata <- data.frame(x2 = runif(nn <- 1000))
zdata <- transform(zdata, pobs0 = logit(-1 + 2*x2, inverse = TRUE),
prob = logit(-2 + 3*x2, inverse = TRUE))
zdata <- transform(zdata, y1 = rzageom(nn, prob = prob, pobs0 = pobs0),
y2 = rzageom(nn, prob = prob, pobs0 = pobs0))
with(zdata, table(y1))
fit <- vglm(cbind(y1, y2) ~ x2, zageometric, data = zdata, trace = TRUE)
coef(fit, matrix = TRUE)
head(fitted(fit))
head(predict(fit))
summary(fit)
Run the code above in your browser using DataLab