### Code Source: https://github.com/jbryer/TriMatch/blob/master/demo/tutoring.R
library(TriMatch)
## Loading required package: ggplot2
## Loading required package: scales
## Loading required package: reshape2
## Loading required package: ez
library(grid)
data(tutoring)
head(tutoring)
##      treat  Course Grade Gender Ethnicity Military   ESL EdMother EdFather
## 3  Control ENG*201     4 FEMALE     Other    FALSE FALSE        3        6
## 4  Control ENG*201     4 FEMALE     White    FALSE FALSE        5        6
## 11 Control ENG*201     4 FEMALE     White    FALSE FALSE        1        1
## 12 Control ENG*201     4 FEMALE     White    FALSE FALSE        3        5
## 14 Control ENG*201     4 FEMALE     White    FALSE FALSE        2        2
## 16  Treat1 HSC*310     3 FEMALE     White    FALSE FALSE        3        3
##    Age Employment Income Transfer  GPA GradeCode Level  ID
## 3   48          3      9       24 3.00         A Lower 377
## 4   49          3      9       25 2.72         A Lower 882
## 11  53          1      5       39 2.71         A Lower 292
## 12  52          3      5       48 4.00         A Lower 215
## 14  47          1      5       23 3.50         A Lower 252
## 16  53          3      9       63 3.55         B Upper 265
dim(tutoring)
## [1] 1142   17
table(tutoring$treat)
## 
## Control  Treat1  Treat2 
##     918     134      90
summary(tutoring)
##      treat        Course              Grade          Gender    Ethnicity  
##  Control:918   Length:1142        Min.   :0.000   FEMALE:627   Black:211  
##  Treat1 :134   Class :character   1st Qu.:2.000   MALE  :515   Other:193  
##  Treat2 : 90   Mode  :character   Median :4.000                White:738  
##                                   Mean   :2.891                           
##                                   3rd Qu.:4.000                           
##                                   Max.   :4.000                           
##   Military          ESL             EdMother        EdFather    
##  Mode :logical   Mode :logical   Min.   :1.000   Min.   :1.000  
##  FALSE:783       FALSE:1049      1st Qu.:3.000   1st Qu.:3.000  
##  TRUE :359       TRUE :93        Median :3.000   Median :3.000  
##                                  Mean   :3.785   Mean   :3.684  
##                                  3rd Qu.:5.000   3rd Qu.:5.000  
##                                  Max.   :8.000   Max.   :9.000  
##       Age          Employment        Income         Transfer     
##  Min.   :20.00   Min.   :1.000   Min.   :1.000   Min.   :  3.00  
##  1st Qu.:30.00   1st Qu.:3.000   1st Qu.:3.000   1st Qu.: 36.66  
##  Median :37.00   Median :3.000   Median :5.000   Median : 48.31  
##  Mean   :36.92   Mean   :2.667   Mean   :5.059   Mean   : 52.12  
##  3rd Qu.:43.00   3rd Qu.:3.000   3rd Qu.:7.000   3rd Qu.: 65.00  
##  Max.   :65.00   Max.   :3.000   Max.   :9.000   Max.   :126.00  
##       GPA         GradeCode           Level           ID        
##  Min.   :0.000   Length:1142        Lower:988   Min.   :   1.0  
##  1st Qu.:2.890   Class :character   Upper:154   1st Qu.: 286.2  
##  Median :3.215   Mode  :character               Median : 571.5  
##  Mean   :3.166                                  Mean   : 571.5  
##  3rd Qu.:3.518                                  3rd Qu.: 856.8  
##  Max.   :4.000                                  Max.   :1142.0
names(tutoring)
##  [1] "treat"      "Course"     "Grade"      "Gender"     "Ethnicity" 
##  [6] "Military"   "ESL"        "EdMother"   "EdFather"   "Age"       
## [11] "Employment" "Income"     "Transfer"   "GPA"        "GradeCode" 
## [16] "Level"      "ID"
table(tutoring$treat, useNA='ifany')
## 
## Control  Treat1  Treat2 
##     918     134      90
table(tutoring$treat, tutoring$Course, useNA='ifany')
##          
##           ENG*101 ENG*201 HSC*310
##   Control     349     518      51
##   Treat1       22      36      76
##   Treat2       31      32      27
formu <- ~ Gender + Ethnicity + Military + ESL + EdMother + EdFather + Age +
  Employment + Income + Transfer + GPA

