
Generate outputs from matching and propensity score methods.
Source:R/fct_matches.R
matched.data.Rd
A function for simulating data
Arguments
- f
a two sided formula containing the treatment variable on the left side and the matching variables on the right
- data
a dataframe of the data that is to be used for matching
- dist
a matching distance, either "Propensity Score" or "Mahalanobis"
- order
a named order of "data", "smallest", "largest", "random" to perform matches and is only relevant if replace = TRUE
"data" just uses the order the data is already in
"smallest" matches by the smallest propensity score first
"largest" matches by the largest propensity score first
"random" matches on a random order every time
- replace
boolean value of whether to replace matched units or not
Details
The output is a list containing the following:
paired.data
a dataframe of the matched pairs of data (prefix t. for treated group and c. for control group) with the calculated distance and order of matchingmatched.data
a dataframe with the matched data ready for analysisdata
a dataframe of the original dataformula
the formula used for matchingdistance
the distance used for matchingpropensity
a numeric vector of propensity scores in the same order as the original datastratification
a factored vector which has stratified the propensity score into groups (between 5 and 10)wt.ATE
a numeric vector of the average treatment effect based on the propensity scorewt.ATT
a numeric vector of the average treatment effect on the treated based on the propensity scorewt.Matched
a vector of weights based on how the matching occurredd.m
the 'DenseMatrix' output from theoptmatch::match_on()
function used for matchingpairs
a dataframe with the row labels for each treated unit and it's matched control with the calculated distance between themtreatment
the treatment variableorder
the order the matches were conducted inreplacement
was replacement used to match, TRUE or FALSE
Examples
#simulate some data
d <- create.sim.data(1,2)
#matching formula
f <- t~X1+X2
#create matched data object
M <- matched.data(f,d,"Propensity Score")