Skip to main content

Beta Regression: How Closely Did the Brexit Vote Follow Education?

Beta regression in R, by hand and with betareg, on the share of the Leave vote in the 348 districts of England and Wales (2016) and the census: outcomes between 0 and 1, the mean and precision of the beta distribution, odds ratios and marginal effects, a precision that varies, comparison with least squares, logit-transformed shares and quasi-binomial models, residuals, prediction intervals, the ecological fallacy, neighboring districts and APA reporting.

The question: a share as the outcome

In June 2016 the United Kingdom voted to leave the European Union, with 52% for Leave. But the country was divided. In some districts three quarters voted Leave, in others one fifth. What kind of districts were they? Education is the best-known answer: the more people with a degree, the fewer votes for Leave. How close is the relation, and what is left for age and for the share of people born abroad?

The outcome is a share, a number between 0 and 1. Ordinary regression has three problems with it. Its straight line leaves the range from 0 to 1 sooner or later. Its errors are supposed to have the same spread everywhere, but shares near 0 or 1 have no room to vary. And near the limits the distribution is skewed.

Beta regression (Ferrari & Cribari-Neto, 2004) is the regression for shares, rates and proportions that are not counts of yes and no: the share of income spent on food, the share of a leaf that is ill, a test score as a fraction of the maximum, an election result.

Code
library(betareg)    # betareg()
library(ggplot2)
library(sandwich)   # vcovCL(): standard errors for districts of the same region

# number formats for the text
f1   <- function(x) formatC(x, format = "f", digits = 1, big.mark = ",")
f2   <- function(x) formatC(x, format = "f", digits = 2, big.mark = ",")
f3   <- function(x) formatC(x, format = "f", digits = 3, big.mark = ",")
# no leading zero
nz <- function(x, d = 2) sub("^(-?)0", "\\1", formatC(x, format = "f", digits = d))
pval <- function(p) if (p < .001) "< .001" else paste("=", nz(p, 3))
num  <- function(x) trimws(format(x, big.mark = ","))
pct  <- function(x, d = 1) paste0(formatC(100 * x, format = "f", digits = d), "%")

1. The data

The Electoral Commission publishes the result of every district. The 2011 census, through the service Nomis of the Office for National Statistics, has their people. Both are free and need no login:

Code
votes <- read.csv(
  "https://www.electoralcommission.org.uk/sites/default/files/2019-07/EU-referendum-result-data.csv"
)
census <- function(table, cells) {
  # percentage of the residents, by district
  d <- read.csv(paste0(
    "https://www.nomisweb.co.uk/api/v01/dataset/",
    table,
    ".data.csv?date=latest&geography=TYPE464",
    "&rural_urban=0&cell=",
    cells,
    "&measures=20301&select=geography_code,cell,obs_value"
  ))
  aggregate(OBS_VALUE ~ GEOGRAPHY_CODE, data = d, FUN = sum)
}
degree <- census("NM_623_1", "6") # highest qualification: level 4 or more (degree), % of 16+
old    <- census("NM_145_1", "13,14,15,16")                         # aged 65 and over
uk     <- census("NM_611_1", "100")                                 # born in the United Kingdom

brexit <- merge(
  votes[, c("Area_Code", "Area", "Region", "Leave", "Valid_Votes")],
  degree,
  by.x = "Area_Code",
  by.y = "GEOGRAPHY_CODE"
)
names(brexit)[6] <- "degree"
brexit$age65  <- old$OBS_VALUE[match(brexit$Area_Code, old$GEOGRAPHY_CODE)]
brexit$abroad <- 100 - uk$OBS_VALUE[match(brexit$Area_Code, uk$GEOGRAPHY_CODE)]
brexit$leave  <- brexit$Leave / brexit$Valid_Votes
nrow(brexit)
[1] 348
Code
round(
  sapply(brexit[, c("leave", "degree", "age65", "abroad")], function(v) {
    c(min = min(v), mean = mean(v), max = max(v))
  }),
  2
)
     leave degree age65 abroad
min   0.21  14.20  6.10   2.20
mean  0.54  27.07 17.53  11.12
max   0.76  68.40 29.70  55.10

