| anova.glmb | R Documentation |
Compute an analysis of deviance table for one (current implementation) or more (future) Bayesian generalized linear model fits. The structure follows the sequential analysis of deviance \insertCiteMcCullagh1989glmbayes, with Bayesian extensions for DIC, pD, Mahalanobis shift, and directional tail probability \insertCiteSpiegelhalter2002glmbayes.
## S3 method for class 'glmb'
anova(object, ...)
object |
an object of class |
... |
Other arguments passed to or from other methods. |
Specifying a single object (currently only implementation) gives a sequential
analysis of deviance table for that fit. The reductions in residual deviance as each
term of the formula is added in turn are given as the rows of a table, plus the residual
deviances themselves. The Mahalanobis shift and pDirectional columns report prior-posterior
disagreement diagnostics; see directional_tail and
\insertCiteglmbayesChapterA04glmbayes.
An object of class "anova" inheriting from class "data.frame".
directional_tail, summary.glmb, glmb,
glmbayes-package; rglmb, rlmb, lmb;
anova.glm
set.seed(333)
## Dobson (1990) Page 93: Randomized Controlled Trial :
counts <- c(18, 17, 15, 20, 10, 20, 25, 13, 12)
outcome <- gl(3, 1, 9)
treatment <- gl(3, 3)
ps <- Prior_Setup(counts ~ outcome + treatment, family = poisson())
glmb.D93 <- glmb(
counts ~ outcome + treatment,
family = poisson(),
pfamily = dNormal(mu = ps$mu, Sigma = ps$Sigma)
)
summary(glmb.D93)
# anova for Bayesian Model
# Sequential classical ANOVA (see glm anova below): adding outcome reduces residual deviance;
# adding treatment barely changes it.
# By DIC, the model with outcome but not treatment has the lowest DIC;
# treatment does not improve the criterion.
# Use of traditional anova is questionable in a Bayesian context.
# One may instead use Bayes factors or other approaches.
anova(glmb.D93)
glm.D93 <- glm(counts ~ outcome + treatment, family = poisson())
summary(glm.D93)
# corresponding
anova(glm.D93)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.