Last updated:
0 purchases
opmatch 1.0.1
The package provides the following matching methods:
optimal match
one-to-one match
one-to-many match
variable ratio match
full match (not implemented yet)
greedy match
not implemented yet
All matching methods support covariate and propensity score matching.
To obtain matches you can simply run:
from opmatch.matcher import Matcher
case_control_dict = Matcher(
df, matching_ratio,
min_mr, max_mr, n_controls,
metric, matching_type,
case_col, var_cols, ps_col,
).match()
Parameters
matching_ratio number of controls per case if matching ratio is constant
min_mr: minimum number of controls per case
max_mr: maximum number of controls per case
n_controls: number of controls to match
metric: PS or one of the metrics accepted by scipy.spatial.distances.cdist
matching_type: constant or variable matching ratio
case_col: boolean column where cases are 1s and controls 0s
var_cols: columns containing relevatn patient variables
if metric!=PS: var_cols used for matching
if metric==PS but ps_col is not specified: var_cols used to compute PS using logistic regression
ps_col: column containing the propensity score
case_col: column name of case column, should contain 1s and 0s
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.