anova.glmb: Analysis of Deviance for Bayesian Generalized Linear Model...

View source: R/anova.glmb.R

anova.glmbR Documentation

Analysis of Deviance for Bayesian Generalized Linear Model Fits

Description

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.

Usage

## S3 method for class 'glmb'
anova(object, ...)

Arguments

object

an object of class glmb, typically the result of a call to glmb

...

Other arguments passed to or from other methods.

Details

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.

Value

An object of class "anova" inheriting from class "data.frame".

References

\insertAllCited

See Also

directional_tail, summary.glmb, glmb, glmbayes-package; rglmb, rlmb, lmb; anova.glm

Examples

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)

glmbayes documentation built on Aug. 5, 2026, 1:07 a.m.

Related to anova.glmb in glmbayes...