There are 348 districts of England and Wales (Scotland and Northern Ireland have other censuses). leave is the share of the valid votes for Leave. degree, age65 and abroad are percentages: people with a degree or similar, people of 65 and over, and people born outside the United Kingdom.


2. Look at the data

Code
ggplot(brexit, aes(degree, leave)) +
  geom_point(aes(colour = Region == "London"), alpha = 0.7, size = 2) +
  geom_smooth(method = "loess", formula = y ~ x, se = FALSE, colour = "grey30", linewidth = 0.8) +
  scale_colour_manual(
    values = c(`TRUE` = "#eb6834", `FALSE` = "#2a78d6"),
    labels = c("other districts", "London"),
    name = NULL
  ) +
  scale_y_continuous(labels = function(v) paste0(100 * v, "%")) +
  labs(
    title = "Leave vote and education in 348 districts",
    x = "adults with a degree (%)",
    y = "vote for Leave"
  ) +
  theme_bw() +
  theme(legend.position = "bottom")

Plot: 2. Look at the data

Code
cor(brexit$leave, brexit$degree)
[1] -0.8869716
Code
brexit[order(brexit$leave)[c(1:3, 346:348)], c("Area", "leave", "degree", "age65", "abroad")]
             Area     leave degree age65 abroad
315       Lambeth 0.2137764   46.6   7.6   38.9
305       Hackney 0.2151958   41.8   7.0   39.1
307      Haringey 0.2442700   40.8   8.7   44.6
102  Castle Point 0.7269939   14.6  21.5    3.6
169 South Holland 0.7358628   15.8  22.3    9.6
165        Boston 0.7556243   15.1  19.7   15.1

The relation is one of the strongest in social statistics, r = -.89. It is nearly straight. The shares are mostly between 30% and 70%, so the limits 0 and 1 are far away, and we expect a straight line to do well, too. We shall see how much the beta regression adds.


3. The model step by step, with formulas

Step 1: the beta distribution

A beta variable lies between 0 and 1. Written with its mean \(\mu\) and a precision \(\phi\):

\[E(y) = \mu, \qquad \text{Var}(y) = \frac{\mu(1 - \mu)}{1 + \phi}\]

The variance is largest in the middle, and goes to zero at 0 and 1. The larger \(\phi\), the less the values scatter around the mean.

Code
grid <- seq(0.002, 0.998, by = 0.002)
shapes <- do.call(
  rbind,
  lapply(c(0.1, 0.5, 0.85), function(mu) {
    do.call(
      rbind,
      lapply(c(5, 20, 80), function(phi) {
        data.frame(
          y = grid,
          d = dbeta(grid, mu * phi, (1 - mu) * phi),
          mean = paste("mean", mu),
          precision = paste0("φ = ", phi)
        )
      })
    )
  })
)
shapes$precision <- factor(shapes$precision, levels = paste0("φ = ", c(5, 20, 80)))
ggplot(shapes, aes(y, d, colour = precision)) +
  geom_line(linewidth = 0.9) +
  facet_wrap(~mean) +
  coord_cartesian(ylim = c(0, 12)) +
  scale_colour_manual(values = c("#eda100", "#2a78d6", "#1baf7a"), name = NULL) +
  labs(title = "Beta distributions", x = "y", y = "density") +
  theme_bw() +
  theme(legend.position = "bottom")

Shapes – Step 1: the beta distribution

Step 3: the precision may depend on predictors, too

\[\log \phi_i = z_i^\top\gamma\]

The simplest model has one \(\phi\) for all. Modeling it lets some districts scatter more than others.

Step 4: maximum likelihood, by hand

The density is \(\frac{\Gamma(\phi)}{\Gamma(\mu\phi)\,\Gamma((1-\mu)\phi)}\, y^{\mu\phi - 1}(1 - y)^{(1-\mu)\phi - 1}\), which R knows as dbeta(y, mu * phi, (1 - mu) * phi):

