Tutorials › Generalized Linear Models › Marginal Totals as Sufficient Statistics

Poisson Loglinear Models · Tutorial 461 of 981

Marginal Totals as Sufficient Statistics

Learn to identify the marginal totals that retain all likelihood information about loglinear parameters and to derive their matching equations.

Intermediate 12 min read

What You'll Learn

  • Express independent Poisson cell counts as an exponential-family model with a design vector for each cell
  • Derive a sufficient statistic by factoring the joint likelihood
  • Identify the marginal totals associated with generating classes in hierarchical models
  • Connect likelihood score equations to equality of observed and fitted margins
  • Recognize when margins are redundant and when score equations require an interior finite estimate

Why Margins Carry Information About Loglinear Parameters

A contingency table may contain many cell counts, while a loglinear model describes those counts using a smaller collection of effects. The likelihood depends on the data through particular sums of cell counts: the margins corresponding to the effects included in the model. These margins are sufficient statistics for the model parameters. They also appear in the likelihood equations, which require the fitted margins to agree with the observed ones when a finite maximum likelihood estimate exists.

The key reason is visible in the Poisson likelihood. A loglinear model makes each cell's log mean a linear combination of model terms. Collecting the data-dependent terms in the likelihood then produces sums of counts weighted by those same terms. For categorical factors, those sums are marginal totals or contrasts of marginal totals.

Poisson Factorization and Sufficient Statistics

Definition: A statistic \(T(Y)\) is sufficient for a parameter \(\beta\) if, conditional on \(T(Y)\), the distribution of the data \(Y\) does not depend on \(\beta\). Equivalently, under the Neyman–Fisher factorization theorem, the joint probability mass function can be written as \(f_\beta(y)=g_\beta(T(y))h(y)\), where \(g_\beta\) depends on the data only through \(T(y)\), and \(h\) does not depend on \(\beta\).

Suppose the table has \(m\) cells and the counts \(Y_1,\ldots,Y_m\) are independent Poisson random variables. Write their means as \(\mu_j\), and specify the loglinear model by \(\log\mu_j=x_j^{\mathsf T}\beta\), where \(x_j\) is the fixed design vector for cell \(j\) and \(\beta\) is the parameter vector. This includes a constant term when the model has an intercept. The joint probability mass function is

$$ f_\beta(y) =\prod_{j=1}^m \frac{\exp(-\mu_j)\mu_j^{y_j}}{y_j!} =\frac{1}{\prod_{j=1}^m y_j!} \exp\left\{\beta^{\mathsf T}\sum_{j=1}^m x_jy_j-\sum_{j=1}^m \exp(x_j^{\mathsf T}\beta)\right\}. $$

The data enter the parameter-dependent part only through \(T(y)=\sum_j x_jy_j\). Thus the factorization theorem identifies this vector as sufficient for \(\beta\). This conclusion holds even if some columns of the design matrix are redundant; such redundancy affects parameter identifiability, not the factorization.

Theorem: For independent Poisson cell counts with fixed design vectors \(x_j\) and log means \(\log\mu_j=x_j^{\mathsf T}\beta\), the statistic \(T(Y)=\sum_j x_jY_j\) is sufficient for \(\beta\). If a design component is an indicator for a particular factor-level combination, the corresponding component of \(T(Y)\) is the count total over cells having that combination.

To see directly why the factorization gives sufficiency, fix a possible value \(t\) of \(T(Y)\). For any table \(y\) with \(T(y)=t\), its probability has the form \(h(y)\exp\{\beta^{\mathsf T}t-\sum_j\exp(x_j^{\mathsf T}\beta)\}\). When probabilities are normalized over all tables with that same statistic \(t\), the common parameter-dependent factor cancels. The conditional probability is therefore

$$ P_\beta(Y=y\mid T(Y)=t) =\frac{h(y)}{\sum_{z:T(z)=t}h(z)}, \qquad T(y)=t, $$

