# Repeated measurements and crossover: recap

**Calf study:** 32 calves whose diets researchers chose one calf at a time, 16 per diet, four rooms and five weights per calf. The 160 weights describe repeated change; they are not 160 separate diet allocations. Baseline precedes feeding.

`lmer()` fits a model that allows room differences, a different diet gap at each visit, and calves' tendencies to stay heavier or lighter across visits. `performance::check_convergence()` checks the fitting calculation; `check_singularity()` checks whether the estimated differences among calves or cows shrink to zero; `check_model()` displays unexplained differences. These checks do not prove that nearby observations have no additional shared influence.

`marginaleffects::avg_predictions()` estimates mean outcomes; `avg_comparisons()` estimates differences between treatments. `re.form = NA` leaves out each animal's fitted difference from the usual outcome. `hypotheses()` combines the printed visit gaps to estimate the change from baseline to week 8, carrying their shared uncertainty with it.

**Crossover:** 24 cows randomly assigned to AB or BA, 12 per order; 48 paired cow-period rows. Each cow receives both treatments. Period allows a common change between treatment phases; sequence is the assigned order; a cow term allows cows' usual differences in appetite.

Washout means allowing earlier treatment effects to wear off. Carryover means they remain. This two-period analysis assumes no important carryover, supported by scientific knowledge and scheduling. An order term and reassuring checks do not remove lingering biology or establish its absence. Lasting treatments may need a design assigning separate animals to treatments.

All data are synthetic. Approximate 95% intervals concern means or mean comparisons under the specified model, not individual outcome ranges. The unchanged calf CSV continues in Class 11.
