View source: R/matching_interop.R
| as_matchit | R Documentation |
Constructs a matchit-class S3 object from a couplr result, enabling
use with any function that accepts MatchIt objects (e.g.,
cobalt, marginaleffects).
as_matchit(
result,
left,
right,
formula = NULL,
left_id = "id",
right_id = "id",
estimand = NULL,
...
)
result |
A couplr result object (matching_result, full_matching_result, cem_result, or subclass_result) |
left |
Data frame of left (treated) units |
right |
Data frame of right (control) units |
formula |
Optional formula used for matching. If not provided, a
default formula is constructed from |
left_id |
Name of ID column in left (default: |
right_id |
Name of ID column in right (default: |
estimand |
Target estimand stamped on the matchit object: one of
|
... |
Additional arguments (ignored) |
An S3 object of class "matchit" with fields:
Match matrix (treated x controls)
Named treatment vector (1/0)
Matching weights
Covariate matrix
Original call
Metadata from couplr
## Not run:
left <- data.frame(id = 1:5, age = c(25, 35, 45, 55, 65))
right <- data.frame(id = 6:15, age = runif(10, 20, 70))
result <- match_couples(left, right, vars = "age")
mi <- as_matchit(result, left, right)
# Now use with cobalt:
cobalt::bal.tab(mi)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.