# tutoring$Treat1 <- !tutoring$treat == 'Control'
# lr1 <- glm(Treat1 ~ Gender + Ethnicity + Military + ESL + EdMother + EdFather + Age +
#           Employment + Income + Transfer + GPA, data=tutoring, family=binomial)
# summary(lr1)
# lr2 <- stepAIC(lr1)
# summary(lr2)
# formu <- ~ Gender + Employment + Transfer
# multibalance.plot(tutoring.tpsa, cols=all.vars(formu))

# Estimate the propensity scores for the three models
tutoring.tpsa <- trips(tutoring, tutoring$treat, formu)

# Some useful information is saved as attributes.
names(attributes(tutoring.tpsa))
##  [1] "names"     "row.names" "class"     "data"      "nstrata"  
##  [6] "model1"    "model2"    "model3"    "breaks1"   "breaks2"  
## [11] "breaks3"   "groups"
# Prints a combined summary of the three logistic regression models
summary(tutoring.tpsa)
##                Estimate Std. Error z value Pr(>|z|)  m1 Estimate
## (Intercept)    -1.23648    0.83153 -1.4870 1.37e-01     -2.65640
## GenderMALE     -1.07738    0.24282 -4.4370 9.12e-06 *** -0.64908
## EthnicityOther  0.13627    0.33504  0.4067 6.84e-01     -0.52058
## EthnicityWhite  0.10327    0.26757  0.3860 7.00e-01     -0.32678
## MilitaryTRUE   -0.02173    0.27115 -0.0801 9.36e-01     -0.31186
## ESLTRUE        -0.22231    0.41734 -0.5327 5.94e-01      0.34207
## EdMother       -0.02977    0.07361 -0.4045 6.86e-01     -0.09215
## EdFather       -0.02219    0.06504 -0.3411 7.33e-01      0.07603
## Age             0.00137    0.01120  0.1222 9.03e-01      0.01901
## Employment     -0.32900    0.13623 -2.4150 1.57e-02   * -0.29799
## Income          0.02081    0.04470  0.4655 6.42e-01     -0.08417
## Transfer        0.01699    0.00429  3.9635 7.38e-05 ***  0.00501
## GPA            -0.11726    0.19484 -0.6018 5.47e-01      0.37795
##                Std. Error z value Pr(>|z|) m2 Estimate Std. Error z value
## (Intercept)       1.00466  -2.644  0.00819 ** -1.51677    1.39589  -1.087
## GenderMALE        0.27930  -2.324  0.02013  *  0.50639    0.36026   1.406
## EthnicityOther    0.40023  -1.301  0.19336    -0.82650    0.52451  -1.576
## EthnicityWhite    0.29257  -1.117  0.26403    -0.45969    0.38109  -1.206
## MilitaryTRUE      0.33309  -0.936  0.34914    -0.50156    0.43316  -1.158
## ESLTRUE           0.41742   0.819  0.41252     0.99337    0.61273   1.621
## EdMother          0.08912  -1.034  0.30116    -0.04955    0.10803  -0.459
## EdFather          0.07629   0.997  0.31892     0.08704    0.09599   0.907
## Age               0.01286   1.477  0.13954     0.02009    0.01648   1.219
## Employment        0.16192  -1.840  0.06572  .  0.06055    0.20362   0.297
## Income            0.05522  -1.524  0.12742    -0.10214    0.06250  -1.634
## Transfer          0.00512   0.978  0.32804    -0.00763    0.00574  -1.331
## GPA               0.24244   1.559  0.11901     0.40313    0.29259   1.378
##                Pr(>|z|) m3
## (Intercept)       0.277   
## GenderMALE        0.160   
## EthnicityOther    0.115   
## EthnicityWhite    0.228   
## MilitaryTRUE      0.247   
## ESLTRUE           0.105   
## EdMother          0.646   
## EdFather          0.365   
## Age               0.223   
## Employment        0.766   
## Income            0.102   
## Transfer          0.183   
## GPA               0.168
# Triangle plot of the propensity scores
plot(tutoring.tpsa, sample=c(200))

