dirmultinomial(lphi = "logit", iphi = 0.10, parallel = FALSE, zero = "M")
Links
for more choices.parallel = TRUE
"M"
then this means the numerical value
$M$, which corresponds to"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
$M$ values $\pi_j(1/\phi-1)$.
choose
).
The above formula applies to each row of the matrix response.
In this lphi
applied to $\phi$.Note that $E(Y_j) = N_* \pi_j$ but the probabilities (returned as the fitted values) $\pi_j$ are bundled together as a $M$-column matrix. The quantities $N_*$ are returned as the prior weights.
The beta-binomial distribution is a special case of
the Dirichlet-multinomial distribution when $M=2$;
see betabinomial
. It is easy to show that
the first shape parameter of the beta distribution is
$shape1=\pi(1/\phi-1)$ and the second shape
parameter is $shape2=(1-\pi)(1/\phi-1)$.
Also, $\phi=1/(1+shape1+shape2)$, which
is known as the intra-cluster correlation coefficient.
Tvedebrink, T. (2010) Overdispersion in allelic counts and $\theta$-correction in forensic genetics. Theoretical Population Biology, 78, 200--210.
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
.nn <- 10; M <- 5
ydata <- data.frame(round(matrix(runif(nn * M, max = 10), nn, M))) # Integer counts
colnames(ydata) <- paste("y", 1:M, sep = "")
fit <- vglm(cbind(y1, y2, y3, y4, y5) ~ 1, dirmultinomial,
data = ydata, trace = TRUE)
head(fitted(fit))
depvar(fit) # Sample proportions
weights(fit, type = "prior", matrix = FALSE) # Total counts per row
ydata <- transform(ydata, x2 = runif(nn))
fit <- vglm(cbind(y1, y2, y3, y4, y5) ~ x2, dirmultinomial,
data = ydata, trace = TRUE)
# This does not work:
Coef(fit)
coef(fit, matrix = TRUE)
(sfit <- summary(fit))
vcov(sfit)
Run the code above in your browser using DataLab