require(rbounds)data(lalonde, package='Matching')Y<-lalonde$re78#the outcome of interestTr<-lalonde$treat#the treatment of interestattach(lalonde)# The covariates we want to match onX=cbind(age, educ, black, hisp, married, nodegr, u74, u75, re75, re74)# The covariates we want to obtain balance onBalanceMat<-cbind(age, educ, black, hisp, married, nodegr, u74, u75, re75, re74,I(re74*re75))detach(lalonde)set.seed(123)library(Matching)gen1<-GenMatch(Tr=Tr, X=X, BalanceMat=BalanceMat, pop.size=50, data.type.int=FALSE, print=0, replace=FALSE)mgen1<-Match(Y=Y, Tr=Tr, X=X, Weight.matrix=gen1, replace=FALSE)summary(mgen1)#> #> Estimate... 1659.1 #> SE......... 716.65 #> T-stat..... 2.315 #> p.val...... 0.02061 #> #> Original number of observations.............. 445 #> Original number of treated obs............... 185 #> Matched number of observations............... 185 #> Matched number of observations (unweighted). 185
Show the code
rbounds::psens(x =Y[mgen1$index.treated], y =Y[mgen1$index.contro], Gamma =1.5, GammaInc =.1)#> #> Rosenbaum Sensitivity Test for Wilcoxon Signed Rank P-Value #> #> Unconfounded estimate .... 0.0121 #> #> Gamma Lower bound Upper bound#> 1.0 0.0121 0.0121#> 1.1 0.0026 0.0429#> 1.2 0.0005 0.1087#> 1.3 0.0001 0.2149#> 1.4 0.0000 0.3521#> 1.5 0.0000 0.5006#> #> Note: Gamma is Odds of Differential Assignment To#> Treatment Due to Unobserved Factors #>
Show the code
rbounds::hlsens(x =Y[mgen1$index.treated], y =Y[mgen1$index.contro], Gamma =1.5, GammaInc =.1)#> #> Rosenbaum Sensitivity Test for Hodges-Lehmann Point Estimate #> #> Unconfounded estimate .... 1596 #> #> Gamma Lower bound Upper bound#> 1.0 1596.00000 1596.0#> 1.1 1028.10000 1753.6#> 1.2 686.90000 2021.2#> 1.3 411.30000 2340.5#> 1.4 123.40000 2593.1#> 1.5 -0.89996 2865.5#> #> Note: Gamma is Odds of Differential Assignment To#> Treatment Due to Unobserved Factors #>