Code
brexit$deg10 <- (brexit$degree - 27) / 10
brexit$old10 <- (brexit$age65 - 17) / 10
brexit$abr10 <- (brexit$abroad - 10) / 10 # per 10 points
X <- model.matrix(~ deg10 + old10 + abr10, data = brexit); y <- brexit$leave
minus_loglik <- function(par) {
  mu <- plogis(drop(X %*% par[1:4])); phi <- exp(par[5])
  -sum(dbeta(y, mu * phi, (1 - mu) * phi, log = TRUE))
}
hand <- optim(
  c(0, 0, 0, 0, 4),
  minus_loglik,
  method = "BFGS",
  control = list(reltol = 1e-14, maxit = 1000)
)
fit  <- betareg(leave ~ deg10 + old10 + abr10, data = brexit)
rbind(by_hand = c(hand$par[1:4], exp(hand$par[5])), betareg = coef(fit))
        (Intercept)      deg10     old10       abr10    (phi)
by_hand   0.1741468 -0.4312751 0.1598987 -0.02177382 141.1857
betareg   0.1741467 -0.4312751 0.1598994 -0.02177339 141.1857

4. Fitting the model and reading the output

Code
summary(fit)

Call:
betareg(formula = leave ~ deg10 + old10 + abr10, data = brexit)

Quantile residuals:
    Min      1Q  Median      3Q     Max 
-3.8794 -0.5321  0.1068  0.7398  2.7964 

Coefficients (mean model with logit link):
             Estimate Std. Error z value Pr(>|z|)    
(Intercept)  0.174147   0.009672  18.005  < 2e-16 ***
deg10       -0.431275   0.014690 -29.358  < 2e-16 ***
old10        0.159899   0.033234   4.811  1.5e-06 ***
abr10       -0.021773   0.014904  -1.461    0.144    

Phi coefficients (precision model with identity link):
      Estimate Std. Error z value Pr(>|z|)    
(phi)   141.19      10.67   13.24   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 

Type of estimator: ML (maximum likelihood)
Log-likelihood: 617.3 on 5 Df
Pseudo R-squared: 0.8203
Number of iterations: 34 (BFGS) + 2 (Fisher scoring) 
Code
b <- coef(fit)[1:4]; se <- sqrt(diag(vcov(fit)))[1:4]; or <- exp(b); ci <- exp(confint(fit)[1:4, ])
phi <- coef(fit)[["(phi)"]]

We centered the predictors near their means and counted them in steps of 10 percentage points.

  • (Intercept): the district with average predictors has a logit of 0.17, a Leave share of 54.3%.
  • deg10: 10 points more people with a degree multiply the odds of Leave by 0.65, 95% CI [0.63, 0.67].
  • old10: 10 points more people of 65 and over, by 1.17, [1.10, 1.25].
  • abr10: 10 points more people born abroad, by 0.98, [0.95, 1.01].
  • (phi) = 141.2: the precision. At a mean of 50% the SD of a district around its mean is \(\sqrt{0.25/(1 + 141.2)}\) = 4.2%.
  • Pseudo R-squared is the squared correlation of the linear predictor and the logit of the outcome, .82.

In percentage points

Odds of a share are hard to picture. The average marginal effect is the mean change of the share itself, \(\beta\,\mu(1 - \mu)\) averaged over the districts:

Code
mu  <- fitted(fit)
ame <- b[-1] * mean(mu * (1 - mu))
set.seed(91)
draws <- MASS::mvrnorm(2000, coef(fit)[1:4], vcov(fit)[1:4, 1:4]) # uncertainty by simulation
sim   <- apply(draws, 1, function(bb) { m <- plogis(drop(X %*% bb)); bb[-1] * mean(m * (1 - m)) })
ame_ci <- apply(sim, 1, quantile, c(0.025, 0.975))
round(100 * rbind(ame, ame_ci), 1)
      deg10 old10 abr10
ame   -10.4   3.8  -0.5
2.5%  -11.0   2.2  -1.2
97.5%  -9.7   5.3   0.1

Ten points more graduates go with a Leave share that is 10.4 points lower, 95% CI [9.7, 11.0], in districts with the same age structure and the same share of people born abroad.


5. Does the scatter change? A model for the precision

