zipebcom(lmu12 = "cloglog", lphi12 = "logit", loratio = "loge",
imu12 = NULL, iphi12 = NULL, ioratio = NULL,
zero = 2:3, tol = 0.001, addRidge = 0.001)
lmu12
should be left alone.
Argument imu12
may be of length 2 (one element for each response).Links
for more choices.CommonVGAMffArguments
for more details.
In general, good initial values (especially for iphi12
)
are often requiredNULL
means none.
The default has both $\phi$ and the odds ratio as
not being modelled as a function of the explanatory variables (apart
from an intercept).1+addRidge
to make it diagonally dominant,
therefore positive-definite."vglmff"
(see vglmff-class
).
The object is used by modelling functions such as vglm
and vgam
.
When fitted, the fitted.values
slot of the object contains the
four joint probabilities, labelled as $(Y_1,Y_2)$ = (0,0),
(0,1), (1,0), (1,1), respectively.
These estimated probabilities should be extracted with the fitted
generic function.
binom2.or
to bivariate binary
responses.binom2.or
) with a cloglog
link.
The data are assumed to come from a zero-inflated Poisson (ZIP) distribution
that has been converted to presence/absence.
Explicitly, the default model is
The second linear/additive predictor models the $\phi$
parameter (see zipoisson
).
The third linear/additive predictor is the same as binom2.or
,
viz., the log odds ratio.
Suppose a dataset1 comes from a Poisson distribution that has been
converted to presence/absence, and that both marginal probabilities
are the same (exchangeable).
Then binom2.or("cloglog", exch=TRUE)
is appropriate.
Now suppose a dataset2 comes from a zero-inflated Poisson
distribution. The first linear/additive predictor of zipebcom()
applied to dataset2
is the same as that of
binom2.or("cloglog", exch=TRUE)
applied to dataset1.
That is, the $\phi$ has been taken care
of by zipebcom()
so that it is just like the simpler
binom2.or
.
Note that, for $\eta_1$,
mu12 = prob12 / (1-phi12)
where prob12
is the probability
of a 1 under the ZIP model.
Here, mu12
correspond to mu1
and mu2
in the
binom2.or
-Poisson model.
If $\phi=0$ then zipebcom()
should be equivalent to
binom2.or("cloglog", exch=TRUE)
.
Full details are given in Yee and Dirnbock (2009).
The leading $2 \times 2$ submatrix of the expected
information matrix (EIM) is of rank-1, not 2! This is due to the
fact that the parameters corresponding to the first two
linear/additive predictors are unidentifiable. The quick fix
around this problem is to use the addRidge
adjustment.
The model is fitted by maximum likelihood estimation since the full
likelihood is specified. Fisher scoring is implemented.
The default models $\eta_2$ and $\eta_3$ as
single parameters only, but this
can be circumvented by setting zero=NULL
in order to model the
$\phi$ and odds ratio as a function of all the explanatory
variables.
binom2.or
,
zipoisson
,
cloglog
,
CommonVGAMffArguments
.mydat <- data.frame(x = seq(0, 1, len=(nsites <- 2000)))
mydat <- transform(mydat, eta1 = -3 + 5 * x,
phi1 = logit(-1, inverse=TRUE),
oratio = exp(2))
mydat <- transform(mydat, mu12 = cloglog(eta1, inverse = TRUE) * (1-phi1))
tmat <- with(mydat, rbinom2.or(nsites, mu1 = mu12, oratio = oratio, exch = TRUE))
mydat <- transform(mydat, ybin1 = tmat[,1], ybin2 = tmat[,2])
with(mydat, table(ybin1,ybin2)) / nsites # For interest only
# Various plots of the data, for interest only
par(mfrow = c(2, 2))
plot(jitter(ybin1) ~ x, data = mydat, col = "blue")
plot(jitter(ybin2) ~ jitter(ybin1), data = mydat, col = "blue")
plot(mu12 ~ x, data = mydat, col = "blue", type = "l", ylim = 0:1,
ylab = "Probability", main = "Marginal probability and phi")
with(mydat, abline(h = phi1[1], col = "red", lty = "dashed"))
tmat2 <- with(mydat, dbinom2.or(mu1 = mu12, oratio = oratio, exch = TRUE))
with(mydat, matplot(x, tmat2, col = 1:4, type = "l", ylim = 0:1,
ylab = "Probability", main = "Joint probabilities"))
# Now fit the model to the data.
fit <- vglm(cbind(ybin1, ybin2) ~ x, fam = zipebcom, dat = mydat, trace = TRUE)
coef(fit, matrix = TRUE)
summary(fit)
vcov(fit)
Run the code above in your browser using DataLab