Tutorials › ANOVA › Combining Fixed Treatments With Random Grouping Factors

Fixed and Random Factors · Tutorial 306 of 595

Combining Fixed Treatments With Random Grouping Factors

Represent treatment differences and sampled-group variation in one model, and interpret what the fixed and random terms allow you to say.

Intermediate 10 min read

What You'll Learn

  • Write an additive model with fixed treatment effects and a random grouping effect
  • Distinguish treatment means from deviations associated with sampled groups
  • State the assumptions for the random-intercept model
  • Explain why observations in the same group are dependent
  • Recognize when a random-intercept model does not represent treatment-effect variation across groups

Why Combine Fixed Treatments and Random Groups?

A treatment comparison may be conducted across several groups, such as experimental runs or production batches. The treatment levels may be the specific options of interest, while the observed groups are sampled from a larger population of possible groups. A useful model needs to represent both facts: treatment differences are described directly, and group-to-group variation is represented as variation among sampled levels.

This combination is not a compromise between two labels. It gives each term a distinct role. The fixed treatment terms describe the expected differences among the treatment levels of interest. The random grouping term describes how a sampled group shifts responses relative to the population average. The model below represents a common case in which that shift is the same for every treatment within a group.

Definition: In an additive fixed-treatment, random-group model, treatment is a fixed factor whose levels have specified effects, while the grouping factor is random because its observed levels are treated as a sample from a defined population of possible groups. Each group contributes a random deviation shared by its treatment observations.

The Additive Random-Intercept Model

Suppose each of \(a\) treatment levels is observed once in each of \(b\) sampled groups. Let \(Y_{ij}\) be the response for treatment \(i\) in group \(j\). The additive model is

$$ Y_{ij}=\mu+\tau_i+u_j+\varepsilon_{ij}. $$

Here, \(\mu\) is the overall mean response across the treatment levels, averaging over the population of groups. The fixed effect \(\tau_i\) is the difference associated with treatment \(i\), relative to the overall mean across treatments. For a unique interpretation of \(\mu\) and the treatment effects, use the constraint \(\sum_{i=1}^{a}\tau_i=0\). The term \(u_j\) is the random deviation for sampled group \(j\), and \(\varepsilon_{ij}\) is the remaining observation-level error.

The model’s conditional mean, given the group deviation, is

$$ E(Y_{ij}\mid u_j)=\mu+\tau_i+u_j. $$

Thus, within a particular group, the expected response for treatment \(i\) includes that group’s shift. If the random group deviations have mean zero, the expected response for treatment \(i\), averaged over the population of groups, is \(\mu+\tau_i\). Treatment differences are fixed in this model; the group deviations vary from one sampled group to another.

Model assumptions: The group deviations are independent across groups, with \(E(u_j)=0\) and \(\operatorname{Var}(u_j)=\sigma_g^2\). The errors are independent across observations, with \(E(\varepsilon_{ij})=0\) and \(\operatorname{Var}(\varepsilon_{ij})=\sigma^2\), and are independent of the group deviations. In the Gaussian version of the model, the group deviations and errors are normally distributed. The model also assumes that a group contributes the same additive shift under every treatment; it does not include group-specific treatment effects.

The random grouping factor is not random merely because group labels were assigned by chance. Its status reflects the target of inference: the observed groups are viewed as sampled levels from a population of groups. Likewise, the treatment terms are fixed when the levels are the particular options whose expected responses and differences are of interest. Random assignment of treatments and random sampling of groups are different design ideas.

What the Group Term Does

