Compare › Parametric

Nested t-test (mixed model)

The nested t-test compares two groups when each subject contributes sub-replicates, fitting a random-intercept model with group fixed and subject random.

What is Nested t-test (mixed model)?

Nested data — multiple measurements per subject, multiple cells per dish, multiple students per classroom — violates the independence assumption of ordinary t-tests. Pretending you have nₜₒₜₐₗ independent observations inflates the apparent sample size and gives anti-conservative p-values.

Eisenhauer's rule of thumb: don't average within subject (loses within-subject variance information) and don't ignore the nesting (overstates n). Instead, fit a mixed model that partitions variance into between-subject (σ²_subject) and within-subject (σ²_residual) components. The group effect is tested on the between-subject scale where it logically lives.

ICC = σ²_subject / (σ²_subject + σ²_residual) quantifies how much of the total variance is between subjects. High ICC (> 0.5) ⇒ subject identity matters a lot and the nesting must be respected; low ICC (< 0.05) ⇒ measurements within subject are nearly independent and the inflation from ignoring nesting is small.

When should I use Nested t-test (mixed model)?

  • Two-group comparison with multiple measurements per subject (animal experiments, multi-cell measurements, multi-trial behavioural studies).

What data does it need?

Response + group (2 levels) + subject (random factor).

What does it report?

Omnibus LRT χ² for the group effect + fixed-effect table with Wald z + variance components σ²(subject) + σ²(residual) + ICC.

What does it assume?

  • Random intercepts ~ Normal(0, σ²_subject).
  • Residuals ~ Normal(0, σ²_residual).

How do I interpret the result?

Compare to averaging-then-t-test: nested gives more power when within-subject variance is non-trivial.

Compare to ignore-nesting-t-test: nested has correct type-I rate while the naive test inflates.

See also

References

  • Eisenhauer (2021). Avoiding nested data analysis errors. eLife.