
Generate outputs from matching and propensity score methods.
Source:R/fct_matches.R
matched.data.RdA 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.dataa 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.dataa dataframe with the matched data ready for analysisdataa dataframe of the original dataformulathe formula used for matchingdistancethe distance used for matchingpropensitya numeric vector of propensity scores in the same order as the original datastratificationa factored vector which has stratified the propensity score into groups (between 5 and 10)wt.ATEa numeric vector of the average treatment effect based on the propensity scorewt.ATTa numeric vector of the average treatment effect on the treated based on the propensity scorewt.Matcheda vector of weights based on how the matching occurredd.mthe 'DenseMatrix' output from theoptmatch::match_on()function used for matchingpairsa dataframe with the row labels for each treated unit and it's matched control with the calculated distance between themtreatmentthe treatment variableorderthe order the matches were conducted inreplacementwas 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")