The shared group deviation accounts for similarity among responses recorded in the same group. For two different treatments \(i\) and \(i'\) observed in the same group \(j\), the model gives

$$ \begin{aligned} \operatorname{Cov}(Y_{ij},Y_{i'j}) &=\operatorname{Cov}(u_j+\varepsilon_{ij},u_j+\varepsilon_{i'j})\\ &=\operatorname{Var}(u_j)\\ &=\sigma_g^2. \end{aligned} $$

The second equality follows because the two observation errors are independent of each other and of \(u_j\). Each response also has marginal variance \(\sigma_g^2+\sigma^2\): it varies both because its group differs from the population average and because of observation-level error. Responses in different groups have covariance zero under the stated independence assumptions. This dependence within groups is part of the model, not an inconvenience to be ignored.

Worked Example: Decomposing Treatment and Group Differences

Suppose a hypothetical experiment compares treatments A and B in three sampled groups. The responses, measured in units of product yield, are:

GroupTreatment ATreatment B
11216
21519
31014

The treatment means are \((12+15+10)/3=12.33\) for A and \((16+19+14)/3=16.33\) for B. The observed mean difference is \(16.33-12.33=4.00\) yield units. The three group means are \(14\), \(17\), and \(12\), so the overall mean of all six responses is \((14+17+12)/3=14.33\).

With the sum-to-zero treatment constraint, the treatment effects corresponding to these means are \(\tau_A=12.33-14.33=-2.00\) and \(\tau_B=16.33-14.33=2.00\). The group mean deviations from the overall mean are \(-0.33\), \(2.67\), and \(-2.33\). For example, the model’s additive decomposition for group 2 and treatment B is \(14.33+2.00+2.67=19.00\), matching the recorded response. In this dataset the same group shift applies to both treatments, and the decomposition has zero residuals.

This arithmetic illustrates the roles of the terms; it is not a method for estimating variance components. The treatment contrast is four yield units in these observations, while the group deviations describe shifts around the overall mean. In a statistical analysis, the groups remain realizations from the target group population, not a set of fixed effects that automatically permits generalizing only to those three groups.

Interpreting the Model Across Groups

The fixed treatment effect describes an expected treatment difference after averaging over the population represented by the random groups. The random deviation describes how a particular sampled group differs from that population average. Consequently, the model can support two distinct statements: a treatment’s average response across the group population is \(\mu+\tau_i\), and its conditional expected response in a particular group is \(\mu+\tau_i+u_j\).

These are model interpretations, not claims that every observed response equals its expected value. A realized observation also includes \(\varepsilon_{ij}\). Nor does the model say that every possible group has exactly the same distribution of responses: the group deviations allow their response levels to vary. The assumed mean-zero group distribution makes the population average the reference point for those deviations.

Worked Example: Three Treatments Across Sampled Groups

A hypothetical process comparison records yield in four sampled production batches, with every batch receiving all three treatments.

BatchTreatment ATreatment BTreatment C
1202427
2232730
3182225
4252932

The treatment means are \(86/4=21.50\) for A, \(102/4=25.50\) for B, and \(114/4=28.50\) for C. In these data, B is four yield units above A on average, and C is seven units above A. Each batch has the same treatment pattern: B is four units above A, and C is seven units above A.

For example, the mean response in batch 1 is \((20+24+27)/3=23.67\). The overall mean across the 12 responses is \((86+102+114)/12=25.17\), so batch 1’s average is \(23.67-25.17=-1.50\) units below the overall mean. The additive model represents that lower batch level with a negative \(u_1\), while its treatment terms represent the differences among A, B, and C. The population-average treatment means are described by \(\mu+\tau_i\); the conditional mean for a treatment in batch 1 includes the additional deviation \(u_1\).

Because the observed treatment pattern is identical across these batches, the data illustrate a shared group shift particularly clearly. The fact that batches 1 through 4 were observed does not, by itself, make batch a fixed factor. Under the stated target, they are sampled batches and the intended interpretation concerns the population of batches from which they represent.

When a Shared Group Shift Is Not Enough

The model assumes that the treatment differences do not systematically vary across groups. That does not require every sample’s treatment differences to be numerically identical: observation errors can make them differ. But if treatment response genuinely varies from group to group, a model with only a random intercept cannot represent that source of variation. It assigns any departure from the common treatment pattern to observation-level error.

Worked Example: Checking the Additive Pattern

Consider hypothetical responses for two treatments in three sampled groups: group 1 has A = 10 and B = 14; group 2 has A = 12 and B = 17; group 3 has A = 8 and B = 14. The within-group treatment differences are \(14-10=4\), \(17-12=5\), and \(14-8=6\) units. The overall treatment means are \(10\) for A and \(15\) for B.

The grand mean is \((10+14+12+17+8+14)/6=12.50\), giving sum-to-zero treatment effects \(\tau_A=-2.50\) and \(\tau_B=2.50\). The group means are \(12\), \(14.50\), and \(11\), with deviations from the grand mean of \(-0.50\), \(2.00\), and \(-1.50\). For group 1, the additive model’s fitted values are \(12.50-2.50-0.50=9.50\) for A and \(12.50+2.50-0.50=14.50\) for B. The observed values are 10 and 14, leaving residuals \(+0.50\) and \(-0.50\).

The within-group differences vary from four to six units. The additive model can accommodate such observed variation through residual error, but it contains no term saying that the treatment effect itself varies across the group population. If that variation is a substantive part of the study’s intended model, the specification needs an additional group-by-treatment term. Choosing and estimating such a term is beyond the random-intercept model developed here.

Common Mistake and Key Takeaway

  • Wrong reasoning: “The treatment and group terms are both effects, so both should be treated in the same way.” Correction: Their roles depend on the inferential target. The named treatment levels have fixed effects; the sampled groups contribute random deviations from a population of groups.
  • Wrong reasoning: “Responses from the same group are independent because they are separate measurements.” Correction: They share \(u_j\), so under this model their covariance is \(\sigma_g^2\).
  • Wrong reasoning: “The random group term allows treatment differences to change across groups.” Correction: A random intercept shifts all treatment responses in a group by the same amount. Treatment-specific group variation requires a different model term.
Key takeaway: In the additive model \(Y_{ij}=\mu+\tau_i+u_j+\varepsilon_{ij}\), fixed treatment effects describe the specified treatment levels, while the random group effect describes a shared deviation for each sampled group. The model generalizes across groups only under its stated sampling target and assumptions.

Check Your Understanding

Use the model and its assumptions to answer these questions.

  1. In \(Y_{ij}=\mu+\tau_i+u_j+\varepsilon_{ij}\), which term represents the average treatment difference, and which represents a particular sampled group’s shift?
  2. Why can two treatment observations in the same group be dependent under the model even when their errors are independent?
  3. If the population mean of the group deviations is zero, what is the expected response for treatment \(i\) averaged across the group population?
  4. A study observes six groups. Does the number six alone determine whether group is fixed or random? Explain in terms of the target of inference.
  5. What feature of the data or scientific model would call for more than a shared random group shift?
Clinical Biostats