Code
# after the bar: the precision
fit_phi <- betareg(leave ~ deg10 + old10 + abr10 | deg10 + abr10, data = brexit)
round(summary(fit_phi)$coefficients$precision, 3)
            Estimate Std. Error z value Pr(>|z|)
(Intercept)    5.008      0.076  65.757    0.000
deg10          0.118      0.115   1.024    0.306
abr10         -0.272      0.087  -3.118    0.002
Code
lr <- 2 * (as.numeric(logLik(fit_phi)) - as.numeric(logLik(fit)))
c(
  LR = lr,
  df = 2,
  p = pchisq(lr, 2, lower.tail = FALSE),
  AIC_constant = AIC(fit),
  AIC_varying = AIC(fit_phi)
)
           LR            df             p  AIC_constant   AIC_varying 
 9.982388e+00  2.000000e+00  6.797543e-03 -1.224607e+03 -1.230589e+03 
Code
g <- coef(fit_phi, model = "precision")
sd_at <- function(abr) sqrt(0.25 / (1 + exp(g[[1]] + g[[3]] * (abr - 10) / 10)))
c(SD_at_5pct_abroad = sd_at(5), SD_at_40pct_abroad = sd_at(40))
 SD_at_5pct_abroad SD_at_40pct_abroad 
        0.03808393         0.06104642 

The districts do not all scatter equally: the likelihood-ratio test of a varying precision gives \(\chi^2\)(2) = 10.0, p = .007. Around the same mean of 50%, districts with 5% born abroad have an SD of 3.8%, those with 40%, 6.1%. Diverse districts are less predictable. The coefficients of the mean and their standard errors change little:

Code
round(
  cbind(
    constant = coef(fit)[1:4],
    SE = se,
    varying = coef(fit_phi, model = "mean"),
    SE_varying = sqrt(diag(vcov(fit_phi)))[1:4]
  ),
  3
)
            constant    SE varying SE_varying
(Intercept)    0.174 0.010   0.177      0.009
deg10         -0.431 0.015  -0.424      0.015
old10          0.160 0.033   0.133      0.032
abr10         -0.022 0.015  -0.028      0.017

6. Against the alternatives

Code
ols   <- lm(leave ~ deg10 + old10 + abr10, data = brexit)
logit <- lm(qlogis(leave) ~ deg10 + old10 + abr10, data = brexit)
binom <- glm(
  cbind(Leave, Valid_Votes - Leave) ~ deg10 + old10 + abr10,
  family = binomial,
  data = brexit
)
quasi <- glm(
  cbind(Leave, Valid_Votes - Leave) ~ deg10 + old10 + abr10,
  family = quasibinomial,
  data = brexit
)
effects <- rbind(`beta regression`       = c(coef(fit)["deg10"], sqrt(vcov(fit)["deg10", "deg10"])),
                 `OLS on the logit`      = coef(summary(logit))["deg10", 1:2],
                 `binomial (wrong)`      = coef(summary(binom))["deg10", 1:2],
                 `quasi-binomial`        = coef(summary(quasi))["deg10", 1:2])
colnames(effects) <- c("b (logit scale)", "SE")
round(effects, 4)
                 b (logit scale)     SE
beta regression          -0.4313 0.0147
OLS on the logit         -0.4301 0.0147
binomial (wrong)         -0.4395 0.0006
quasi-binomial           -0.4395 0.0155
Code
c(OLS_effect_in_points = 100 * coef(ols)[["deg10"]], beta_effect_in_points = 100 * ame[["deg10"]])
 OLS_effect_in_points beta_effect_in_points 
            -10.22701             -10.35527 
Code
dispersion <- summary(quasi)$dispersion
dispersion
[1] 641.9004
  • OLS on the share gives -10.2 points for 10 points of degrees, and the beta regression -10.4 on average. Between 30% and 70% a logit is almost straight, so the two agree. With shares near 0 or 1 they would not.
  • OLS on the logit of the share agrees with the beta regression here. It describes the mean of the logit, not the logit of the mean, and to come back to shares it needs a correction, like the smearing of gamma regression.
  • Binomial regression treats every voter as an independent observation. With millions of votes its standard error is 24.0 times smaller than that of the beta regression, and it is nonsense: the dispersion is 642 instead of 1. Voters of one district share their district.
  • Quasi-binomial corrects the standard errors by this factor, and gives the larger districts more weight. It is a good alternative when the numerator and the denominator are known. Its variance, \(\mu(1-\mu)\phi/n\), shrinks with the number of voters, while the beta regression gives every district the same precision.