# In the three cases below we will use exact matching on the Course.
# Default maximumTreat
tutoring.matched <- trimatch(tutoring.tpsa, exact=tutoring[,c('Course')]) 
# Caliper matching
tutoring.matched.caliper <- trimatch(tutoring.tpsa, exact=tutoring[,c('Course')], 
                                     method=NULL)
# 2-to-1-to-1 matching
tutoring.matched.2to1 <- trimatch(tutoring.tpsa, exact=tutoring[,c('Course')], 
                                  method=OneToN, M1=2, M2=1)
# 3-to-2-to-1 matching
tutoring.matched.3to2 <- trimatch(tutoring.tpsa, exact=tutoring[,c('Course')], 
                                  method=OneToN, M1=3, M2=2)

# Examine unmatched cases.
summary(unmatched(tutoring.matched))
## 892 (78.1%) of 1142 total data points were not matched.
## Unmatched by treatment:
##     Control      Treat1      Treat2 
## 834 (90.8%)  39 (29.1%)  19 (21.1%)
summary(unmatched(tutoring.matched.caliper))
## 638 (55.9%) of 1142 total data points were not matched.
## Unmatched by treatment:
##     Control      Treat1      Treat2 
## 580 (63.2%)  39 (29.1%)  19 (21.1%)
summary(unmatched(tutoring.matched.2to1))
## 1000 (87.6%) of 1142 total data points were not matched.
## Unmatched by treatment:
##     Control      Treat1      Treat2 
## 870 (94.8%)  97 (72.4%)  33 (36.7%)
summary(unmatched(tutoring.matched.3to2))
## 928 (81.3%) of 1142 total data points were not matched.
## Unmatched by treatment:
##     Control      Treat1      Treat2 
## 831 (90.5%)    75 (56%)  22 (24.4%)
# Examine the differences in standardized propensity scores for each matched triplet.
# The caliper parameter allows us to see how many matched triplets we would loose
# if we reduced the caliper.
# TODO: Currently doesn't work
# distances.plot(tutoring.matched, caliper=.2) 
# distances.plot(tutoring.matched.caliper, caliper=.2) 

# We can overlay matched triplets on the triangle plot
plot(tutoring.matched, rows=c(1), line.alpha=1, draw.segments=TRUE)

##### Checking balance #########################################################
multibalance.plot(tutoring.tpsa) + ggtitle('Covariate Balance Plot')

# Continuous covariate
balance.plot(tutoring.matched, tutoring$Age, label='Age')
## Using propensity scores from model 3 for evaluating balance.
## 
##  Friedman rank sum test
## 
## data:  Covariate and Treatment and ID
## Friedman chi-squared = 11.274, df = 2, p-value = 0.003564
## 
##  Repeated measures ANOVA
## 
##      Effect DFn DFd        F          p p<.05        ges
## 2 Treatment   2 234 3.465795 0.03286147     * 0.01575012

# Discrete covariate
# balance.plot(tutoring.matched, tutoring$Ethnicity)

# Create a grid of figures.
bplots <- balance.plot(tutoring.matched, tutoring[,all.vars(formu)], 
                       legend.position='none', x.axis.labels=c('C','T1','T1'), x.axis.angle=0)
bplots[['Military']] # We can plot one at at time.

