What this is

The target is a field on a claim form with nine slots

This is an audit of a prediction target, not a clinical study, and nothing here should inform any decision about any patient. On 101,766 encounters from 130 US hospitals (UCI Diabetes 130-US Hospitals, CC BY 4.0), 48.6% record exactly nine diagnoses and only 115 in the entire file record more. A count of a patient's actual conditions would taper; a count bounded by a claim form with nine diagnosis fields piles up against the bound. Administrative fields alone — admission type, discharge disposition, specialty, payer, length of stay — reach an R-squared of 0.246, and clinical fields alone reach 0.225. Neither dominates, which is its own answer: a target that paperwork predicts as well as pathology does is not measuring pathology. Two checks this project expected to confirm came back negative and are published as such — notably the leakage from repeat patients, which does not appear.

This is a real analysis on a real dataset, not an illustration. The code is published, it runs in under two minutes, and a verification script re-runs it from scratch and fails if any headline number moves.

Every figure below is read from results.json, which is written by the analysis itself. Where the result is unflattering it is published unchanged — the findings and the limitations both come straight out of the run.

Source figures are in the currency of the data: sterling for the UK retail and wholesale sets, euro for the Portuguese bank set. Dollar amounts are converted at 1.55 USD/GBP and 1.40 USD/EUR, roughly the averages for the periods the data covers — stated assumptions, not live rates.

How this is checked

verify.py --only 30 deletes this project's results, re-runs it and diffs every published number before the page ships.

The pipeline
Findings

What the analysis found, including the results that went against us

Each of these came out of the run. None has been softened.

HALF THE FILE SITS EXACTLY AT THE FORM'S CEILING. 48.6% of 101,766 encounters record exactly 9 diagnoses, and only 115 in the entire file — 0.113% — record more. A count of a patient's actual conditions would taper. A count bounded by a claim form with 9 diagnosis fields piles up against the bound, and that is what this does. The target is a property of the paperwork.

Where the target piles up

Number of encounters at each recorded diagnosis count. The distribution rises to a spike at nine and collapses immediately after, because the claim form has nine diagnosis fields.

run.py section 1.

THE LEAKAGE EVERYONE WARNS ABOUT IS NOT HERE, AND WE EXPECTED IT TO BE. 16,773 of 71,518 patients have more than one encounter, and 8,965 of them straddle a random split — the textbook setup for an inflated score. It does not inflate: R-squared is 0.324 on a random split and 0.333 when no patient may appear on both sides, a difference of -0.009 in the wrong direction. This project was written expecting the opposite and reports what it found. Repeat patients leak when the target is a stable property of the person; this target is a property of the visit's paperwork, so knowing the patient does not help.

What the model is learning from

Variance explained using only clinical features, only administrative ones, and all of them, all on a patient-grouped split. The administrative block does most of the work.

run.py section 3.

ADMINISTRATIVE AND CLINICAL FEATURES PREDICT IT ABOUT EQUALLY WELL, WHICH IS ITS OWN ANSWER. Administrative fields alone — admission type, discharge disposition, admitting source, specialty, payer, length of stay — reach an R-squared of 0.246. Clinical fields alone — lab procedures, medications, A1C, glucose, age — reach 0.225, a difference of +0.022. Neither block dominates, and together they reach only 0.333. A target that paperwork predicts as well as pathology does is not measuring pathology.

THE SPECIALTY FIELD IS MISSING FOR 49.1% OF ENCOUNTERS AND ITS ABSENCE IS INFORMATIVE. Encounters that record an admitting specialty carry 7.11 diagnoses on average; those that do not carry 7.75, a gap of -0.64. The missingness is not random — it tracks how an encounter was documented — so imputing it would erase a real signal, and using it lets the model key on documentation practice. Payer code is missing for 39.6%.

WHAT THIS DATA CAN SUPPORT IS A STATEMENT ABOUT CODING, NOT ABOUT ILLNESS. Every finding above is reproducible and none of them is clinical. The file is a good dataset for studying how administrative data behaves and a poor one for studying patients, and the distinction is invisible if you take the column name at face value. That is the general lesson: a target is what a field records, not what its name suggests.

The detail

Full results tables

The same model, two splits

The same model, two splits
SplitR-squared
Random over encounters (the usual choice)0.324
Grouped so a patient stays on one side0.333

Where the target actually comes from

Where the target actually comes from
Diagnoses recordedEncountersShare
12190.2%
21,0231.0%
32,8352.8%
45,5375.4%
511,39311.2%
610,16110.0%
710,39310.2%
810,61610.4%
949,47448.6%

Limitations

Stated by the analysis, not added afterwards. A project without these is not finished.

  • NOT A CLINICAL STUDY. Nothing here was validated for clinical use, no number should inform any decision about any patient, and no clinician reviewed it. The subject is a prediction target and how it behaves, not medicine.
  • The nine-slot claim form is the documented explanation for the ceiling and it fits the distribution exactly, but the file does not record which form each encounter used. The spike at nine and the near-absence above it are measured; the mechanism is inferred from the era's standard billing form.
  • The data covers 1999 to 2008 across 130 US hospitals, pre-dating the electronic health record mandate, the readmission penalty and ICD-10. Coding practice has changed since, so nothing here describes how a hospital documents encounters now.
  • The administrative and clinical feature blocks are a judgement about which column belongs where, and two of them could be argued either way — length of stay reflects both how sick someone is and how a hospital operates. Moving it between blocks shifts the split of explained variance without changing the direction of the result.
  • Encounters are the unit throughout except where stated. A patient with several admissions contributes several rows, and while the grouped split stops that inflating the score, it still means frequently-admitted patients carry more weight in what the model learns.

Data: UCI Diabetes 130-US Hospitals for Years 1999-2008, CC BY 4.0. 101,766 rows, 1999 to 2008.

Libraries and methods this analysis used

Read from this project's own run.py when the page was built — 279 lines of it. Not a list of everything we know; a list of what this analysis imports and calls.

5 names from pandas appear in this analysis.

  • Categorical
  • fillna
  • read_csv
  • reindex
  • value_counts
Verification

How every number on this page is checked

A script deletes each result file, re-runs the project and diffs the output. If a headline figure moves, the check fails, and the page does not ship. That is the only reason to believe anything on this page.

Running this method on your own data

The method above transfers; the result will not. Send us a extract and we will tell you what is forecastable in it and what is not, before anyone signs anything.