Generates balance statistics for mimids and wimids objects from MatchThem.

# S3 method for mimids
bal.tab(x, 
        stats,
        int = FALSE,
        poly = 1,
        distance = NULL,
        addl = NULL,
        data = NULL,
        continuous,
        binary,
        s.d.denom,
        thresholds = NULL,
        weights = NULL,
        cluster = NULL,
        pairwise = TRUE,
        s.weights = NULL,
        abs = FALSE,
        subset = NULL,
        quick = TRUE,
        ...)

Arguments

x

a mimids or wimids object; the output of a call to MatchThem::matchthem() or MatchThem::weightthem().

stats, int, poly, addl, data, continuous, binary, thresholds, weights, cluster, pairwise, s.weights, abs, subset, quick, ...

see bal.tab() for details.

See below for special notes on the distance, s.d.denom, and imp arguments. Note the imp argument is ignored because the imputation identifers are already present in the input object.

The following arguments have special notes when used with mimids and wimids objects:

distance

the distance measure generated by matchthem() or weightthem() is automatically included and named "distance" or "prop.score", respectively.

s.d.denom

the defaults depend on the options specified in the original function calls; see bal.tab.matchit() and bal.tab.weightit() for details on the defaults.

Details

bal.tab.mimids() and bal.tab.wimids() generate a list of balance summaries for the mimids or wimids object given.

Value

If clusters are not specified, an object of class "bal.tab.imp" containing balance summaries for each imputation and a summary of balance across imputations. See bal.tab.imp for details.

If clusters are specified, an object of class "bal.tab.imp.cluster" containing summaries between and across all clusters and imputations.

Author

Noah Greifer

See also

bal.tab() for details of calculations.

bal.tab.matchit() and bal.tab.weightit()

Examples

library(mice)
#> 
#> Attaching package: ‘mice’
#> The following object is masked from ‘package:stats’:
#> 
#>     filter
#> The following objects are masked from ‘package:base’:
#> 
#>     cbind, rbind
library(MatchThem)
#> 
#> Attaching package: ‘MatchThem’
#> The following objects are masked from ‘package:mice’:
#> 
#>     cbind, pool
#> The following object is masked from ‘package:base’:
#> 
#>     cbind

data("lalonde_mis", package = "cobalt")

#Imputing the missing data
imp <- mice(lalonde_mis, m = 5)
#> 
#>  iter imp variable
#>   1   1  married  re74  re75
#>   1   2  married  re74  re75
#>   1   3  married  re74  re75
#>   1   4  married  re74  re75
#>   1   5  married  re74  re75
#>   2   1  married  re74  re75
#>   2   2  married  re74  re75
#>   2   3  married  re74  re75
#>   2   4  married  re74  re75
#>   2   5  married  re74  re75
#>   3   1  married  re74  re75
#>   3   2  married  re74  re75
#>   3   3  married  re74  re75
#>   3   4  married  re74  re75
#>   3   5  married  re74  re75
#>   4   1  married  re74  re75
#>   4   2  married  re74  re75
#>   4   3  married  re74  re75
#>   4   4  married  re74  re75
#>   4   5  married  re74  re75
#>   5   1  married  re74  re75
#>   5   2  married  re74  re75
#>   5   3  married  re74  re75
#>   5   4  married  re74  re75
#>   5   5  married  re74  re75

#Matching using within-imputation propensity scores
mt.out1 <- matchthem(treat ~ age + educ + race + 
                       married + nodegree + re74 + re75, 
                       data = imp, approach = "within")
#> 
#> Matching Observations  | dataset: #1
#>  #2
#>  #3
#>  #4
#>  #5
#> 
bal.tab(mt.out1)
#> Balance summary across all imputations
#>                 Type Min.Diff.Adj Mean.Diff.Adj Max.Diff.Adj
#> distance    Distance       0.9666        0.9697       0.9713
#> age          Contin.       0.0008        0.0391       0.0589
#> educ         Contin.      -0.1452       -0.1151      -0.0538
#> race_black    Binary       0.3730        0.3730       0.3730
#> race_hispan   Binary      -0.1730       -0.1654      -0.1568
#> race_white    Binary      -0.2162       -0.2076      -0.2000
#> married       Binary      -0.0108       -0.0054       0.0000
#> nodegree      Binary       0.0432        0.0681       0.0865
#> re74         Contin.      -0.0829       -0.0622      -0.0218
#> re75         Contin.      -0.0801       -0.0445      -0.0254
#> 
#> Average sample sizes across imputations
#>           Control Treated
#> All           429     185
#> Matched       185     185
#> Unmatched     244       0

#Matching using across-imputation average propensity scores
mt.out2 <- matchthem(treat ~ age + educ + race + 
                       married + nodegree + re74 + re75, 
                       data = imp, approach = "across")
#> Estimating distances   | dataset: #1
#>  #2
#>  #3
#>  #4
#>  #5
#> 
#> Matching Observations  | dataset: #1
#>  #2
#>  #3
#>  #4
#>  #5
#> 
                       
bal.tab(mt.out2)
#> Balance summary across all imputations
#>                 Type Min.Diff.Adj Mean.Diff.Adj Max.Diff.Adj
#> distance    Distance       0.9745        0.9745       0.9745
#> age          Contin.       0.0665        0.0665       0.0665
#> educ         Contin.      -0.1264       -0.1264      -0.1264
#> race_black    Binary       0.3730        0.3730       0.3730
#> race_hispan   Binary      -0.1676       -0.1676      -0.1676
#> race_white    Binary      -0.2054       -0.2054      -0.2054
#> married       Binary      -0.0216       -0.0151      -0.0108
#> nodegree      Binary       0.0595        0.0595       0.0595
#> re74         Contin.      -0.1128       -0.0734      -0.0305
#> re75         Contin.      -0.0586       -0.0466      -0.0286
#> 
#> Average sample sizes across imputations
#>           Control Treated
#> All           429     185
#> Matched       185     185
#> Unmatched     244       0

#Weighting using within-imputation propensity scores
wt.out <- weightthem(treat ~ age + educ + race + 
                       married + nodegree + re74 + re75, 
                       data = imp, approach = "within",
                       estimand = "ATT")
#> Estimating weights     | dataset: #1
#>  #2
#>  #3
#>  #4
#>  #5
#> 
                       
bal.tab(wt.out)
#> Balance summary across all imputations
#>                 Type Min.Diff.Adj Mean.Diff.Adj Max.Diff.Adj
#> prop.score  Distance      -0.0337       -0.0328      -0.0300
#> age          Contin.       0.0874        0.0958       0.1109
#> educ         Contin.      -0.0480       -0.0344      -0.0274
#> race_black    Binary      -0.0033       -0.0032      -0.0031
#> race_hispan   Binary       0.0004        0.0005       0.0008
#> race_white    Binary       0.0025        0.0027       0.0028
#> married       Binary       0.0164        0.0208       0.0250
#> nodegree      Binary       0.0152        0.0177       0.0216
#> re74         Contin.      -0.0115        0.0124       0.0259
#> re75         Contin.      -0.0060        0.0017       0.0116
#> 
#> Average effective sample sizes across imputations
#>            Control Treated
#> Unadjusted   429.      185
#> Adjusted     100.5     185