Fits a Dirichlet-multinomial distribution to a matrix response.
dirmultinomial(lphi = "logit", iphi = 0.10, parallel = FALSE, zero = "M")
Link function applied to the Links
for more choices.
Numeric. Initial value for
A logical (formula not allowed here) indicating whether the
probabilities parallel = TRUE
will only work if you also set
zero = NULL
because of interference between these arguments
(with respect to the intercept term).
An integer-valued vector specifying which
linear/additive predictors are modelled as intercepts only.
The values must be from the set "M"
then this means the numerical value
zero = NULL
means none of the values from
the set
An object of class "vglmff"
(see vglmff-class
).
The object is used by modelling functions such as vglm
,
rrvglm
and vgam
.
If the model is an intercept-only model then @misc
(which is a
list) has a component called shape
which is a vector with the
This VGAM family function is prone to numerical problems, especially when there are covariates.
The Dirichlet-multinomial distribution
arises from a multinomial distribution where
the probability parameters are not constant but are generated from a
multivariate distribution called the Dirichlet distribution.
The Dirichlet-multinomial distribution has probability function
choose
).
The above formula applies to each row of the matrix response.
In this VGAM family function the first lphi
applied to
Note that
The beta-binomial distribution is a special case of
the Dirichlet-multinomial distribution when betabinomial
. It is easy to show that
the first shape parameter of the beta distribution is
Paul, S. R., Balasooriya, U. and Banerjee, T. (2005) Fisher information matrix of the Dirichlet-multinomial distribution. Biometrical Journal, 47, 230--236.
Tvedebrink, T. (2010)
Overdispersion in allelic counts and
Yu, P. and Shaw, C. A. (2014). An Efficient Algorithm for Accurate Computation of the Dirichlet-Multinomial Log-Likelihood Function. Bioinformatics, 30, 1547--54.
dirmul.old
,
betabinomial
,
betabinomialff
,
dirichlet
,
multinomial
.
# NOT RUN {
nn <- 5; M <- 4; set.seed(1)
ydata <- data.frame(round(matrix(runif(nn * M, max = 100), nn, M))) # Integer counts
colnames(ydata) <- paste("y", 1:M, sep = "")
fit <- vglm(cbind(y1, y2, y3, y4) ~ 1, dirmultinomial,
data = ydata, trace = TRUE)
head(fitted(fit))
depvar(fit) # Sample proportions
weights(fit, type = "prior", matrix = FALSE) # Total counts per row
# }
# NOT RUN {
ydata <- transform(ydata, x2 = runif(nn))
fit <- vglm(cbind(y1, y2, y3, y4) ~ x2, dirmultinomial,
data = ydata, trace = TRUE)
Coef(fit)
coef(fit, matrix = TRUE)
(sfit <- summary(fit))
vcov(sfit)
# }
Run the code above in your browser using DataLab