Regression models

Linear mixed models. One average line, and a line for every patient.

Ten patients start blood-pressure treatment and return at irregular times. Fit the model and watch each patient's line separate from the mean.

Hover a line, a dot or a patient chip to inspect one patient. Click to pin.
1ObservationsEach dot is one clinic visit, coloured by patient.
2Fixed effectsThe average trajectory shared by all patients.
3Random effectsEach patient's own line, pulled toward the average.

Model

Show

Estimates

InterceptIntercept + slope

Fitted by maximum likelihood (EM algorithm) in your browser. Lower AIC is better.

Patient random effects

Random intercept

Every patient gets their own starting level u₀ᵢ, but all share the same slope. The fitted lines are parallel: patients differ in how high their blood pressure is, not in how fast it falls.

Adding a random slope

Each patient also gets a slope deviation u₁ᵢ, so lines can fan out or cross. The model estimates the spread of slopes (τ₁) and whether high starters tend to drop faster (the correlation).

Shrinkage

Turn on Separate per-patient fits. Those dashed lines use only one patient's visits. The mixed-model lines sit closer to the mean, most of all for patients with few or noisy visits, because they borrow strength from the whole group.