Description Usage Arguments Details Value Author(s) Examples
Extra fullmatch info
1 | match_info(data, tr, cl, id = NULL, trv = 1, keep = NULL, warn = TRUE)
|
data |
the data |
tr |
the binary treatment variable, as character |
cl |
the clustering variable, as character |
id |
the id variable (optional), as character. If this is used then only the relevant variables (+ those specified by 'keep') will be returned (in the same order as data). |
trv |
the value of the treatment (of variable |
keep |
character vector of the names of variables you'd like
to keep (if id is not |
warn |
warn in case of emergency? |
Some additional details I find useful in connection with a fullmatch (or similar matching)
data frame (tbl_df
) with new parameters tr_n
the number of
treated within the cluster, ctrl_n
the number of
controls within the cluster, ate.weight
the weight for
calculating the average treatment effect, att.weight
the weight for calculating the average treatment effect for
the treated, atc.weight
the weight for calculating the
average treatment effect for the controls,
cid
for describing the match it is useful to have a
'cluster id', use this with e.g. dplyr::group_by(tr, cid)
and
summarise
with functions using weight =
cl.weight
to get stats for weighted treated and control statistics.
Henrik Renlund
1 2 3 4 5 6 7 8 9 10 11 | df <- data.frame(
id = 1:13,
foo = c(0,0,1, 0,1, 1,1,0, 1,1,0,0, 0),
bar = c(rep(c(letters[1:4]), c(3,2,3,4)), NA),
x = round(runif(13),2)
)
mi <- match_info(data = df, tr = "foo", cl = "bar")
attributes(mi)
match_info(data = df, tr = "foo", cl = "bar", id = "id")
df$foo <- ifelse(df$foo == 1, "Treated", "Control")
match_info(data = df, tr = "foo", cl = "bar", trv = "Treated")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.