summary(bplots) # Create a data frame with the statistical results
##     Covariate   Friedman   Friedman.p Friedman.sig    rmANOVA    rmANOVA.p
## 1      Gender 14.6829268 0.0006481014          ***         NA           NA
## 2   Ethnicity  4.3058824 0.1161420606                      NA           NA
## 3    Military 14.1951220 0.0008271198          ***         NA           NA
## 4         ESL  4.1052632 0.1283965729                      NA           NA
## 5    EdMother  0.3315789 0.8472245785               0.1176035 8.891010e-01
## 6    EdFather  3.2722646 0.1947317486               2.0287005 1.338129e-01
## 7         Age 11.2739130 0.0035636980           **  3.4657949 3.286147e-02
## 8  Employment 10.9559748 0.0041777293           **  6.2756084 2.213700e-03
## 9      Income 18.7673861 0.0000840841          *** 10.9299870 2.897211e-05
## 10   Transfer 10.1115880 0.0063723052           **  2.4261478 9.059687e-02
## 11        GPA  9.5240175 0.0085484206           **  4.1399245 1.710535e-02
##    rmANOVA.sig
## 1         <NA>
## 2         <NA>
## 3         <NA>
## 4         <NA>
## 5             
## 6             
## 7            *
## 8           **
## 9          ***
## 10           .
## 11           *
plot(bplots, cols=3, byrow=FALSE)

#print(bplots, cols=3, byrow=FALSE) # Will call summary and plot

