This function builds a distance specification where treated units are infinitely far away from control units that share the same level of a given factor variable. This can be useful for ensuring that matched groups come from qualitatively different groups.
A factor across which matches should be allowed.
A logical or binary vector the same length as
exactMatch function provides a way of specifying
a matching problem where only units within a factor level may be
matched. This function provides the reverse scenario: a matching
problem in which only units across factor levels are permitted to
exactMatch, the results of this function will
most often be used as a
within argument to
match_on or another distance specification creation
function to limit the scope of the final distance specification
(i.e., disallowing any match between units with the same value on
the factor variable
A distance specification that encodes the across factor level constraint.
data(nuclearplants) # force entries to be within the same factor: em <- fullmatch(exactMatch(pr ~ pt, data = nuclearplants), data = nuclearplants) table(nuclearplants$pt, em) # force treated and control units to have different values of `pt`: z <- nuclearplants$pr names(z) <- rownames(nuclearplants) aem <- fullmatch(antiExactMatch(nuclearplants$pt, z), data = nuclearplants) table(nuclearplants$pt, aem)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.