| zibinomial {VGAM} | R Documentation |
Fits a zero-inflated binomial distribution by maximum likelihood estimation.
zibinomial(lphi = "logit", lmu = "logit", ephi = list(), emu = list(),
iphi = NULL, zero = 1, mv = FALSE, imethod = 1)
lphi, lmu |
Link functions for the parameter phi
and the usual binomial probability mu parameter.
See |
ephi, emu |
List. Extra argument for the respective links.
See |
iphi |
Optional initial values for phi, whose values must lie between 0 and 1. The default is to compute an initial value internally. If a vector then recyling is used. |
mv |
Logical. Currently it must be |
zero, imethod |
See |
This function uses Fisher scoring and is based on
P(Y=0) = phi + (1-phi) * (1-mu)^N,
for y=0, and
P(Y=y) = (1-phi) * choose(N,Ny) * mu^(N*y) * (1-mu)^(N*(1-y)).
for y=1/N,2/N,…,1. That is, the response is a sample
proportion out of N trials, and the argument size in
rzibinom is N here.
The parameter phi satisfies 0 <
phi < 1. The mean of Y is E(Y)
= (1-phi) * mu and these are returned as the fitted values.
By default, the two linear/additive predictors are (logit(phi), logit(mu))^T.
An object of class "vglmff" (see vglmff-class).
The object is used by modelling functions such as vglm
and vgam.
Numerical problems can occur.
Half-stepping is not uncommon.
If failure to converge occurs, make use of the argument iphi.
The response variable must have one of the formats described by
binomialff, e.g., a factor or two column matrix or a
vector of sample proportions with the weights argument
specifying the values of N.
To work well, one needs N>1 and mu>0, i.e., the larger N and mu are, the better.
For intercept-models and constant N over the n observations,
the misc slot has a component called p0 which is the
estimate of P(Y=0). This family function currently cannot handle
a multivariate response (only mv = FALSE can be handled).
T. W. Yee
rzibinom,
binomialff,
posbinomial,
rbinom.
size = 10 # Number of trials; N in the notation above
nn = 200
zibdata = data.frame(phi = logit( 0, inverse = TRUE), # 0.50
mubin = logit(-1, inverse = TRUE), # Mean of usual binomial
sv = rep(size, length = nn))
zibdata = transform(zibdata,
y = rzibinom(nn, size = sv, prob = mubin, phi = phi))
with(zibdata, table(y))
fit = vglm(cbind(y, sv - y) ~ 1, zibinomial, zibdata, trace = TRUE)
coef(fit, matrix = TRUE)
Coef(fit) # Useful for intercept-only models
fit@misc$p0 # Estimate of P(Y = 0)
head(fitted(fit))
with(zibdata, mean(y)) # Compare this with fitted(fit)
summary(fit)