Which is right? The chance variation of 86,386 votes is tiny. What makes districts differ is everything that the model does not contain. That does not shrink with the size, which speaks for the beta regression.


7. Checking the model

Code
res <- data.frame(
  fitted = fitted(fit_phi),
  r = residuals(fit_phi, type = "quantile"),
  Region = brexit$Region,
  Area = brexit$Area
)
res$q <- qqnorm(res$r, plot.it = FALSE)$x
pa <- ggplot(res, aes(fitted, r)) +
  geom_hline(yintercept = 0, colour = "grey60") +
  geom_point(alpha = 0.5, colour = "grey30") +
  geom_smooth(method = "loess", formula = y ~ x, se = FALSE, colour = "#eb6834") +
  labs(title = "Quantile residuals against the fitted share", x = "fitted share", y = "residual") +
  theme_bw()
pb <- ggplot(res, aes(reorder(Region, r, median), r)) +
  geom_hline(yintercept = 0, colour = "grey60") +
  geom_boxplot(fill = "grey90") +
  coord_flip() +
  labs(title = "The same, by region", x = NULL, y = "residual") +
  theme_bw()
patchwork::wrap_plots(pa, pb, ncol = 1)

Residuals – 7. Checking the model

Code
shapiro.test(res$r)$p.value
[1] 2.838039e-07
Code
res[order(-abs(res$r))[1:5], c("Area", "Region", "fitted", "r")]
                 Area     Region    fitted         r
269         Liverpool North West 0.5823702 -3.936380
328           Gwynedd      Wales 0.5660203 -3.846333
268          Knowsley North West 0.6618682 -3.765242
271            Sefton North West 0.5906171 -2.854774
43  Brighton and Hove South East 0.4228913 -2.735438

Quantile residuals are standard normal if the model is right. They are not quite (the Shapiro–Wilk test rejects it): a few districts voted far less for Leave than their people suggest. Three of the five largest residuals are Liverpool and two of its neighbors. And the residuals are grouped by region: the districts of some regions lie above the model together, those of others below. The districts are not independent. Neighbors resemble each other for reasons that are not in the model.

Code
fit_reg <- betareg(leave ~ deg10 + old10 + abr10 + Region, data = brexit)
lr_reg  <- 2 * (as.numeric(logLik(fit_reg)) - as.numeric(logLik(fit)))
df_reg  <- length(unique(brexit$Region)) - 1
V_cl    <- vcovCL(fit, cluster = brexit$Region)
rbind(without_regions = coef(fit)[2:4], with_regions = coef(fit_reg)[2:4])
                     deg10     old10       abr10
without_regions -0.4312751 0.1598994 -0.02177339
with_regions    -0.4357753 0.1636677 -0.06086966
Code
rbind(SE_usual = se[2:4], SE_clustered_by_region = sqrt(diag(V_cl))[2:4])
                            deg10      old10      abr10
SE_usual               0.01469024 0.03323422 0.01490384
SE_clustered_by_region 0.01717955 0.05324097 0.01691139
Code
c(
  LR_regions = lr_reg,
  df = df_reg,
  p = pchisq(lr_reg, df_reg, lower.tail = FALSE),
  R2_without = fit$pseudo.r.squared,
  R2_with = fit_reg$pseudo.r.squared
)
  LR_regions           df            p   R2_without      R2_with 
9.519055e+01 9.000000e+00 1.471940e-16 8.203163e-01 8.621616e-01 

Adding the regions improves the fit a lot, \(\chi^2\)(9) = 95.2, and changes the coefficients: that of the share born abroad goes from -0.02 to -0.06, because most districts with many people born abroad are in London. The standard errors that allow for correlation within regions are 1.2 times as large for education. (With only 10 regions they are rough themselves. A spatial model is the proper tool.)