##### Phase II #################################################################
matched.out <- merge(tutoring.matched, tutoring$Grade)
names(matched.out)
##  [1] "Treat1"      "Treat2"      "Control"     "D.m3"        "D.m2"       
##  [6] "D.m1"        "Dtotal"      "Treat1.out"  "Treat2.out"  "Control.out"
head(matched.out)
##   Treat1 Treat2 Control        D.m3        D.m2         D.m1     Dtotal
## 1    368     39     331 0.007053754 0.001788577 1.039322e-02 0.01923555
## 2    158    279     365 0.003373585 0.009530680 1.071188e-02 0.02361614
## 3    899    209     100 0.001929173 0.013633300 9.183572e-03 0.02474604
## 4    692    596    1055 0.023785086 0.010292177 1.862058e-03 0.03593932
## 5    616    209     208 0.020203398 0.016562521 3.168865e-05 0.03679761
## 6     28    852     154 0.007501996 0.014214100 1.776640e-02 0.03948249
##   Treat1.out Treat2.out Control.out
## 1          4          4           0
## 2          4          4           4
## 3          4          3           4
## 4          4          3           4
## 5          4          3           0
## 6          4          4           2
(s1 <- summary(tutoring.matched, tutoring$Grade))
## $PercentMatched
##    Control     Treat1     Treat2 
## 0.09150327 0.70895522 0.78888889 
## 
## $friedman.test
## 
##  Friedman rank sum test
## 
## data:  Outcome and Treatment and ID
## Friedman chi-squared = 27.904, df = 2, p-value = 8.726e-07
## 
## 
## $rmanova
## $rmanova$ANOVA
##      Effect DFn DFd        F            p p<.05       ges
## 2 Treatment   2 234 23.84506 3.758176e-10     * 0.1146819
## 
## $rmanova$`Mauchly's Test for Sphericity`
##      Effect         W            p p<.05
## 2 Treatment 0.7308876 1.268625e-08     *
## 
## $rmanova$`Sphericity Corrections`
##      Effect       GGe        p[GG] p[GG]<.05       HFe        p[HF]
## 2 Treatment 0.7879523 1.755235e-08         * 0.7968732 1.492693e-08
##   p[HF]<.05
## 2         *
## 
## 
## $pairwise.wilcox.test
## 
##  Pairwise comparisons using Wilcoxon signed rank test 
## 
## data:  out$Outcome and out$Treatment 
## 
##             Treat1.out Treat2.out
## Treat2.out  0.031      -         
## Control.out 0.001      9.6e-09   
## 
## P value adjustment method: bonferroni 
## 
## $t.tests
##               Treatments         t  df      p.value sig  mean.diff
## 1  Treat1.out-Treat2.out -2.791302 117 6.132601e-03  ** -0.3220339
## 2 Treat1.out-Control.out  3.817862 117 2.168534e-04 ***  0.7033898
## 3 Treat2.out-Control.out  6.922623 117 2.539540e-10 ***  1.0254237
##       ci.min      ci.max
## 1 -0.5505191 -0.09354868
## 2  0.3385190  1.06826071
## 3  0.7320670  1.31878047
## 
## attr(,"class")
## [1] "trimatch.summary" "list"
(s2 <- summary(tutoring.matched.caliper, tutoring$Grade))
## $PercentMatched
##   Control    Treat1    Treat2 
## 0.3681917 0.7089552 0.7888889 
## 
## $friedman.test
## 
##  Friedman rank sum test
## 
## data:  Outcome and Treatment and ID
## Friedman chi-squared = 113, df = 2, p-value < 2.2e-16
## 
## 
## $rmanova
## $rmanova$ANOVA
##      Effect DFn  DFd        F            p p<.05        ges
## 2 Treatment   2 2002 108.2106 2.374092e-45     * 0.06506132
## 
## $rmanova$`Mauchly's Test for Sphericity`
##      Effect         W            p p<.05
## 2 Treatment 0.8232953 5.995288e-43     *
## 
## $rmanova$`Sphericity Corrections`
##      Effect       GGe        p[GG] p[GG]<.05      HFe        p[HF]
## 2 Treatment 0.8498309 5.513828e-39         * 0.851126 4.858834e-39
##   p[HF]<.05
## 2         *
## 
## 
## $pairwise.wilcox.test
## 
##  Pairwise comparisons using Wilcoxon signed rank test 
## 
## data:  out$Outcome and out$Treatment 
## 
##             Treat1.out Treat2.out
## Treat2.out  1.1e-15    -         
## Control.out 2.1e-09    < 2e-16   
## 
## P value adjustment method: bonferroni 
## 
## $t.tests
##               Treatments         t   df      p.value sig  mean.diff
## 1  Treat1.out-Treat2.out -9.195197 1001 2.113881e-19 *** -0.3922156
## 2 Treat1.out-Control.out  6.232480 1001 6.755148e-10 ***  0.3872255
## 3 Treat2.out-Control.out 14.884958 1001 2.035852e-45 ***  0.7794411
##       ci.min     ci.max
## 1 -0.4759179 -0.3085133
## 2  0.2653051  0.5091460
## 3  0.6766846  0.8821976
## 
## attr(,"class")
## [1] "trimatch.summary" "list"
(s3 <- summary(tutoring.matched.2to1, tutoring$Grade))
## Warning in wilcox.test.default(xi, xj, paired = paired, ...): cannot
## compute exact p-value with ties
## Warning in wilcox.test.default(xi, xj, paired = paired, ...): cannot
## compute exact p-value with zeroes
## Warning in wilcox.test.default(xi, xj, paired = paired, ...): cannot
## compute exact p-value with ties
## Warning in wilcox.test.default(xi, xj, paired = paired, ...): cannot
## compute exact p-value with zeroes
## Warning in wilcox.test.default(xi, xj, paired = paired, ...): cannot
## compute exact p-value with ties
## Warning in wilcox.test.default(xi, xj, paired = paired, ...): cannot
## compute exact p-value with zeroes
## $PercentMatched
##    Control     Treat1     Treat2 
## 0.05228758 0.27611940 0.63333333 
## 
## $friedman.test
## 
##  Friedman rank sum test
## 
## data:  Outcome and Treatment and ID
## Friedman chi-squared = 18.955, df = 2, p-value = 7.654e-05
## 
## 
## $rmanova
## $rmanova$ANOVA
##      Effect DFn DFd        F            p p<.05       ges
## 2 Treatment   2 112 15.54945 1.097932e-06     * 0.1467116
## 
## $rmanova$`Mauchly's Test for Sphericity`
##      Effect         W           p p<.05
## 2 Treatment 0.8085667 0.002898589     *
## 
## $rmanova$`Sphericity Corrections`
##      Effect       GGe       p[GG] p[GG]<.05       HFe        p[HF]
## 2 Treatment 0.8393252 6.02756e-06         * 0.8623044 4.722582e-06
##   p[HF]<.05
## 2         *
## 
## 
## $pairwise.wilcox.test
## 
##  Pairwise comparisons using Wilcoxon signed rank test 
## 
## data:  out$Outcome and out$Treatment 
## 
##             Treat1.out Treat2.out
## Treat2.out  0.2977     -         
## Control.out 0.0071     2.2e-05   
## 
## P value adjustment method: bonferroni 
## 
## $t.tests
##               Treatments         t df      p.value sig  mean.diff
## 1  Treat1.out-Treat2.out -1.730335 56 8.907832e-02   . -0.3157895
## 2 Treat1.out-Control.out  3.379801 56 1.326981e-03  **  0.9122807
## 3 Treat2.out-Control.out  5.450673 56 1.167427e-06 ***  1.2280702
##       ci.min     ci.max
## 1 -0.6813848 0.04980581
## 2  0.3715631 1.45299832
## 3  0.7767277 1.67941268
## 
## attr(,"class")
## [1] "trimatch.summary" "list"
(s4 <- summary(tutoring.matched.3to2, tutoring$Grade))
## $PercentMatched
##    Control     Treat1     Treat2 
## 0.09477124 0.44029851 0.75555556 
## 
## $friedman.test
## 
##  Friedman rank sum test
## 
## data:  Outcome and Treatment and ID
## Friedman chi-squared = 32.271, df = 2, p-value = 9.828e-08
## 
## 
## $rmanova
## $rmanova$ANOVA
##      Effect DFn DFd        F            p p<.05       ges
## 2 Treatment   2 224 25.03567 1.538341e-10     * 0.1176893
## 
## $rmanova$`Mauchly's Test for Sphericity`
##      Effect         W            p p<.05
## 2 Treatment 0.7564572 1.872981e-07     *
## 
## $rmanova$`Sphericity Corrections`
##      Effect       GGe       p[GG] p[GG]<.05       HFe        p[HF]
## 2 Treatment 0.8041541 6.33888e-09         * 0.8140958 5.246814e-09
##   p[HF]<.05
## 2         *
## 
## 
## $pairwise.wilcox.test
## 
##  Pairwise comparisons using Wilcoxon signed rank test 
## 
## data:  out$Outcome and out$Treatment 
## 
##             Treat1.out Treat2.out
## Treat2.out  0.0043     -         
## Control.out 0.0019     4e-09     
## 
## P value adjustment method: bonferroni 
## 
## $t.tests
##               Treatments         t  df      p.value sig  mean.diff
## 1  Treat1.out-Treat2.out -3.311306 112 1.250340e-03  ** -0.4070796
## 2 Treat1.out-Control.out  3.643848 112 4.086158e-04 ***  0.6902655
## 3 Treat2.out-Control.out  7.275262 112 5.046039e-11 ***  1.0973451
##       ci.min     ci.max
## 1 -0.6506622 -0.1634971
## 2  0.3149281  1.0656029
## 3  0.7984901  1.3962002
## 
## attr(,"class")
## [1] "trimatch.summary" "list"
# Loess plot for the optimal matching method
loess3.plot(tutoring.matched, tutoring$Grade, ylab='Grade')
## `geom_smooth()` using method = 'loess'

