MG {FLAME} | R Documentation |
Matched Groups
Description
MG
returns the matched groups of the supplied units.
Usage
MG(units, ame_out, multiple = FALSE, id_only = FALSE, index_only)
Arguments
units |
A vector of units whose matched groups are desired. |
ame_out |
An object of class |
multiple |
A logical scalar. If |
id_only |
A logical scalar. If |
index_only |
Defunct. Use 'id_only' instead. |
Details
The units
argument refers to units with respect to
rownames(ame_out$data)
. Typically, this will also correspond to the
indexing of the data (i.e. passing units = 3
will return the matched
group of the 3rd unit in the matching data). However, if a separate holdout
set was not passed to the matching algorithm or if the original matching data
had rownames other than 1:nrow(data)
, then this is not the case.
The multiple
argument toggles whether only a unit's main matched group
(MMG) or all matched groups a unit is part of should be returned. A unit's
MMG contains its highest quality matches (that is, the units with which it
first matched in the sequence of considered covariate sets). If the original
call that generated ame_out
specified replace = FALSE
then
units only are part of one matched group (which is also their MMG) and
multiple
must be set to FALSE
.
Value
A list of length length(units)
, each entry of which corresponds to a
different unit in units
. For matched units, if multiple =
FALSE
, each entry is 1. a data frame containing the treatment and outcome
information of members of the matched group, along with covariates they
were matched on if id_only = FALSE
or 2. a vector of the IDs of
matched units if id_only = TRUE
. If multiple = TRUE
, each
entry of the returned list is a list containing the previously described
information, but with each entry corresponding to a different matched
group. In either case, entries corresponding to unmatched units are
NULL
.
Examples
## Not run:
data <- gen_data()
holdout <- gen_data()
FLAME_out <- FLAME(data = data, holdout = holdout, replace = TRUE)
# Only the main matched group of unit 1
MG(1, FLAME_out, multiple = F)
# All matched groups of unit 1
MG(1, FLAME_out, multiple = T)
## End(Not run)