8. Predictions

Code
grid <- data.frame(deg10 = (seq(14, 68, by = 1) - 27) / 10, old10 = 0, abr10 = 0)
grid$degree <- grid$deg10 * 10 + 27
grid$mean <- predict(fit_phi, grid, type = "response")
grid$low  <- predict(fit_phi, grid, type = "quantile", at = 0.05)
grid$high <- predict(fit_phi, grid, type = "quantile", at = 0.95)
ggplot(grid, aes(degree, mean)) +
  geom_ribbon(aes(ymin = low, ymax = high), fill = "#2a78d6", alpha = 0.2) +
  geom_line(colour = "#2a78d6", linewidth = 1) +
  geom_point(data = brexit, aes(degree, leave), alpha = 0.3, size = 1.3) +
  scale_y_continuous(labels = function(v) paste0(100 * v, "%"), limits = c(0, 1)) +
  labs(
    title = "Fitted mean and 90% range for a district with average age and few people born abroad",
    x = "adults with a degree (%)",
    y = "vote for Leave"
  ) +
  theme_bw() +
  theme(plot.title = element_text(size = 11))

8. Predictions

Code
at <- function(d) {
  v <- round(
    100 *
      c(
        predict(fit_phi, data.frame(deg10 = (d - 27) / 10, old10 = 0, abr10 = 0)),
        sapply(c(0.05, 0.95), function(q) {
          predict(
            fit_phi,
            data.frame(deg10 = (d - 27) / 10, old10 = 0, abr10 = 0),
            type = "quantile",
            at = q
          )
        })
      ),
    1
  )
  setNames(v, c("mean", "5%", "95%"))
}
rbind(`20% with a degree` = at(20), `40% with a degree` = at(40))
                  mean   5%  95%
20% with a degree 61.6 54.7 68.3
40% with a degree 40.7 34.7 46.9

The fitted distribution gives ranges directly, and they never leave the interval from 0 to 1. With 20% graduates, nine in ten such districts are expected between 54.7% and 68.3% for Leave; with 40%, between 34.7% and 46.9%.


9. Things to keep in mind

  • The ecological fallacy. The rows are districts, not people. That districts with more graduates voted less for Leave does not prove that graduates did. (Surveys of voters show that they did, but this page cannot.) Robinson (1950) is the classic warning.
  • Exactly 0 or 1 has no place in a beta distribution. A common fix is \((y(n - 1) + 0.5)/n\) (Smithson & Verkuilen, 2006); better is a model with extra parts for the zeros and ones (zero-or-one-inflated beta), or the extended-support versions in recent versions of betareg.
  • Is it a share of a whole that was counted? With successes out of a small known number of trials, use binomial or beta-binomial regression. The beta regression is for shares without a meaningful number of trials, or with a number so large that it does not matter.
  • Several shares that add up to 1 (votes for five parties) need Dirichlet regression, or log-ratios.
  • Scales. Scores of a questionnaire divided by their range are a frequent use (Smithson & Verkuilen, 2006). Remember that the units are then “share of the range”.
  • Links. The logit is the default. Others can be compared by AIC: link = "loglog" etc.
  • The precision is part of the model. A wrong model for it makes the standard errors wrong. Use sandwich errors (vcov = sandwich) if in doubt.

10. Reporting the results in APA style

A report (APA 7th edition) needs the outcome and its range, the links of the mean and of the precision, odds ratios or effects in points with intervals, the precision, and the unit of analysis. The numbers come from the R objects:

Code
sm  <- summary(fit_phi)$coefficients$mean; cim <- confint(fit_phi)
ame2 <- sm[-1, 1] * mean(fitted(fit_phi) * (1 - fitted(fit_phi)))
apa_table <- data.frame(
  Predictor = c(
    "Intercept", "Degree (10 points)", "Aged 65+ (10 points)", "Born abroad (10 points)"
  ),
  b = f3(sm[, 1]),
  SE = f3(sm[, 2]),
  z = f2(sm[, 3]),
  p = sapply(sm[, 4], function(p) sub("^= ", "", pval(p))),
  OR = paste0(f2(exp(sm[, 1])), " [", f2(exp(cim[1:4, 1])), ", ", f2(exp(cim[1:4, 2])), "]"),
  ame = c("—", f1(100 * ame2))
)

