Native greedy nearest-neighbour matching on the logit propensity
score (Rosenbaum & Rubin 1985; caliper per Cochran & Rubin 1973).
The propensity model is base stats::glm; no MatchIt at
runtime. Returns the same morie_match_result shape as
always; cross-validated against MatchIt in tests/cross/.
Usage
morie_matching_nearest_neighbor(
data,
treatment,
covariates,
n_neighbors = 1L,
caliper = NULL,
replace = FALSE,
ps = NULL,
alpha = 0.05
)Arguments
- data
Data frame.
- treatment
Binary treatment column (0/1).
- covariates
Character vector of covariates for the propensity model.
- n_neighbors
Number of matches per treated unit (forwarded as
ratio).- caliper
Maximum logit-propensity distance for a valid match, expressed in SD units of the logit (or
NULLfor no caliper).- replace
If
TRUE, controls may be re-used. The defaultFALSEmatches MatchIt; with fewer controls than treated units it leaves treated units unmatched (a warning says so) and the ATT then describes the matchable subset: passTRUEin that case.NULL(the default) re-uses controls only when there are fewer controls than treated units, where 1:1 matching without replacement would leave treated units unmatched and bias the ATT.NULL(the default) re-uses controls only when there are fewer controls than treated units, where 1:1 matching without replacement would leave treated units unmatched and bias the ATT.- ps
Optional propensity scores. When supplied they REPLACE the fitted model: matching is done on the score you pass, aligned to the rows that survive the NA drop – by name when the vector is named, by position when it is one per retained row. A mis-sized vector is refused rather than recycled.
- alpha
Significance level (carried through to
details).
