Skip to contents

Compute subclassification ATT and ATE

Usage

subclassify(df, x, y = "re78", w = "treat", debug = F)

Arguments

df

data.table

x

character vector of discrete covariates

y

outcome

w

treatment

debug

boolean to return strata-specific estimates

Value

list with ATE and ATT estimate in est and strata level averages in table

Examples

data(lalonde.psid); setDT(lalonde.psid)
subclassify(lalonde.psid,
  x = c("u74", "u75"),
  y = "re78", w = "treat"
)
#> $est
#>         ATE       ATT
#> 1 -15157.89 -4286.105
#> 
#> $table
#> Key: <u74, u75>
#>      u74   u75 grpmean_0 grpmean_1   N_0   N_1        DiM   N_k
#>    <num> <num>     <num>     <num> <int> <int>      <num> <int>
#> 1:     0     0 23366.499  5487.466  2188    52 -17879.032  2240
#> 2:     0     1 11523.244  4440.835    87     2  -7082.409    89
#> 3:     1     0 22497.160 10514.686    53    22 -11982.474    75
#> 4:     1     1  2151.187  5954.485   162   109   3803.298   271
#> 
subclassify(lalonde.psid,
  x = c("married", "black", "hispanic", "u74", "u75"),
  y = "re78", w = "treat"
)
#> $est
#>   ATE ATT
#> 1  NA  NA
#> 
#> $table
#> Key: <married, black, hispanic, u74, u75>
#>     married black hispanic   u74   u75  grpmean_0 grpmean_1   N_0   N_1
#>       <num> <num>    <num> <num> <num>      <num>     <num> <int> <int>
#>  1:       0     0        0     0     0 21328.9403  9823.470   170     3
#>  2:       0     0        0     0     1 13616.4292        NA     9    NA
#>  3:       0     0        0     1     0 14161.5464  9900.017     6     3
#>  4:       0     0        0     1     1   901.4132  7017.448    10     9
#>  5:       0     0        1     0     0 11821.8125  2709.584     3     3
#>  6:       0     0        1     0     1  8275.2686        NA     1    NA
#>  7:       0     0        1     1     0  3657.3733  5112.010     1     1
#>  8:       0     0        1     1     1     0.0000 11359.417     1     4
#>  9:       0     1        0     0     0 13003.9556  4206.355   116    33
#> 10:       0     1        0     0     1  4786.3565  8881.670     5     1
#> 11:       0     1        0     1     0  3960.3071 12512.077     2    12
#> 12:       0     1        0     1     1   984.8227  5236.514     9    81
#> 13:       1     0        0     0     0 26213.5951     0.000  1387     1
#> 14:       1     0        0     0     1 10265.8871        NA    49    NA
#> 15:       1     0        0     1     0 25904.1864  4232.310    41     1
#> 16:       1     0        0     1     1  2585.7861 12418.100   113     1
#> 17:       1     0        1     0     0 23948.4061  8440.630    64     2
#> 18:       1     0        1     0     1 29923.9629        NA     4    NA
#> 19:       1     0        1     1     1  1266.6228  2787.960     7     1
#> 20:       1     1        0     0     0 18002.4567  9205.812   448    10
#> 21:       1     1        0     0     1 11844.3673     0.000    19     1
#> 22:       1     1        0     1     0 11243.5292  8426.758     3     5
#> 23:       1     1        0     1     1  1343.3878  7775.420    22    13
#>     married black hispanic   u74   u75  grpmean_0 grpmean_1   N_0   N_1
#>            DiM   N_k
#>          <num> <int>
#>  1: -11505.470   173
#>  2:         NA    NA
#>  3:  -4261.530     9
#>  4:   6116.035    19
#>  5:  -9112.228     6
#>  6:         NA    NA
#>  7:   1454.637     2
#>  8:  11359.417     5
#>  9:  -8797.601   149
#> 10:   4095.314     6
#> 11:   8551.770    14
#> 12:   4251.692    90
#> 13: -26213.595  1388
#> 14:         NA    NA
#> 15: -21671.876    42
#> 16:   9832.314   114
#> 17: -15507.776    66
#> 18:         NA    NA
#> 19:   1521.337     8
#> 20:  -8796.645   458
#> 21: -11844.367    20
#> 22:  -2816.771     8
#> 23:   6432.032    35
#>            DiM   N_k
#>