Method (data analysis):

The share of valid votes for Leave in the 2016 referendum in the 348 districts of England and Wales (Electoral Commission, 2019) was analyzed with beta regression (Ferrari & Cribari-Neto, 2004), with a logit link for the mean and a log link for the precision. Predictors of the mean were the percentages of residents with a degree-level qualification, aged 65 and over, and born outside the United Kingdom (2011 census; Office for National Statistics, 2013), centered and in units of 10 percentage points; the precision depended on the first and the third. Models were compared with likelihood-ratio tests. Analyses were conducted in R (Version 4.6.2; R Core Team, 2026) with the package betareg (Cribari-Neto & Zeileis, 2010).

Results:

The share of Leave votes ranged from 21.4% to 75.6% (M = 54.4%). Districts with more graduates voted less for Leave, OR = 0.65 per 10 points, 95% CI [0.64, 0.67], p < .001, on average 10.2 percentage points (Table 1). The scatter around the mean differed between districts, χ²(2) = 10.0, p = .007. Adding the regions improved the model, χ²(9) = 95.2, p < .001, so the districts are not independent and the standard errors are too small. The results concern districts and not individual voters.

Table 1

Beta Regression of the Share of Leave Votes

Predictor b SE z p Odds ratio [95% CI] Average effect (points)
Intercept 0.177 0.009 18.81 < .001 1.19 [1.17, 1.22] —
Degree (10 points) -0.424 0.015 -28.50 < .001 0.65 [0.64, 0.67] -10.2
Aged 65+ (10 points) 0.133 0.032 4.12 < .001 1.14 [1.07, 1.22] 3.2
Born abroad (10 points) -0.028 0.017 -1.61 .108 0.97 [0.94, 1.01] -0.7

Note. N = 348 districts. Logit link. Precision modeled with the shares of graduates and of people born abroad. Average effect: mean change of the share for 10 points more of the predictor.

Points to remember:

  • Say what the share is a share of, and what one row is.
  • Report both links, and the model for the precision.
  • Translate odds ratios into percentage points.
  • Say what you did with zeros and ones.

11. Summary

When The outcome is a continuous share between 0 and 1 (not 0 or 1 exactly)
The model \(y \sim \text{Beta}\) with mean \(\mu\) and precision \(\phi\); \(\text{logit}(\mu) = x^\top\beta\)
Variance \(\mu(1 - \mu)/(1 + \phi)\)
How (R) betareg(y ~ x1 + x2 | z, data): after the bar, the precision
Reading it \(e^\beta\): odds ratio of the mean share; better, average marginal effects
Alternatives OLS (shares in the middle), quasi-binomial (counts known), zero-or-one-inflated beta
Checks Quantile residuals, precision, groups of rows
Related pages Generalized linear models, gamma regression, probit

References

Cribari-Neto, F., & Zeileis, A. (2010). Beta regression in R. Journal of Statistical Software, 34(2), 1–24. https://doi.org/10.18637/jss.v034.i02

Electoral Commission. (2019). Results and turnout at the EU referendum [Data set]. https://www.electoralcommission.org.uk/research-reports-and-data/our-reports-and-data-past-elections-and-referendums/results-and-turnout-eu-referendum

Ferrari, S., & Cribari-Neto, F. (2004). Beta regression for modelling rates and proportions. Journal of Applied Statistics, 31(7), 799–815. https://doi.org/10.1080/0266476042000214501

Office for National Statistics. (2013). 2011 census: Key statistics for local authorities in England and Wales [Data set]. Nomis. https://www.nomisweb.co.uk/census/2011

Robinson, W. S. (1950). Ecological correlations and the behavior of individuals. American Sociological Review, 15(3), 351–357. https://doi.org/10.2307/2087176

Smithson, M., & Verkuilen, J. (2006). A better lemon squeezer? Maximum-likelihood regression with beta-distributed dependent variables. Psychological Methods, 11(1), 54–71. https://doi.org/10.1037/1082-989X.11.1.54