# Draw lines connecting each matched triplet
loess3.plot(tutoring.matched, tutoring$Grade, ylab='Grade', 
            points.alpha=.5, plot.connections=TRUE)
## `geom_smooth()` using method = 'loess'

# Loess plot for the caliper matching method
loess3.plot(tutoring.matched.caliper, tutoring$Grade, ylab='Grade', 
            points.alpha=.1, method='loess')

# Loess plot for the 2-to-1 matching method
loess3.plot(tutoring.matched.2to1, tutoring$Grade, ylab='Grade', span=.9)
## `geom_smooth()` using method = 'loess'

# Loess plot for the 3-to-2 matching method
loess3.plot(tutoring.matched.3to2, tutoring$Grade, ylab='Grade', span=.9)
## `geom_smooth()` using method = 'loess'

boxdiff.plot(tutoring.matched, tutoring$Grade, 
             ordering=c('Treat2','Treat1','Control')) + 
  ggtitle('Boxplot of Differences: Optimal Matching')

boxdiff.plot(tutoring.matched.caliper, tutoring$Grade, 
             ordering=c('Treat2','Treat1','Control')) +
  ggtitle('Boxplot of Differences: Caliper Matching')

boxdiff.plot(tutoring.matched.2to1, tutoring$Grade, 
             ordering=c('Treat2','Treat1','Control')) +
  ggtitle('Boxplot of Differences: 2-to-1-to-n Matching')

