pgx
PGX — Lightweight Postgres for AI agents. Written in Rust. Thousands of isolated databases in one runtime. 🐘
翻譯準備中
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
翻譯準備中
資料RGitHub @localopen上線中營運者未確認
試用過了嗎? 點一下就好,不需要登入。
個人 GitHub 帳號下公開儲存庫的擁有者可以登入並驗證所有權,自行管理介紹,無需管理員核准。
登入並產生驗證檔案,在 30 分鐘內將其提交至此儲存庫的預設分支。其他分支或分叉儲存庫中的檔案無效。然後在下方檢查檔案,即可無需管理員核准直接管理專案。請保留檔案以維持管理權限。
如需登入,將前往登入頁面。登入後請回到此處,再次點擊所選的驗證按鈕。
在專案資料夾中執行 /nomorevibe verify,即可驗證所有權並自行管理介紹。
一分鐘完成驗證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.
翻譯準備中
取自儲存庫 README
正在載入完整 README。
檢視完整 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