Function propensity_score_matching
propensity_score_matching.Rd
The propensity_score_matching function matches patients in two cohorts based on their propensity scores to create two balanced cohorts.
Arguments
- scores_df
user defined table with 3 mandatory columns:
patient_id
cohort
propensity_score
- caliper
(optional) - a user-specified caliper for matching; default is 0.10 SD
Value
a table of matched patients with the following columns
patient_id
cohort
(returns whatever value was input)propensity_score
Upon running the propensity_score function, patients are matched based on propensity scores to create a 1:1 ratio between cohorts using:
Nearest neighbor (greedy) without replacement
Default caliper of 0.10 SD or user-defined caliper if entered as an input
Cohorts are randomly shuffled prior to matching
Details
scores
| patient_id | cohort | propensity_score |
|-------------|----------|-------------------|
| 1 | 1 | 0.30 |
| 2 | 1 | 0.55 |
| 3 | 1 | 0.92 |
| 1 | 2 | 0.89 |
| 2 | 2 | 0.74 |
| 3 | 2 | 0.21 |
= propensity_score_matching(scores)
matched
| patient_id | cohort | propensity_score |
|-------------|----------|-------------------|
| 1 | 1 | 0.30 |
| 7 | 2 | 0.30 |
| 2 | 1 | 0.55 |
| 4 | 2 | 0.56 |
| 3 | 1 | 0.92 |
| 1 | 2 | 0.89 |