View source: R/project-enrollment.R
| project_enrollment | R Documentation |
Projects grade-level enrollment forward an arbitrary horizon using the grade
progression ratio method. Internally builds a projection matrix from ratios
and advances enrollment one year at a time (one matrix-vector product per
projected year), overwriting the entry grade with the supplied exogenous
value each year. ratios is optional when a schedule is supplied.
project_enrollment(
base,
ratios = NULL,
horizon = NULL,
entry = NULL,
schedule = NULL,
start_year = NULL
)
base |
Most recent observed enrollment: either a data frame with
columns |
ratios |
A data frame or data-frame subclass with columns |
horizon |
Number of years to project (a positive integer). |
entry |
Exogenous entry-grade enrollment for each projected year: a
numeric vector of length |
schedule |
Optional prebuilt projection schedule: a list of per-year
steps, each |
start_year |
Optional integer label for the base year; output years run
from |
A long data frame with columns year, grade, and enrollment,
covering the projected years only.
history <- data.frame(
year = rep(2021:2023, each = 3),
grade = factor(rep(c("K", "1", "2"), 3), levels = c("K", "1", "2")),
enrollment = c(100, 90, 80, 110, 95, 88, 120, 99, 91)
)
ratios <- progression_ratios(history)
base <- subset(history, year == 2023, c("grade", "enrollment"))
project_enrollment(base, ratios,
horizon = 3, entry = c(125, 130, 128),
start_year = 2023
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.