Albert (1994) described a general method of testing for the significance of terms in a log-linear model of which the test of independence is a special case. Consider the usual representation of a saturated log-linear model for a two-way table with R rows and C columns. If the counts in the table {
} are independent Poisson with expected counts {
}, the model is written as
where {
} and {
} are the sets of main effect parameters corresponding to the two classification variables and {
} are interaction parameters. Let u denote the entire vector of parameters, and
,
,
denote the corresponding vectors of main effects and interaction parameters.
The hypothesis of independence I is equivalent to the statement that all of the interaction parameters {
} in the saturated model are equal to zero. The dependence hypothesis D is that at least one of the interaction parameters is nonzero.
To develop a test for I against D, one must construct a prior distribution on the parameter vector
under both hypotheses. Assume that
and
are independent with prior density
Under both hypotheses I and D, the constant and main effect parameters
are assigned an improper uniform prior. Under the dependence hypothesis D, the set of R C interaction terms {
} are assumed independent from a common normal distribution with mean 0 and variance
. The interaction terms are equal to zero under the independence hypothesis I. This degenerate distribution on the interaction terms can be viewed as the limit of the above N(0,
) prior as the precision parameter P approaches infinity. In the below expressions, we write the prior as
to indicate the dependence on a single precision hyperparameter P.
The Bayes factor against the hypothesis of independence is given by
the ratio of the marginal probabilities of the data y under the two hypotheses. In this situation, this statistic can be expressed as
where
is the Poisson likelihood function and
denotes the degenerate prior on the interaction terms under the independence hypothesis.