pgx
PGX — Lightweight Postgres for AI agents. Written in Rust. Thousands of isolated databases in one runtime. 🐘
Translation pending
Projects school enrollment using the cohort survival / grade progression ratio method described in Webster (1970) <doi:10.1080/00220973.1970.11011238>, implemented as a matrix projection. Works at any
DataRGitHub @localopenOnlineOwner unconfirmed
Have you tried it? One tap is enough. No sign-in needed.
Owners of public repositories under a personal GitHub account can sign in to verify ownership and manage the introduction themselves. No administrator approval is needed.
Sign in, generate a verification file, and commit it to this repository’s default branch within 30 minutes. Files on other branches or forks do not count. Then check the file below to manage the project without administrator approval. Keep the file to retain your access.
If needed, you will go to sign-in. After signing in, return here and press your chosen verification button again.
Run /nomorevibe verify in your project folder to verify ownership and manage the introduction yourself.
Verify in one minuteAsk about other verification options
Projects school enrollment using the cohort survival / grade progression ratio method described in Webster (1970) <doi:10.1080/00220973.1970.11011238>, implemented as a matrix projection. Works at any level of aggregation and any number of grades. Provides functions to compute progression ratios from historical grade-level enrollment and to project future enrollment forward an arbitrary horizon.
Taken from the repository README
Loading the full README.
Read the full README ↗enrollcast projects school enrollment with the cohort survival / grade
progression ratio method, implemented as a matrix projection. It works
on one grade-by-year enrollment series at a time, so you can use it at
any level (school, district, local education agency, or city) and with
any number of grades.
Awesome hex logo provided by Adam Higerd.
install.packages("enrollcast")
Install the development version from GitHub:
# install.packages("pak")
pak::pak("localopen/enrollcast")
library(enrollcast)
# Historical grade-level enrollment (long format).
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)
)
# 1. Calculate progression ratios.
ratios <- progression_ratios(history, method = "mean")
ratios
#> grade_from grade_to ratio
#> 1 K 1 0.9250000
#> 2 1 2 0.9678363
# 2. Project forward. The entry grade (K) is supplied exogenously.
base <- history[history$year == 2023, c("grade", "enrollment")]
projection <- project_enrollment(
base = base,
ratios = ratios,
horizon = 3,
entry = c(125, 130, 128),
start_year = 2023
)
projection
#> year grade enrollment
#> 1 2024 K 125.00000
#> 2 2024 1 111.00000
#> 3 2024 2 95.81579
#> 4 2025 K 130.00000
#> 5 2025 1 115.62500
#> 6 2025 2 107.42982
#> 7 2026 K 128.00000
#> 8 2026 1 120.25000
#> 9 2026 2 111.90607
Inspect the underlying projection matrix at any time:
progression_matrix(ratios)
#> K 1 2
#> K 0.000 0.0000000 0
#> 1 0.925 0.0000000 0
#> 2 0.000 0.9678363 0
enrollcast projects one series per call. To project several schools or
local education agencies, split the data and map over the pieces:
# fmt: skip
school_history <- data.frame(
school = rep(c("North", "South"), each = 9),
year = rep(2021:2023, each = 3, times = 2),
grade = factor(rep(c("K", "1", "2"), times = 6), levels = c("K", "1", "2")),
enrollment = c(100, 90, 80, 110, 95, 88, 120, 99, 91, 120,
110, 100, 130, 115, 108, 140, 119, 111)
)
projections <- lapply(
split(school_history, school_history$school),
function(df) {
ratios <- progression_ratios(df)
base <- df[df$year == max(df$year), c("year", "grade", "enrollment")]
project_enrollment(base, ratios, horizon = 3, entry = rep(100, 3))
}
)
projections$North
#> year grade enrollment
#> 1 2024 K 100.00000
#> 2 2024 1 111.00000
#> 3 2024 2 95.81579
#> 4 2025 K 100.00000
#> 5 2025 1 92.50000
#> 6 2025 2 107.42982
#> 7 2026 K 100.00000
#> 8 2026 1 92.50000
#> 9 2026 2 89.52485