Skip to main content

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

Metadata

Release files for opmatch 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opmatch 1.0.1
File Size Uploaded
opmatch-1.0.1.tar.gz 7.7 kB Details

Release files / opmatch-1.0.1.tar.gz

Download URL opmatch-1.0.1.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
72005b27353a6135c143b221f97747b94d295bd3b654753cace51aba2a39d6ab
BLAKE2b-256 checksum
How to use checksums
42ce2eb8f9975ff1ce4c18440eccb272edf70b75353a642ef5086771f112f061
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.8

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page