Description Usage Arguments Value Examples
A series of checks, tests, re-ordering, and other operations to prepare the
data for matching. This function can be run standalone, before running
multiMatch
.
1 2 | prepareData(Y, W, X, match_on, trimming = NULL, model_options, M_matches,
J_var_matches)
|
Y |
A response vector (1 x n) |
W |
A treatment vector (1 x n) with numerical values indicating treatment groups |
X |
A covariate matrix (p x n) with no intercept. When match_on="existing", then X must be a vector (1 x n) of user-specified propensity scores. |
match_on |
User specifies "covariates" to match on raw covariates, or "existing" to match on user-supplied propensity score values, or "polr" or "multinom" to fit a propensity score model. |
trimming |
an indicator of whether trimming the sample to ensure overlap |
model_options |
A list of the options to pass to propensity model. Currently under development. Can only pass reference level to multinomial logistic regression. |
M_matches |
Number of matches per unit for imputing potential outcomes, as in Abadie and Imbens (2006). |
J_var_matches |
Number of matches when estimating σ^2(X,W) as in Abadie and Imbens (2006). |
A list of information, including the X, W, Y
arguments after
sorting observeations, and information on unit_ids
, etc.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | sim_data <- multilevelMatching::simulated_data
Y <- sim_data$outcome
W <- sim_data$treatment
X <- as.matrix(sim_data[ ,-(1:2)])
names(Y) <- paste0("ID", 1:length(Y))
trimming <- FALSE
method <- c("covariates", "polr", "multinom")[2]
prepared_data <- prepareData(
Y = Y,
W = W,
X = X,
match_on = "polr",
trimming = FALSE,
model_options = list(reference_level = sort(W)[1]),
M_matches = 3,
J_var_matches = 2
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.