| data.prep {rbounds} | R Documentation |
This function reshapes the output from Match() to create the necessary objects for mcontrol()
#Default Method data.prep(obj, Y=NULL, group.size=3)
obj |
An object from the Match() function. |
Y |
Internal argument to the Match object. |
group.size |
The size of the matched groups. Three for one treated unit and two control units. |
This functions takes a Match() object and formats it for use with the mcontrol() function. The output is a list with the three objects needed for the arguments of the mcontrol() function.
Y |
The matched outcomes |
id |
A vector which identifies the matched groups: 1, 1, 1 for matched group one; 2, 2, 2 for match group 2, etc. |
treat |
A vector with 1's for treated units and 0's for control units |
Luke Keele, Ohio State University, keele.4@osu.edu
Rosenbaum, Paul R. (2002) Observational Studies. Springer-Verlag.
See also binarysens, psens, hlsens, Match, mcontrol
#
#Load Matching Software and Data
#
library(Matching)
data(lalonde)
#
# Estimate Propensity Score
#
DWglm <- glm(treat~age + I(age^2) + educ + I(educ^2) + black +
hisp + married + nodegr + re74 + I(re74^2) + re75 + I(re75^2) +
u74 + u75, family=binomial, data=lalonde)
#
#save data objects
#
Y <- lalonde$re78 #the outcome of interest
Tr <- lalonde$treat #the treatment of interest
#
# Match
#
mDW <- Match(Y=Y, Tr=Tr, X=DWglm$fitted, M=2)
#
# One should check balance, but let's skip that step for now.
#
#Create Data Object
tmp <- data.prep(mDW, group.size=3)
#
# Sensitivity Test
#
mcontrol(tmp$Y, tmp$id, tmp$treat, group.size=3)