which does not involve \(\beta\). The denominator is a sum over a countable set of tables and is finite and positive whenever the conditioning event has positive probability. This verifies the conditional-distribution definition as well. \(\square\)

From Model Terms to Marginal Totals

For categorical factors, the design terms indicate which margins are relevant. Let the table index \(i=(i_1,\ldots,i_q)\) specify one level of each of \(q\) factors, and let \(y_i\) be its observed count. For a subset of factors \(A\), define the \(A\)-margin at level combination \(i_A\) by summing over all remaining factors:

$$ y_{i_A+}=\sum_{i_{A^c}} y_i. $$

A hierarchical loglinear model is specified by a generating class: a collection of factor subsets such that the model contains the terms for those subsets and all their subsets. For a generator \(A\), the model can include any function of the factor levels in \(A\); in a full-indicator representation, the corresponding design terms indicate each possible level combination \(i_A\). Summing each indicator times the count across cells gives exactly \(y_{i_A+}\). Therefore, the margins for the generating class provide sufficient statistics. They may contain redundant information: some margins, or totals within them, can be determined from other margins.

This formulation does not depend on a particular coding of the effects. Reference-cell or contrast coding replaces full indicators by linear combinations of them. The resulting sufficient statistics are then corresponding contrasts of margins, but the complete generator margins contain those contrasts and are a convenient way to report the information.

Worked Example: Independence in a Two-Way Table

Consider a \(2\times3\) table of independent Poisson counts, with the independence loglinear model \(\log\mu_{ij}=\lambda+\alpha_i+\gamma_j\). The design terms are the overall intercept, row indicators, and column indicators. Hence the data are represented in the likelihood through the row totals, column totals, and grand total. The grand total is already the sum of the row totals and also of the column totals.

Column 1Column 2Column 3Row total
Row 110203060
Row 215253575
Column total254565135

The calculations are \(10+20+30=60\) for Row 1, \(15+25+35=75\) for Row 2, \(10+15=25\) for Column 1, \(20+25=45\) for Column 2, and \(30+35=65\) for Column 3. Both sets of margins sum to \(135\). Thus these margins, rather than the six separate cell counts, suffice for the model parameters. This does not say that every cell is determined by the margins; it says that the likelihood's dependence on the parameters is captured by them.

Worked Example: A Three-Way Model with Two Generators

Let \(A,B,C\) be binary factors and use the hierarchical model with generating class \([AB][AC]\). Its terms involve \(A,B\) together and \(A,C\) together, with their subsets included; there is no \(BC\) or three-factor interaction term. The sufficient margins are therefore \(AB\) and \(AC\).

ABCObserved count
0001
0012
0103
0114
1005
1016
1107
1118

For the \(AB\)-margin, sum over \(C\): at \(A=0\), the totals for \(B=0,1\) are \(1+2=3\) and \(3+4=7\); at \(A=1\), they are \(5+6=11\) and \(7+8=15\). For the \(AC\)-margin, sum over \(B\): at \(A=0\), the totals for \(C=0,1\) are \(1+3=4\) and \(2+4=6\); at \(A=1\), they are \(5+7=12\) and \(6+8=14\). Both margins sum to \(36\), the total of all eight cells. These two margins are sufficient for the model parameters, although they are not two unrelated data summaries: their totals must agree.

Likelihood Equations Match the Model Margins

The same sufficient statistics appear when differentiating the log-likelihood. Let \(X\) be the matrix whose \(j\)th row is \(x_j^{\mathsf T}\), and let \(\mu_j(\beta)=\exp(x_j^{\mathsf T}\beta)\). The log-likelihood, omitting no data-dependent terms, is

$$ \ell(\beta)=\sum_{j=1}^m\{y_jx_j^{\mathsf T}\beta-\exp(x_j^{\mathsf T}\beta)-\log(y_j!)\}. $$

Its gradient is

