K-nearest neighbors (kNN) predicts an outcome from the outcomes of the k most similar observations. In causal matching, similarity is measured using propensity scores. section 5.3.4
A causal matching workflow uses kNN to improve on single-patient matches:
- Separate observations into treated and control datasets. section 5.3.4
- Train outcome-prediction models on each group, using propensity score as the feature and outcome O as the target. section 5.3.4
- Choose k as a hyperparameter, using cross-validation rather than relying on one potentially extreme match. section 5.3.4
- Predict counterfactual outcomes across groups, calculate individual treatment effects, and average them to estimate the ATE. section 5.3.4
Treatment-effect matching
For a treated patient with propensity score sᵢ, use the kNN trained on controls to predict the expected untreated outcome at sᵢ. Reverse the process for control patients, then average the resulting treatment effects. section 5.3.4
Table 5.4 Treatment data to be used with kNN, Dt·n_t is the number of patients in the treatment group.
|
O
|
S
|
|---|---|
|
o
1
|
s
1
|
|
…
|
…
|
|
O
n_t
|
s
n_t
|
Inspect the treatment dataset containing outcomes and propensity scores used to train one kNN model. section 5.3.4
Table 5.5 Control data to be used with kNN, Dc·n_c is the number of patients in the control group.
|
O
|
S
|
|---|---|
|
o
1
|
s
1
|
|
…
|
…
|
|
O
n_c
|
s
n_c
|
Inspect the corresponding control dataset used to train the comparison kNN model. section 5.3.4