boxdiff.plot(tutoring.matched.3to2, tutoring$Grade, 
             ordering=c('Treat2','Treat1','Control')) +
  ggtitle('Boxplot of Differences: 3-to-2-to-n Matching')

print(print('Optimal'=s1, 'Caliper'=s2, '2-to-1'=s3, '3-to-2'=s4), row.names=FALSE)
##   Method Friedman.chi2   Friedman.p     rmANOVA.F    rmANOVA.p    
##  Optimal      27.90354 8.726175e-07 ***  23.84506 3.758176e-10 ***
##  Caliper     112.99646 2.904890e-25 *** 108.21057 2.374092e-45 ***
##   2-to-1      18.95541 7.653924e-05 ***  15.54945 1.097932e-06 ***
##   3-to-2      32.27083 9.828281e-08 ***  25.03567 1.538341e-10 ***
##### Sensitivity Analysis #####################################################
library(rbounds)
## Loading required package: Matching
## Loading required package: MASS
## ## 
## ##  Matching (Version 4.9-2, Build Date: 2015-12-25)
## ##  See http://sekhon.berkeley.edu/matching for additional documentation.
## ##  Please cite software as:
## ##   Jasjeet S. Sekhon. 2011. ``Multivariate and Propensity Score Matching
## ##   Software with Automated Balance Optimization: The Matching package for R.''
## ##   Journal of Statistical Software, 42(7): 1-52. 
## ##
psens(matched.out$Treat1.out, matched.out$Control.out, Gamma=2, GammaInc=0.1)
## 
##  Rosenbaum Sensitivity Test for Wilcoxon Signed Rank P-Value 
##  
## Unconfounded estimate ....  2e-04 
## 
##  Gamma Lower bound Upper bound
##    1.0       2e-04      0.0002
##    1.1       0e+00      0.0006
##    1.2       0e+00      0.0018
##    1.3       0e+00      0.0043
##    1.4       0e+00      0.0090
##    1.5       0e+00      0.0168
##    1.6       0e+00      0.0287
##    1.7       0e+00      0.0453
##    1.8       0e+00      0.0672
##    1.9       0e+00      0.0944
##    2.0       0e+00      0.1269
## 
##  Note: Gamma is Odds of Differential Assignment To
##  Treatment Due to Unobserved Factors 
## 
psens(matched.out$Treat2.out, matched.out$Control.out, Gamma=2, GammaInc=0.1)
## 
##  Rosenbaum Sensitivity Test for Wilcoxon Signed Rank P-Value 
##  
## Unconfounded estimate ....  0 
## 
##  Gamma Lower bound Upper bound
##    1.0           0       0e+00
##    1.1           0       0e+00
##    1.2           0       0e+00
##    1.3           0       0e+00
##    1.4           0       0e+00
##    1.5           0       0e+00
##    1.6           0       0e+00
##    1.7           0       0e+00
##    1.8           0       1e-04
##    1.9           0       1e-04
##    2.0           0       2e-04
## 
##  Note: Gamma is Odds of Differential Assignment To
##  Treatment Due to Unobserved Factors 
## 
psens(matched.out$Treat1.out, matched.out$Treat2.out, Gamma=2, GammaInc=0.1)
## 
##  Rosenbaum Sensitivity Test for Wilcoxon Signed Rank P-Value 
##  
## Unconfounded estimate ....  0.9949 
## 
##  Gamma Lower bound Upper bound
##    1.0      0.9949      0.9949
##    1.1      0.9871      0.9982
##    1.2      0.9729      0.9994
##    1.3      0.9505      0.9998
##    1.4      0.9188      0.9999
##    1.5      0.8777      1.0000
##    1.6      0.8280      1.0000
##    1.7      0.7713      1.0000
##    1.8      0.7096      1.0000
##    1.9      0.6451      1.0000
##    2.0      0.5798      1.0000
## 
##  Note: Gamma is Odds of Differential Assignment To
##  Treatment Due to Unobserved Factors 
##