---
title: "Multinomial Logistic Regression: How Did Federal Employees Leave in 2025?"
description: "Multinomial logistic regression in R with nnet::multinom(), on real OPM data: how about 330,000 US federal employees left their jobs in fiscal year 2025 (quit, retired, early retirement, deferred resignation, laid off, terminated), with relative risk ratios, predicted probabilities, the IIA assumption and APA reporting."
author: ""
---
```{r options, echo=FALSE, warning=FALSE, message=FALSE}
directory<-if (rstudioapi::isAvailable()) paste0(dirname(rstudioapi::getActiveDocumentContext()$path),"/") else ""
source(paste0(directory, "R/code_options.R"))
# no knitr cache: the page downloads its data from OPM each time it runs (in about a minute),
# and a cached chunk would quietly keep an old download
knitr::opts_chunk$set(fig.height = 4.5, cache = FALSE)
```
## The question: six ways to leave
In 2025 the US federal government lost staff in several ways at once. In January, most federal employees were offered a **deferred resignation**: stop working, stay on the payroll until 30 September 2025, then resign. Agencies offered **early retirement**, carried out **reductions in force** (layoffs) and **dismissed** staff. And people kept **quitting** and **retiring**, as they do every year.
So everyone who left federal service in 2025 left in one of six ways. This page asks: **among the people who left, what made one way of leaving more likely than another?** Did the young quit and the old retire? Who took the deferred resignation? Who was laid off?
The outcome is a **category with six values and no natural order**: quitting is not "more" or "less" than being laid off. The type of outcome decides the type of regression:
| Outcome | Regression | Example |
|---|---|---|
| Two categories | [logistic](EXAMPLE_GENERALIZED.rmd) | hired or not |
| Ordered categories | [ordinal logistic](EXAMPLE_ORDINAL_LOGISTIC.Rmd) | a performance rating from 1 to 5 |
| **Unordered categories** | **multinomial logistic** | **how someone left: quit, retired, laid off...** |
A multinomial logistic regression picks one category as the **reference** and fits a logistic regression of each of the other categories against it, all at the same time. The data are real: the US Office of Personnel Management (OPM) publishes a record for every federal employee who leaves.
```{r packages}
library(nnet) # multinom(): multinomial logistic regression (comes with R)
library(nanoparquet) # read_parquet(): reads the Parquet files that OPM publishes
library(ggplot2)
# one color per way of leaving, the same in every chart
exits <- c("Quit", "Retired", "Early retirement", "Deferred resignation", "Laid off", "Terminated")
colours <- setNames(c("#2a78d6", "#eb6834", "#1baf7a", "#eda100", "#e87ba4", "#008300"), exits)
ink <- setNames(c("white", "white", "white", "#0b0b0b", "white", "white"), exits) # labels on the bars
# number formats for the text
f2 <- function(x) formatC(x, format = "f", digits = 2)
nz <- function(x, d = 2) sub("^0", "", formatC(x, format = "f", digits = d)) # no leading zero
pval <- function(p) if (p < .001) "< .001" else paste("=", nz(p, 3))
pct <- function(x, d = 0) paste0(formatC(100 * x, format = "f", digits = d), "%")
num <- function(x) format(x, big.mark = ",")
rr <- function(x) ifelse(x >= 100, formatC(x, format = "f", digits = 0, big.mark = ","),
formatC(x, format = "f", digits = 2)) # relative risk ratios
```
---
## 1. The data
OPM's [Federal Workforce Data](https://data.opm.gov/) has a file for every month with **one row per separation**: a civilian employee leaving federal service. Each row says how the person left, their age group, years of service, agency, occupation, type of appointment and more. The files are free, need no login, and come through an [API](https://data.opm.gov/get-data/api-access) as Parquet files of one to four MB.
A monthly file holds the separations **processed** in that month, and some of them took effect months earlier: separations of September 2025 were still arriving in 2026. So we download every file from October 2023 to the latest one, and sort the separations by the date they **took effect**.
```{r download}
options(timeout = max(300, getOption("timeout"))) # allow slow downloads
# the list of monthly files, with the current version of each
files <- jsonlite::fromJSON("https://data.opm.gov/api/v1/files/separations?current=true")
files <- files[as.integer(files$year) * 100 + as.integer(files$month) >= 202310, ]
latest <- max(as.Date(paste(files$year, files$month, "01", sep = "-")))
# the columns we need, out of the 69 in each file
columns <- c("personnel_action_effective_date_yyyymm", "separation_category", "drp_indicator",
"age_bracket", "length_of_service_years", "supervisory_status",
"appointment_type", "stem_occupation")
# one month: download the file and read the columns; try again if OPM asks us to slow down
read_month <- function(year, month, version) {
url <- sprintf("https://data.opm.gov/api/v1/files/separations/%s/%s/%s/download", year, month, version)
path <- tempfile(fileext = ".parquet")
for (attempt in 1:3) {
ok <- tryCatch(download.file(url, path, mode = "wb", quiet = TRUE) == 0, error = function(e) FALSE)
if (ok) break
Sys.sleep(10 * attempt)
}
if (!ok) stop("Could not download ", url)
as.data.frame(read_parquet(path, col_select = columns))
}
raw <- do.call(rbind, Map(read_month, files$year, files$month, files$version))
nrow(raw)
```
That is `r nrow(files)` monthly files, up to `r format(latest, "%B %Y")`. The US federal **fiscal year** runs from October to September: fiscal year 2025 (FY2025) is October 2024 to September 2025. We keep FY2024, a year before the changes, and FY2025:
```{r fiscal_year}
ym <- as.integer(raw$personnel_action_effective_date_yyyymm) # e.g. 202509 = September 2025
raw$month <- as.Date(sprintf("%d-%02d-01", ym %/% 100, ym %% 100))
raw$fiscal_year <- ym %/% 100 + (ym %% 100 >= 10) # October 2024 to September 2025 = 2025
d <- subset(raw, fiscal_year %in% 2024:2025)
table(d$separation_category, d$fiscal_year)
```
OPM records how each separation was processed. A separate column, `drp_indicator`, says whether it came under the deferred resignation program (`Y`):
```{r drp}
with(subset(d, fiscal_year == 2025), table(separation_category, drp_indicator))
```
On paper, most people who took the deferred resignation **quit or retired**. But they took a different route from people who quit or retired in the ordinary way, so we give them a category of their own. The six ways of leaving:
| Way of leaving | OPM category | What it means |
|---|---|---|
| Quit | QUIT | Resigned |
| Retired | RETIREMENT - VOLUNTARY, RETIREMENT - OTHER | Retired on a pension |
| Early retirement | RETIREMENT - EARLY OUT | Took the agency's offer of an early pension: age 50 with 20 years of service, or any age with 25 years |
| Deferred resignation | any of the above with `drp_indicator` = Y | Accepted the 2025 offer; most left on 30 September 2025 |
| Laid off | REDUCTION IN FORCE (RIF) | The position was abolished |
| Terminated | TERMINATION (EXPIRED APPT/OTHER) | A temporary appointment ended, or the agency ended the employment, for example during the probationary period |
We leave out transfers to another agency (those people are still federal employees) and "other separation", which includes deaths.
```{r exit}
exit <- c("QUIT" = "Quit",
"RETIREMENT - VOLUNTARY" = "Retired",
"RETIREMENT - OTHER" = "Retired",
"RETIREMENT - EARLY OUT" = "Early retirement",
"REDUCTION IN FORCE (RIF)" = "Laid off",
"TERMINATION (EXPIRED APPT/OTHER)" = "Terminated")[d$separation_category]
exit[!is.na(exit) & d$drp_indicator %in% "Y"] <- "Deferred resignation"
d$exit <- factor(exit, levels = exits)
d <- subset(d, !is.na(exit)) # drops the transfers and the other separations
```
The predictors are five characteristics of each person. Years of service are cut where the rules change: the first year is usually a probationary period, early retirement needs 20 or 25 years, and a full pension needs, for example, 30 years from age 55 to 57 or 20 years at age 60.
```{r predictors}
age <- ifelse(d$age_bracket %in% c("LESS THAN 20", "20-24"), "Under 25",
ifelse(d$age_bracket == "65 OR MORE", "65+", d$age_bracket))
d$age <- factor(age, levels = c("Under 25", "25-29", "30-34", "35-39", "40-44", "45-49",
"50-54", "55-59", "60-64", "65+"))
years <- suppressWarnings(as.numeric(d$length_of_service_years))
years[years > 60] <- NA # a few impossible values (up to 1,800 years of service)
d$service <- cut(years, c(-Inf, 1, 5, 10, 20, 25, 30, Inf), right = FALSE,
labels = c("Under 1", "1-4", "5-9", "10-19", "20-24", "25-29", "30+"))
# supervisors and managers; team leaders count as non-supervisors
supervisors <- c("SUPERVISOR OR MANAGER", "SUPERVISOR (CSRA)", "MANAGEMENT OFFICIAL (CSRA)")
d$supervisor <- factor(ifelse(d$supervisory_status == "INVALID", NA,
ifelse(d$supervisory_status %in% supervisors, "Yes", "No")),
levels = c("No", "Yes"))
# a permanent or a temporary (nonpermanent) appointment
d$permanent <- factor(ifelse(d$appointment_type == "INVALID", NA,
ifelse(grepl("NONPERMANENT", d$appointment_type), "No", "Yes")),
levels = c("Yes", "No"))
# STEM, health or other occupations; "UNSPECIFIED" becomes NA
d$occupation <- factor(c("ALL OTHER OCCUPATIONS" = "Other", "STEM OCCUPATIONS" = "STEM",
"HEALTH OCCUPATIONS" = "Health")[d$stem_occupation],
levels = c("Other", "STEM", "Health"))
vars <- c("exit", "age", "service", "supervisor", "permanent", "occupation")
d <- d[complete.cases(d[vars]), ]
fy25 <- subset(d, fiscal_year == 2025)
table(d$fiscal_year)
```
Each row is a separation, not a person: someone who left two temporary jobs in a year is in the data twice. We still call them people, for short.
---
## 2. Look at the data
```{r monthly, fig.height = 6.5}
monthly <- as.data.frame(table(month = d$month, exit = d$exit), responseName = "people")
monthly$month <- as.Date(as.character(monthly$month))
ggplot(monthly, aes(month, people, fill = exit)) +
geom_col(width = 25) +
geom_vline(xintercept = as.Date("2024-09-16"), linetype = "dashed", colour = "grey40") +
facet_wrap(~ exit, ncol = 2, scales = "free_y") +
scale_fill_manual(values = colours, guide = "none") +
scale_y_continuous(labels = scales::comma) +
scale_x_date(date_breaks = "6 months", date_labels = "%b %Y") +
labs(title = "Federal employees leaving each month, by how they left",
subtitle = "October 2023 to September 2025; each panel has its own scale.\nDashed line: the start of fiscal year 2025.",
x = NULL, y = "people") +
theme_bw()
```
```{r monthly_numbers}
drp_september <- sum(fy25$exit == "Deferred resignation" & fy25$month == as.Date("2025-09-01"))
# terminations of people with under five years of service, February to May
new_terminated <- with(subset(d, exit == "Terminated" & service %in% c("Under 1", "1-4") &
format(month, "%m") %in% c("02", "03", "04", "05")),
table(fiscal_year))
new_terminated
```
In FY2024, left of the dashed line, people quit, retired or came to the end of a temporary job. Retirements peak every December, and terminations every autumn, when seasonal jobs end. FY2025 is different:
- **Deferred resignations**: `r num(drp_september)` took effect in September 2025 alone, when the paid leave ended.
- **Early retirements and layoffs**, almost absent in FY2024, start in spring 2025.
- **Terminations** of people with under five years of service rose from `r num(new_terminated[["2024"]])` in February to May 2024 to `r num(new_terminated[["2025"]])` in the same months of 2025, when agencies dismissed many employees who were still in their probationary period.
```{r by_year}
counts <- table(d$exit, d$fiscal_year)
data.frame(exit = exits,
FY2024 = num(as.vector(counts[, "2024"])),
FY2025 = num(as.vector(counts[, "2025"])),
FY2025_share = pct(as.vector(prop.table(counts[, "2025"])), 1))
top_exit <- names(which.max(counts[, "2025"]))
```
In FY2025, `r num(sum(counts[, "2025"]))` people left in these six ways, `r formatC(sum(counts[, "2025"]) / sum(counts[, "2024"]), format = "f", digits = 1)` times as many as in FY2024, and the most common way to leave was the `r tolower(top_exit)`. From here on we use FY2025. Who left which way?
```{r mix}
# stacked bars of shares (each bar adds up to 100%), with the larger shares labeled
stacked <- function(m, y_label, x_label) {
ggplot(m, aes(share, group, fill = exit)) +
geom_col(width = 0.8, colour = "white", linewidth = 0.3, position = position_stack(reverse = TRUE)) +
geom_text(aes(label = ifelse(share >= 0.07, pct(share), ""), colour = exit),
position = position_stack(vjust = 0.5, reverse = TRUE), size = 3, show.legend = FALSE) +
scale_fill_manual(values = colours) +
scale_colour_manual(values = ink, guide = "none") +
scale_x_continuous(labels = scales::percent, expand = c(0, 0)) +
scale_y_discrete(limits = rev) +
labs(x = x_label, y = y_label, fill = NULL) +
theme_bw() +
theme(legend.position = "bottom", plot.margin = margin(5.5, 18, 5.5, 5.5)) + # room for "100%"
guides(fill = guide_legend(nrow = 2))
}
# how the people in each group left, in FY2025
mix <- function(group, label) {
m <- as.data.frame(prop.table(table(group = fy25[[group]], exit = fy25$exit), 1), responseName = "share")
stacked(m, label, "share of the people in the group who left in FY2025")
}
mix("age", "age")
```
```{r mix_service}
mix("service", "years of service")
share <- function(group) prop.table(table(fy25[[group]], fy25$exit), 1)
by_age <- share("age")
by_service <- share("service")
by_job <- share("occupation")
middle <- c("30-34", "35-39", "40-44", "45-49", "50-54", "55-59", "60-64")
```
- **Quitting** is the usual way out up to age 45; from 50 on, people **retire**.
- **Early retirement** happens at 50 to 59 and with 20 to 29 years of service: the eligibility rules.
- **The deferred resignation** is the odd one: between `r pct(min(by_age[middle, "Deferred resignation"]))` and `r pct(max(by_age[middle, "Deferred resignation"]))` of the people in every age group from 30 to 64 took it, and a similar share at every length of service from one year up. Ordinary quitting and retiring each belong to one end of a career; the deferred resignation drew from all of it.
- **Layoffs** hit the middle of careers: `r pct(by_age["45-49", "Laid off"], 1)` of the people aged 45 to 49 who left, `r pct(by_service["10-19", "Laid off"], 1)` of those with 10 to 19 years of service.
- **Terminations** belong to the young and the new: `r pct(by_age["Under 25", "Terminated"])` of the people under 25 and `r pct(by_service["Under 1", "Terminated"])` of those with less than a year of service.
- **Occupations** differ too: only `r pct(by_job["Health", "Deferred resignation"], 1)` of the people in health occupations took the deferred resignation, against `r pct(by_job["STEM", "Deferred resignation"])` in STEM and `r pct(by_job["Other", "Deferred resignation"])` in other occupations. Agencies could exclude positions from the offer.
Age and years of service go together, so these charts cannot tell whether age or service drives an exit. The model can: it estimates each effect holding the others constant.
---
## 3. The model step by step, with formulas
### Step 1: a reference category
Choose one way of leaving as the yardstick. We use **Quit**, an ordinary resignation: every other way of leaving is compared with quitting. Any category could be the reference; the predicted probabilities are the same, only the comparisons in the output change. In R the reference is the first level of the factor (`levels(fy25$exit)[1]` is `r levels(fy25$exit)[1]`), and `relevel()` changes it.
### Step 2: one equation for every other category
For person $i$ and each way of leaving $k$ other than quitting:
$$\eta_{ik} = \ln\frac{P(\text{exit}_i = k)}{P(\text{exit}_i = \text{Quit})} = \beta_{0k} + \beta_{1k}x_{1i} + \dots + \beta_{pk}x_{pi}$$
That is five equations, each with its own intercept and its own slopes. The left side is the log of the **relative risk**: how much more likely leaving by $k$ is than quitting. Each equation looks like a [logistic regression](EXAMPLE_IMBALANCED_LOGISTIC.Rmd); the difference is that the five are estimated together, so that every person's six probabilities add up to 1.
### Step 3: from the equations to probabilities
$$P(\text{exit}_i = \text{Quit}) = \frac{1}{1 + \sum_{j} e^{\eta_{ij}}} \qquad P(\text{exit}_i = k) = \frac{e^{\eta_{ik}}}{1 + \sum_{j} e^{\eta_{ij}}}$$
The sums run over the five categories other than Quit. Each probability is between 0 and 1, and the six add up to 1. This is the **softmax** function, the same formula that neural networks use to classify.
### Step 4: what a coefficient means
$e^{\beta}$ is the **relative risk ratio** (RRR): the number by which the ratio $P(k)/P(\text{Quit})$ is multiplied when the predictor moves from its reference level to this level, with the other predictors held constant. An RRR of 2 means twice as likely to leave by $k$ **rather than by quitting**. Some books and programs call it an odds ratio; either way it compares two categories with each other, not one category with all the others.
### Step 5: how R finds the β's
By maximum likelihood: R looks for the $\beta$'s that make the exits that people actually took as probable as possible,
$$\ln L = \sum_i \ln P(\text{exit}_i = \text{the exit that person } i \text{ took})$$
`multinom()` maximizes it. It fits the model as a neural network without a hidden layer, which is why it lives in the package `nnet`.
### Step 6: count the parameters
A predictor with $c$ categories gets $c - 1$ coefficients: age has 10 groups (9 coefficients), service 7 (6), supervisor and appointment 2 each (1 each) and occupation 3 (2). That is 19 slopes plus an intercept, 20 per equation, and 5 equations make **100 parameters**. Multinomial models grow fast: every category needs enough people for a whole set of coefficients of its own.
---
## 4. Fitting the model
Every predictor is a category, so the `r num(nrow(fy25))` people fall into a limited number of combinations of age group, service, supervisor, appointment, occupation and exit. Fitting the model to the **count** of people in each combination gives the same estimates as fitting the people one by one: 300 people with the same values add the same term to the log-likelihood 300 times, which is what `weights = Freq` does. It takes a second instead of minutes.
```{r fit}
g <- as.data.frame(table(fy25[vars])) # one row per combination; Freq = the number of people
g <- subset(g, Freq > 0)
nrow(g)
fit <- multinom(exit ~ age + service + supervisor + permanent + occupation,
data = g, weights = Freq, maxit = 1000, trace = FALSE, Hess = TRUE)
summary(fit)
```
`maxit = 1000` lets the estimation run longer than the default 100 steps, `trace = FALSE` hides the log of the steps, and `Hess = TRUE` keeps what `summary()` needs for the standard errors.
### How to read the output
```{r output_parts}
s <- summary(fit)
b <- coef(fit) # one row per way of leaving, one column per term
se <- s$standard.errors
z <- b / se
p <- 2 * pnorm(-abs(z)) # summary() prints no p values: compute them
rrr <- exp(b) # relative risk ratios
low <- exp(b - qnorm(0.975) * se) # their 95% confidence intervals
high <- exp(b + qnorm(0.975) * se)
```
| Part | Meaning | Here |
|---|---|---|
| `Coefficients` | One row per way of leaving, compared with Quit; one column per predictor level. Each number is $b$: the change in the log relative risk | Row `Laid off`, column `supervisorYes`: *b* = `r f2(b["Laid off", "supervisorYes"])` |
| `Std. Errors` | The standard error of each $b$; smaller is more precise | `r f2(se["Laid off", "supervisorYes"])` |
| `Residual Deviance` | $-2 \ln L$: how badly the model fits; smaller is better. Used for the tests in section 6 | `r num(round(deviance(fit)))` |
| `AIC` | The deviance plus 2 for every parameter, for comparing models fitted to the same data | `r num(round(fit$AIC))` |
- **There are no *p* values.** Compute them as above: $z = b / SE$, and $p$ from the normal distribution. For `supervisorYes` in the row `Laid off`, *z* = `r f2(z["Laid off", "supervisorYes"])`, *p* `r pval(p["Laid off", "supervisorYes"])`.
- **The intercepts** are the log relative risks of the reference person: under 25, less than a year of service, not a supervisor, on a permanent appointment, in an occupation that is neither STEM nor health.
- **Huge numbers**, such as an RRR of `r rr(rrr["Early retirement", "age55-59"])` for early retirement at ages 55 to 59, mean that the reference group almost never leaves that way: nobody under 25 can retire early. They are common with categorical predictors and say little on their own; the predicted probabilities of section 5 are easier to read.
- **Every coefficient compares with Quit.** `supervisorYes` in the row `Laid off` says nothing about being laid off rather than retiring. For that comparison, subtract the two rows, b(Laid off) − b(Retired), or change the reference with `relevel()` and fit again.
The relative risk ratios of the three predictors that are not age or service:
```{r rrr_table}
terms <- c(supervisorYes = "Supervisor", permanentNo = "Temporary appointment",
occupationSTEM = "STEM occupation", occupationHealth = "Health occupation")
cell <- function(k, t) paste0(f2(rrr[k, t]), " [", f2(low[k, t]), ", ", f2(high[k, t]), "]")
rrr_table <- data.frame(Predictor = terms,
sapply(rownames(b), function(k) sapply(names(terms), function(t) cell(k, t))),
check.names = FALSE, row.names = NULL)
knitr::kable(rrr_table, align = "lrrrrr")
```
Each cell is the RRR with its 95% confidence interval, against quitting:
- **Supervisors** were `r f2(rrr["Laid off", "supervisorYes"])` times as likely as non-supervisors to be laid off rather than to quit, at the same age, service, appointment and occupation.
- **Temporary appointments** were `r f2(rrr["Terminated", "permanentNo"])` times as likely to end in a termination rather than a resignation: a temporary job usually ends by itself.
- **Health occupations** had a `r pct(1 - rrr["Deferred resignation", "occupationHealth"])` lower relative risk of the deferred resignation rather than quitting (RRR = `r f2(rrr["Deferred resignation", "occupationHealth"])`).
### The same numbers by hand
Steps 2 and 3 for one person, aged 55 to 59 with 25 to 29 years of service, and the reference level of everything else:
```{r by_hand}
eta <- b[, "(Intercept)"] + b[, "age55-59"] + b[, "service25-29"] # step 2: one eta per way of leaving
prob <- c(Quit = 1, exp(eta)) / (1 + sum(exp(eta))) # step 3
round(prob, 3)
# new people for predict(), with the factor levels of the model
people <- function(...) {
x <- data.frame(...)
for (v in names(x)) x[[v]] <- factor(x[[v]], levels = levels(g[[v]]))
x
}
someone <- people(age = "55-59", service = "25-29", supervisor = "No", permanent = "Yes", occupation = "Other")
round(predict(fit, newdata = someone, type = "probs"), 3) # the same, from R
```
For this person the two most likely ways of leaving were **`r names(sort(prob, decreasing = TRUE))[1]`** (`r pct(sort(prob, decreasing = TRUE)[1])`) and **`r names(sort(prob, decreasing = TRUE))[2]`** (`r pct(sort(prob, decreasing = TRUE)[2])`).
---
## 5. Predicted probabilities: the easiest way to read the model
A relative risk ratio compares two exits; a predicted probability says how likely each exit is for a given kind of person. Six typical people, along a career:
```{r profiles, fig.height = 4}
career <- people(age = c("25-29", "25-29", "35-39", "45-49", "55-59", "60-64"),
service = c("1-4", "1-4", "10-19", "20-24", "25-29", "30+"),
supervisor = "No",
permanent = c("Yes", "No", "Yes", "Yes", "Yes", "Yes"),
occupation = "Other")
label <- c("25-29, 1-4 years", "25-29, 1-4 years, temporary", "35-39, 10-19 years",
"45-49, 20-24 years", "55-59, 25-29 years", "60-64, 30+ years")
probs <- predict(fit, newdata = career, type = "probs")
m <- data.frame(group = factor(rep(label, ncol(probs)), levels = label),
exit = factor(rep(colnames(probs), each = nrow(probs)), levels = exits),
share = as.vector(probs))
stacked(m, "age, years of service", "predicted probability of each way of leaving, FY2025")
rownames(probs) <- label
```
- **Early in a career** (25 to 29, one to four years) people quit or took the deferred resignation: `r pct(probs[1, "Quit"])` and `r pct(probs[1, "Deferred resignation"])`.
- **The same person on a temporary appointment** was most likely terminated (`r pct(probs[2, "Terminated"])`): the appointment ran out.
- **In mid-career** the risk of being laid off was at its highest: `r pct(probs[3, "Laid off"])` at 35 to 39 with 10 to 19 years of service, `r pct(probs[4, "Laid off"])` at 45 to 49 with 20 to 24 years.
- **With 25 to 29 years of service at 55 to 59**, early retirement became a real option (`r pct(probs[5, "Early retirement"])`), next to an ordinary retirement (`r pct(probs[5, "Retired"])`) and the deferred resignation (`r pct(probs[5, "Deferred resignation"])`).
- **At 60 to 64 with 30 years or more**, people mostly retired (`r pct(probs[6, "Retired"])`).
These are probabilities **for a person who left**. They do not say how likely such a person was to leave at all: the data hold only the people who left.
---
## 6. Testing the predictors and the model
The **likelihood-ratio test** compares the deviances of two nested models. First the whole model against a model with no predictors, then each predictor: fit the model without it and see how much worse it gets.
```{r tests}
null <- multinom(exit ~ 1, data = g, weights = Freq, trace = FALSE)
model_test <- anova(null, fit)
model_test
tests <- do.call(rbind, lapply(c("age", "service", "supervisor", "permanent", "occupation"), function(v) {
a <- anova(update(fit, as.formula(paste(". ~ . -", v))), fit)
data.frame(predictor = v, chi_square = round(a$"LR stat."[2], 1), df = a$" Df"[2],
p = format.pval(a$"Pr(Chi)"[2], eps = 0.001))
}))
tests
mcfadden <- 1 - deviance(fit) / deviance(null) # McFadden's pseudo-R squared
mcfadden
ranked <- unname(c(age = "age", service = "years of service", supervisor = "supervisor status",
permanent = "appointment type", occupation = "occupation")[tests$predictor[order(-tests$chi_square)]])
```
- **Every predictor is significant**: with `r num(nrow(fy25))` people even a tiny effect is. The $\chi^2$ values show which predictors matter most: `r ranked[1]`, `r ranked[2]` and `r ranked[3]`; `r ranked[5]` matters least. The degrees of freedom are the coefficients a predictor adds to all five equations: 9 age groups × 5 = 45.
- **McFadden's pseudo-$R^2$** = `r f2(mcfadden)`: one minus the deviance of the model divided by the deviance of the model with no predictors. It is not a share of explained variance and it runs much lower than the $R^2$ of a linear regression; use it to compare models fitted to the same data.
How often does the model name the right exit, if it picks the most likely one for each person?
```{r classification}
predicted <- factor(colnames(fitted(fit))[max.col(fitted(fit), ties.method = "first")], levels = exits)
accuracy <- weighted.mean(predicted == g$exit, g$Freq)
base_rate <- max(prop.table(table(fy25$exit))) # always guessing the most common exit
c(model = accuracy, most_common_exit = base_rate)
# how each exit was classified: % of the row
round(100 * prop.table(xtabs(Freq ~ exit + predicted, data = cbind(g, predicted)), 1))
```
The model names the right exit for `r pct(accuracy)` of the people, against `r pct(base_rate)` for always guessing the most common one. But it almost never predicts an early retirement or a layoff, even though it knows who is most at risk of them: these exits are rare, so for almost nobody are they the **most** likely one. Accuracy is a poor guide when some categories are rare, as [Logistic Regression With a Rare Outcome](EXAMPLE_IMBALANCED_LOGISTIC.Rmd) shows; the predicted probabilities carry the information.
---
## 7. An assumption to check: independence of irrelevant alternatives
The model assumes that the ratio of two probabilities, for example $P(\text{Retired}) / P(\text{Quit})$, does not depend on what other ways of leaving there are: the **independence of irrelevant alternatives** (IIA). The textbook example: a city adds a blue bus identical to its red bus. IIA predicts that the blue bus takes passengers from cars and from the red bus in proportion; in reality it takes them almost only from the red bus.
The deferred resignation was a new way of leaving in 2025. Under IIA it drew people from the other exits in proportion. A simple check: fit the model again **without** it, that is without the category and without the people who took it, and compare the coefficients that remain. If IIA holds, they hardly change.
```{r iia}
g2 <- droplevels(subset(g, exit != "Deferred resignation"))
fit2 <- update(fit, data = g2)
show <- c("age55-59", "age60-64", "service25-29", "service30+", "supervisorYes", "permanentNo")
iia <- expand.grid(term = show, exit = rownames(coef(fit2)), stringsAsFactors = FALSE)
iia$all_six <- exp(coef(fit)[cbind(iia$exit, iia$term)])
iia$without <- exp(coef(fit2)[cbind(iia$exit, iia$term)])
knitr::kable(data.frame(exit = iia$exit, term = iia$term, rr(iia$all_six), rr(iia$without)),
col.names = c("Way of leaving (against Quit)", "Term", "RRR, six exits",
"RRR without the deferred resignation"), align = "llrr")
moved <- function(k) median(abs(log(iia$without / iia$all_six))[iia$exit == k]) # typical change, log scale
```
The coefficients of **retirement** and **early retirement** move a lot: for 25 to 29 years of service, the RRR of retiring rather than quitting goes from `r rr(iia$all_six[iia$exit == "Retired" & iia$term == "service25-29"])` to `r rr(iia$without[iia$exit == "Retired" & iia$term == "service25-29"])`. Those of **layoffs** and **terminations** move much less (a typical change of `r pct(exp(moved("Laid off")) - 1)` and `r pct(exp(moved("Terminated")) - 1)`, against `r pct(exp(moved("Retired")) - 1)` for retirement). So IIA is doubtful for the exits that are close to the deferred resignation. Models that relax it, the nested logit (similar exits share a "nest") and the mixed logit, are in the package `mlogit` (Croissant, 2020). The formal version of this check, the Hausman–McFadden test (`mlogit::hmftest()`), would flag even trivial differences with this many people; the size of the changes tells more.
Three more things to keep in mind:
- **People in the same agency are not independent.** Layoffs and early-retirement offers were decided agency by agency, so the standard errors above are too small. Agency as a predictor, or a [multilevel](EXAMPLE_MULTILEVEL.Rmd) multinomial model, would take this into account.
- **Only people who left.** The model compares ways of leaving among the people who left; it says nothing about the people who stayed. Whether supervisors were more likely to **leave at all** needs the employment files too, which OPM also publishes.
- **The data keep changing.** OPM calls the newest data preliminary, and late reports keep arriving: run this page again in a few months and the counts will be a little higher.
---
## 8. Reporting the results in APA style
A report (APA 7th edition) needs the outcome and its reference category, the predictors, the model test and the relative risk ratios with their uncertainty. The numbers come from the R objects, so the text below always matches the results:
```{r apa_numbers}
n_model <- sum(g$Freq)
lr <- model_test$"LR stat."[2]
lr_df <- model_test$" Df"[2]
lr_p <- model_test$"Pr(Chi)"[2]
ci <- function(k, t) paste0("95% CI [", f2(low[k, t]), ", ", f2(high[k, t]), "]")
# the cells of Table 1 whose p is .001 or more, for the note under it
big_p <- which(p[, names(terms)] >= .001, arr.ind = TRUE)
p_note <- if (nrow(big_p) == 0) "All *p* < .001." else
paste0("All *p* < .001 except ", paste0(terms[colnames(p[, names(terms)])[big_p[, "col"]]], ", ",
tolower(rownames(p)[big_p[, "row"]]), ": *p* ", sapply(p[, names(terms)][big_p], pval),
collapse = "; "), ".")
```
**Method** (data analysis):
> We analyzed the `r num(n_model)` separations from the US federal civil service that took effect in fiscal year 2025 (October 2024 to September 2025), as recorded in the Federal Workforce Data of the U.S. Office of Personnel Management (2026), excluding transfers between agencies, other separations and records with missing predictors. The way of leaving (quit, retirement, early retirement, deferred resignation, reduction in force, termination) was analyzed with a multinomial logistic regression, with quitting as the reference category and age group, years of service, supervisory status, appointment type (permanent or temporary) and occupation group (STEM, health, other) as predictors. Analyses were conducted in R (Version `r paste(R.version$major, R.version$minor, sep = ".")`; R Core Team, `r R.version$year`) with the *nnet* package (Venables & Ripley, 2002).
**Results:**
> The predictors improved the fit over an intercept-only model, χ²(`r lr_df`) = `r num(round(lr))`, *p* `r pval(lr_p)`, McFadden's *R*² = `r nz(mcfadden)`. Holding the other predictors constant, supervisors were more likely than non-supervisors to be laid off rather than to quit, *RRR* = `r f2(rrr["Laid off", "supervisorYes"])`, `r ci("Laid off", "supervisorYes")`, employees on temporary appointments were more likely to be terminated rather than to quit, *RRR* = `r f2(rrr["Terminated", "permanentNo"])`, `r ci("Terminated", "permanentNo")`, and employees in health occupations were less likely to take the deferred resignation rather than to quit, *RRR* = `r f2(rrr["Deferred resignation", "occupationHealth"])`, `r ci("Deferred resignation", "occupationHealth")` (Table 1). Compared with employees with less than a year of service, those with 25 to 29 years were more likely to take the deferred resignation rather than to quit, *RRR* = `r f2(rrr["Deferred resignation", "service25-29"])`, `r ci("Deferred resignation", "service25-29")`.
**Table 1**
*Relative Risk Ratios From a Multinomial Logistic Regression of the Way of Leaving Federal Service, FY2025*
```{r apa_table, echo=FALSE}
knitr::kable(rrr_table, align = "lrrrrr", format = "pipe")
```
*Note.* *N* = `r num(n_model)`. Reference category: quit. Each cell is the relative risk ratio [95% confidence interval] of leaving in the way named in the column rather than quitting. The model also includes age group and years of service. `r p_note`
**Points to remember:**
- Name the **reference category**: every coefficient compares with it.
- Report relative risk ratios with 95% confidence intervals, and say that they hold the other predictors constant.
- Give the model test ($\chi^2$ with its degrees of freedom) and a pseudo-$R^2$, and say which one.
- With hundreds of thousands of people every *p* is tiny: report the size of the effects, and predicted probabilities where they help.
- Say which categories you merged or left out, and why.
- Cite R and the packages; `citation("nnet")` gives the reference.
---
## 9. Summary
| | |
|---|---|
| **When** | The outcome is a category with three or more values and no order |
| **Why not separate logistic regressions** | Their probabilities do not add up to 1, and there is no single test of a predictor |
| **Why not [ordinal logistic regression](EXAMPLE_ORDINAL_LOGISTIC.Rmd)** | The categories have no order |
| **How (R)** | `nnet::multinom(y ~ x, data)`; with counts per combination of values, `weights = n` |
| **Output** | One equation per category against the reference; `exp()` of a coefficient is a relative risk ratio |
| **Easiest to read** | Predicted probabilities: `predict(fit, newdata, type = "probs")` |
| **Tests** | Likelihood-ratio tests with `anova()`; McFadden's pseudo-$R^2$ |
| **Assumptions** | Independent observations; independence of irrelevant alternatives; enough people in every category for its own set of coefficients |
| **If IIA fails** | A nested or mixed logit, with `mlogit` |
---
## References
Agresti, A. (2013). *Categorical data analysis* (3rd ed.). Wiley.
Croissant, Y. (2020). Estimation of random utility models in R: The mlogit package. *Journal of Statistical Software*, *95*(11), 1–41. https://doi.org/10.18637/jss.v095.i11
Csárdi, G., & Mühleisen, H. (2026). *nanoparquet: Read and write 'Parquet' files* (R package version 0.5.2). https://github.com/r-lib/nanoparquet
Hausman, J., & McFadden, D. (1984). Specification tests for the multinomial logit model. *Econometrica*, *52*(5), 1219–1240.
McFadden, D. (1974). Conditional logit analysis of qualitative choice behavior. In P. Zarembka (Ed.), *Frontiers in econometrics* (pp. 105–142). Academic Press.
U.S. Office of Personnel Management. (2026). *Federal Workforce Data: Separations* [Data set]. https://data.opm.gov/
Venables, W. N., & Ripley, B. D. (2002). *Modern applied statistics with S* (4th ed.). Springer.