$$ \nabla_\beta\ell(\beta) =\sum_{j=1}^m x_j(y_j-\mu_j) =X^{\mathsf T}(y-\mu). $$
Theorem: Suppose the independent Poisson loglinear model has a finite maximum likelihood estimate \(\hat\beta\) in the interior of its parameter space. Then \(X^{\mathsf T}y=X^{\mathsf T}\hat\mu\), where \(\hat\mu_j=\exp(x_j^{\mathsf T}\hat\beta)\). In a full-indicator representation of a hierarchical model, this equation says that each observed generator margin equals its fitted margin.

Proof. At an interior maximum of a differentiable log-likelihood, every partial derivative with respect to a free parameter is zero. Applying this necessary condition to the displayed gradient gives

$$ 0=X^{\mathsf T}(y-\hat\mu), \qquad\text{so}\qquad X^{\mathsf T}y=X^{\mathsf T}\hat\mu. $$

Now consider a design column that is the indicator of a particular level combination \(i_A\) of a generator \(A\). Its component of \(X^{\mathsf T}y\) is the sum of observed counts in cells with that combination, namely \(y_{i_A+}\). The corresponding component of \(X^{\mathsf T}\hat\mu\) is \(\hat\mu_{i_A+}=\sum_{i_{A^c}}\hat\mu_i\), the fitted margin. Equality of the vectors therefore gives equality of these observed and fitted margins for every such indicator. If effects are expressed in a reduced contrast coding, the score equations first state equality of the associated contrasts; because the model includes the lower-order terms, those equations together recover the same generator-margin equalities. The result is a necessary likelihood equation, not a claim that an estimate always exists or that matching margins alone establishes a finite maximum. \(\square\)

Worked Example: Checking the Margin Equations for a Three-Way Model

Return to the \([AB][AC]\) table above. Suppose a finite estimate is obtained under this model. The score equations for the \(AB\) indicator columns require the fitted \(AB\)-margin to be \((3,7,11,15)\), in the order \((A,B)=(0,0),(0,1),(1,0),(1,1)\). The score equations for \(AC\) require the fitted \(AC\)-margin to be \((4,6,12,14)\), in the order \((A,C)=(0,0),(0,1),(1,0),(1,1)\).

As a consistency check, the four observed \(AB\) entries sum to \(3+7+11+15=36\), and the four observed \(AC\) entries sum to \(4+6+12+14=36\). A fitted table matching both sets must likewise have total \(36\) from either margin. The equations constrain the fitted cells through these margins; they do not require each fitted cell to equal its observed count.

Common Mistakes and Practical Meaning

  • Assuming the grand total is always sufficient. It is sufficient for a model with only a common mean, but an independence model also has row and column effects. The likelihood then depends on row and column totals, not only their grand total.
  • Calling sufficient margins independent. Margins can share totals or determine one another in part. Sufficiency does not mean statistical independence among the summaries.
  • Confusing sufficiency with fitted-cell equality. The likelihood equations match the model's sufficient margins. They do not generally set every fitted count equal to its observed counterpart.
  • Using score equations without checking existence. The equations above hold at an interior finite maximum. In some data configurations a finite maximum does not exist, so one cannot assume that a finite parameter vector solving the equations is available.

Marginal sufficiency gives a compact description of how a loglinear model uses the observed table. It also explains why margins are central both for understanding parameter estimation and for checking the resulting fit: the model's fitted counts must reproduce the information in the margins associated with its generating class.

Check Your Understanding

Answer each question by identifying the model terms and the corresponding information in the table.

  1. For a two-way independence model, which margins are sufficient, and why is the grand total redundant once all row totals are known?
  2. In a three-way model with generating class \([AB][BC]\), which generator margins provide sufficient statistics?
  3. For independent Poisson counts with \(\log\mu_j=x_j^{\mathsf T}\beta\), write the sufficient statistic identified by likelihood factorization.
  4. What condition on a finite maximum likelihood estimate makes the likelihood score equations equal observed and fitted sufficient statistics?
  5. Explain why margin matching does not imply that every fitted cell count equals its observed count.
Clinical Biostats