Description Usage Arguments Details Value Examples
View source: R/matching_group.r
Given a variable Treat
, matching_group
enumerates the individuals
towards each observation can be matched against. If exact
is specified,
then it performes exact match (see examples).
1 | matching_group(Treat, exact = NULL)
|
Treat |
Integer vector of size n. Group indicator. Can be either -1 (no group), 0 (control) or 1 (treatment). |
exact |
Numeric matrix with n rows. When specified, exact matching is performed on those variables (see |
In the most common case Treat
will be either of 0
or
1
, in which case individuals will be matched against their opposite
group. If Treat == -1
, then the group constraint will be void.
A list of length n specifying for each i to which individuals each j != i will be matched.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # Asigning matching groups for lalonde --------------------------------------
data(lalonde, package = "MatchIt")
dat <- lalonde
# Match (no exact)
m_noexact <- matching_group(dat$treat)
# How many matches?
table(sapply(m_noexact, length))
table(dat$treat)
# What if we ask exact match on black ---------------------------------------
m_exact <- matching_group(dat$treat, dat$black)
table(sapply(m_exact, length))
with(dat, table(treat, black))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.