---
title: "Modeling variation in Likert-scale data"
date: "2026-07-16"
---
```{r}
#| label: setup
#| include: false
library(ggplot2)
library(dplyr)
library(brms)
```
## Why the mean constrains the variance
Suppose we have a 1–7 satisfaction or agreement scale and want to know whether one group shows more disagreement than another. A natural approach is to calculate a standard deviation for each unit and regress it on group indicators or other covariates.
The problem is that the variance of a bounded outcome depends mechanically on its mean. The @bhatia-davis-2000 inequality is the population version of that statement: for a *distribution* on $[a,b]$ with mean $\mu$,
$$\text{Var}(X) \leq (\mu - a)(b - \mu)$$ {#eq-bhatia-davis}
The bound is sharp over distributions, attained by the two-point distribution putting mass $(\mu-a)/(b-a)$ at $b$ and the rest at $a$. Whether a given *sample* can reach it is a different question, and with few raters it usually cannot, because the counts at each endpoint have to be whole numbers. That matters below.
For a 1–7 item, the maximum possible standard deviation over distributions is therefore
$$\text{SD}_{\max}(\mu) = \sqrt{(\mu - 1)(7 - \mu)}$$
```{r}
#| label: bound-curve
#| echo: true
#| fig-cap: "The mechanical ceiling on SD as a function of the mean on a 1–7 scale."
mu_grid <- seq(1, 7, length.out = 200)
sd_max <- sqrt(pmax((mu_grid - 1) * (7 - mu_grid), 0))
ggplot(data.frame(mu = mu_grid, sd_max = sd_max), aes(mu, sd_max)) +
geom_line(linewidth = 1, color = "#2d5fa3") +
labs(x = expression("Mean Rating (" * mu * ")"), y = expression(SD[max](mu)),
title = "Maximum Possible SD as a Function of the Mean") +
theme_minimal(base_size = 12)
```
The maximum is 3 at the middle of the scale, where $\mu=4$, and falls to zero at either endpoint. Satisfaction and performance ratings are often close to the upper endpoint. A group with a higher mean can then have a smaller observed standard deviation even when its underlying dispersion is the same.
### Why simple adjustments do not solve it
Dividing the standard deviation by the mean does not remove the dependence. That adjustment assumes that variance grows proportionally with the mean, while variance on a bounded scale is compressed at both endpoints. In this example, dividing by $\mu$ only moves the peak from $\mu=4$ to $\mu=1.75$.
A Gaussian location-scale model has a related problem. A model such as `sigma ~ group` treats the response as unbounded, so it can interpret compression near an endpoint as a real difference in residual variation.
## An ordinal location-scale model
One way to handle the bounds is to treat the Likert response as a discretized latent variable $Y^*$:
$$Y_i^* = \eta_i + \sigma_i \epsilon_i, \qquad \epsilon_i \sim N(0, 1)$$
where $\eta_i$ is the location predictor and $\sigma_i$ is the latent residual standard deviation. The observed rating $Y_i \in \{1, \dots, K\}$ is determined by ordered cutpoints $\theta_1 < \dots < \theta_{K-1}$:
$$Y_i = k \iff \theta_{k-1} < Y_i^* \leq \theta_k$$
Under a probit link, the cumulative probability is:
$$P(Y_i \leq k) = \Phi\left(\frac{\theta_k - \eta_i}{\sigma_i}\right) = \Phi\bigl(\text{disc}_i (\theta_k - \eta_i)\bigr)$$
where discrimination is defined as the inverse of latent dispersion: $\text{disc}_i \equiv 1/\sigma_i$.
In `brms`, we model $\log(\text{disc}_i)$ directly. Higher discrimination means smaller latent dispersion, or more agreement. Lower discrimination means greater spread. The cutpoints are estimated on an unbounded latent scale, so an observed response near 7 does not by itself imply smaller latent dispersion. This interpretation assumes that the groups use the response categories in the same way.
## A simulation
Let's simulate 100 subjects in each group, with six ratings for each subject. Both groups have latent standard deviation $\sigma=1$. Group A has a latent mean near the ceiling ($\mu_A=2.4$), while Group B is closer to the middle ($\mu_B=0.6$).
```{r}
#| label: simulate
#| echo: true
#| cache: true
set.seed(42)
n_per_group <- 100
n_raters <- 6
sigma_true <- 1.0 # Identical latent dispersion across groups
mu_A <- 2.4 # Group A: high mean (near ceiling)
mu_B <- 0.6 # Group B: mid-scale mean
subjects <- data.frame(
subject = 1:(2 * n_per_group),
group = rep(c("A", "B"), each = n_per_group),
mu = rep(c(mu_A, mu_B), each = n_per_group)
)
df <- subjects[rep(seq_len(nrow(subjects)), each = n_raters), ]
df$latent <- rnorm(nrow(df), mean = df$mu, sd = sigma_true)
# Discretize using 6 fixed cutpoints into categories 1 through 7
cuts <- c(-2, -1.2, -0.5, 0.2, 1.0, 1.8)
df$rating <- as.integer(cut(df$latent, breaks = c(-Inf, cuts, Inf), labels = 1:7))
df$rating_ord <- factor(df$rating, ordered = TRUE, levels = 1:7)
```
### The observed ratings
```{r}
#| label: raw-summary
#| echo: true
subj_summary <- df |>
group_by(subject, group) |>
summarise(mean_rating = mean(rating), sd_rating = sd(rating), .groups = "drop")
subj_summary |>
group_by(group) |>
summarise(mean_rating = round(mean(mean_rating), 2),
mean_sd = round(mean(sd_rating), 2)) |>
knitr::kable(caption = "Observed summary statistics by group.")
```
```{r}
#| label: scatter
#| echo: true
#| fig-cap: "Subject-level mean vs. SD against the Bhatia-Davis bound, rescaled by $\\sqrt{6/5}$ because `sd()` divides by $n-1 = 5$."
# sd() uses the n - 1 denominator; the Bhatia-Davis bound is for the population
# (divide-by-n) variance. With six ratings the sample-SD ceiling is sqrt(6/5) times it.
sd_max_sample <- sqrt(6 / 5) * sd_max
ggplot(subj_summary, aes(mean_rating, sd_rating, color = group)) +
geom_jitter(width = 0.05, height = 0, alpha = 0.5) +
geom_line(data = data.frame(mean_rating = mu_grid, sd_rating = sd_max_sample),
aes(mean_rating, sd_rating), color = "grey40", inherit.aes = FALSE) +
labs(x = "Subject Mean Rating", y = "Subject SD",
title = "Group A's SD is compressed by the boundary") +
theme_minimal(base_size = 12)
```
Each subject's SD uses the $n-1$ denominator, so its ceiling is $\sqrt{6/5}$ times the population bound: six ratings split between 1 and 7 give a sample SD of 3.29, not 3. The observed standard deviation averages 0.58 in Group A and 1.22 in Group B. If we looked only at these numbers, we would conclude that raters agree much more about Group A, even though the two latent standard deviations are identical by construction.
## Comparing Gaussian and ordinal models
I fit two models in `brms`. The Gaussian model makes $\log(\sigma)$ a function of group. The ordinal cumulative-probit model instead makes $\log(\text{disc})$ a function of group, with Group A used as the reference ($\text{disc}_A=1$).
```{r}
#| label: fit-models
#| echo: true
#| cache: true
#| message: false
#| warning: false
# 1. Gaussian location-scale model
fit_gaussian <- brm(
bf(rating ~ group + (1 | subject), sigma ~ group),
data = df, family = gaussian(),
chains = 2, iter = 2000, warmup = 1000, cores = 2, seed = 1,
refresh = 0, silent = 2
)
# 2. Ordinal cumulative-probit location-scale model
fit_ordinal <- brm(
bf(rating_ord ~ group + (1 | subject), disc ~ 0 + group),
data = df, family = cumulative("probit"), init = 0,
prior = c(
prior(constant(0), class = "b", coef = "groupA", dpar = "disc"),
prior(normal(0, 1), class = "b", coef = "groupB", dpar = "disc")
),
chains = 2, iter = 2000, warmup = 1000, cores = 2, seed = 1,
refresh = 0, silent = 2
)
```
```{r}
#| label: compare-results
#| echo: true
knitr::kable(round(fixef(fit_gaussian), 2), caption = "Gaussian MELSM: Incorrectly finds group differences in residual SD.")
knitr::kable(round(fixef(fit_ordinal), 2), caption = "Ordinal MELSM: Correctly recovers equal latent dispersion.")
```
### Results
The Gaussian coefficient on `sigma_groupB` is $0.68$. It estimates that Group B's residual standard deviation is $\exp(0.68)\approx1.97$ times Group A's ($95\%\text{ CI}: [1.82,2.14]$). This apparent difference comes from the scale ceiling.
The ordinal coefficient on `disc_groupB` is $-0.01$ ($95\%\text{ CI}: [-0.17,0.15]$), which implies a latent standard-deviation ratio of $\exp(0.01)\approx1.01$. The ordinal model recovers the equal dispersion used to generate the data.
### An important assumption
The data were generated from the ordinal model's own functional form: a latent normal variable, a constant $\sigma$, and one `cuts` vector shared by both groups. It is therefore not surprising that the ordinal model fits well. What the example shows is narrower: boundary compression by itself does not create a difference in the latent dispersion parameter, while it does create one in the Gaussian model.
The example does not show that the model can distinguish dispersion from threshold differences, because I did not simulate any threshold difference. Common thresholds across groups, or a model that allows them to vary, are needed for identification. If groups use the categories differently, threshold shifts and `disc` can trade off: the cutpoints can absorb a real dispersion difference, or a threshold difference can appear as a change in `disc`. On real data, we need information outside the basic model, such as anchoring vignettes or a partial-invariance specification, to check this assumption.
## A descriptive alternative
A simpler descriptive measure is the ratio of the observed variance to the maximum possible variance at the same mean:
$$R = \frac{\text{Var}(Y)}{\text{Var}_{\max}(\mu)} \in [0, 1]$$
where $R = 0$ indicates perfect agreement and $R = 1$ indicates maximum polarization.
The top of that range is not generally reachable at the subject level. Enumerate every set of six ratings on a 1–7 item and only 7 of the 37 achievable means admit a configuration that attains the Bhatia–Davis bound, namely the integer means where an all-endpoint split is possible. Elsewhere the ceiling is lower: the largest attainable $R$ is $0.83$ at a mean of $3.5$, $0.45$ at $1.5$, and $0.14$ at $7/6$. A subject-level $R$ is therefore measured against a denominator the ratings could not have produced, and the shortfall itself varies with the mean, which is the dependence $R$ was meant to remove.
Either divide by the sharp finite-sample maximum at the observed mean and rater count, obtained by the enumeration just described, or keep the Bhatia–Davis denominator and say plainly that $R \le 1$ is measured against a possibly unattainable ceiling. The pooled calculation below is the mild case: with a whole group's ratings the achievable means are dense enough that the distributional bound is close to sharp.
With only six ratings per subject, $R$ is noisy and can be undefined when every rater chooses 7, giving $0/0$. We can instead calculate it after pooling the ratings within each group:
```{r}
#| label: r-pooled
#| echo: true
df |>
group_by(group) |>
summarise(
mean_rating = mean(rating),
var_obs = mean((rating - mean(rating))^2),
var_max = (mean(rating) - 1) * (7 - mean(rating)),
R_pooled = round(var_obs / var_max, 3)
) |>
knitr::kable(caption = "Group-level pooled R metric.")
```
Both groups give $R\approx0.21$--$0.22$. Dividing by the maximum attainable variance makes the descriptive measure more comparable across groups with different means. It is still only a normalization, not a model-based correction, and it has no latent dispersion parameter to interpret.
## Which approach to use
Raw standard deviations are hard to compare when group means differ on a bounded scale. If the goal is a model of underlying response dispersion, I would use the ordinal location-scale model and examine whether common thresholds are plausible. If the goal is only a descriptive comparison, pooled $R=\text{Var}/\text{Var}_{\max}$ is easier to explain, as long as it is not interpreted as a latent parameter.