“Pamiętaj, Beta. Statystyka to nie prawda. To narzędzie do kwestionowania kłamstw.”
— The Statistician, District 9
WaszKrak, 2047
Eighteen million people. Twenty-five districts. One algorithm.
LifeCalc — QuantumCorp’s master scoring engine — assigns every resident of WaszKrak a number updated every Friday at midnight. The number determines access to healthcare, credit, employment programmes, and district reclassification. It is described, in the official documentation, as objective.
It was trained on fourteen years of historical data.
Beta is a mathematician with neural implants connected directly to data streams. She can see probability distributions the way other people see colour. She left QuantumCorp after discovering that her own models were being used for algorithmic district segregation.
Bit is a self-taught programmer from the outskirts, where algorithms assign social scores before people are born. His younger sister Ola was denied treatment by a medical AI that calculated her expected quality-adjusted life years at twelve — too few to justify the cost. She was eight years old.
They work from a squat in District 7. The walls are covered in printouts of regressions, correlation matrices, and confusion tables. The servers are salvaged from corporate landfill.
What this package contains
RougeLM provides the datasets Beta and Bit collected
over twelve months — one case at a time, one subscore at a time — before
they finally saw the full picture.
| Dataset | Chapter | Method | n |
|---|---|---|---|
medical |
Strong Enough / The Shape of Cost | Simple regression, Box-Cox | 96 |
curiosity |
The Same Direction | One-way ANOVA | 1200 |
curiosity_quantum |
The Threshold | Piecewise regression, MED | 1012 |
mobility |
The Crossing | Two-way ANOVA, interaction | 412 |
employment |
The Second Chance | ANCOVA, cream skimming | 431 |
nutrition |
The Outlier | Nested ANOVA, fixed effects | 1066 |
lifecalc |
The Wall | Multiple regression, LASSO, Ridge | 5000 |
The full picture
After twelve months and six cases, Ghost — their data broker, the one who never gives anything for free — sent them the complete LifeCalc dataset. No charge. No explanation. Just a file and one sentence:
Knew you’d get here eventually.
The dataset had 47 variables. After LASSO regularisation, four survived with non-zero coefficients.
library(RougeLM)
library(glmnet)
data(lifecalc)
X <- model.matrix(SocialScore ~ ., data = lifecalc)[, -1]
y <- lifecalc$SocialScore
cv <- cv.glmnet(X, y, alpha = 1, nfolds = 10)
coef(cv, s = "lambda.min")[
coef(cv, s = "lambda.min")[, 1] != 0, , drop = FALSE
]The variable with the largest coefficient — larger than district,
larger than employment, larger than education — was named
prior_flag.
A binary flag. Zero or one. Indicating whether any parent of the resident had ever recorded an EmploymentScore below 25 during the resident’s childhood.
Set before you were born. Permanent. Non-reversible.
Bit checked his own profile in the system.
prior_flag: 1.
Getting started
library(RougeLM)
# The dataset from the first chapter
data(medical)
head(medical)
#> partner_a partner_b health_expenses
#> 1 186 175 1061520.15
#> 2 180 168 464404.09
#> 3 160 154 24794.91
#> 4 186 166 606355.00
#> 5 163 162 75418.89
#> 6 172 152 68719.48
# Correlation between LifeContract partner medical
cor(medical$partner_a, medical$partner_b)
#> [1] 0.7633864
# Simple regression
model <- lm(partner_b ~ partner_a, data = medical)
coef(model)
#> (Intercept) partner_a
#> 41.9301535 0.6996537Each dataset has a vignette. Each vignette has a story. Each story has a number. The number is never just a number.
“We’re poor but we have something most data scientists don’t.”
“What?”
“The ability to look in a mirror without disgust.”