compute the Average Treatment Effect on the Treated Conditional on the previous outcome (ATT-CPO)

attcpo(
  formla,
  t,
  tmin1,
  tmin2,
  tname,
  data,
  idname,
  Y0tqteobj,
  h = NULL,
  yseq = NULL,
  yseqlen = 100,
  se = TRUE,
  iters = 100,
  method = "level"
)

Arguments

formla

e.g. y ~ treat

t

the last time period

tmin1

the middle time period

tmin2

the first time period

tname

the name of the column containing time periods in the data

data

a data.frame

idname

the name of the column containing an individual identifier over time

Y0tqteobj

a qte object (from the qte package) containing the the counterfactual distribution of untreated potential outcomes for the treated group

h

optional bandwidth

yseq

optional sequence of y values, default is to use all unique yvalues in the data, though this can increase computation time

yseqlen

optional length of y values to use, aids in automatically generating yseq if desired

se

whether or not to compute standard errors

iters

how many bootstrap iterations to use if computing standard errors; default is 100.

method

should be either "levels" or "rank"; whether to compute the ATT-CPO using based on the levels of Y0tmin1 or the ranks of Y0tmin1; "levels" is the default.

Value

att-cpo

Examples

data(displacements)
cc <- qte::CiC(learn ~ treat,
               t=2011, tmin1=2007, tname="year",
               idname="id", panel=TRUE, data=displacements,
               probs=seq(.05,.95,.01),se=FALSE)
#> Warning: dropping 266 observations that are not in period: 2011, 2007, ...
#> Warning: covariates appear to vary over time...
#>   only conditioning on first period covariates...
#>   this is recommended practice, but worth noting...
cc$F.treated.tmin1 <- ecdf(subset(displacements, year==2007 & treat==1)$learn)
cc$F.treated.tmin2 <- ecdf(subset(displacements, year==2003 & treat==1)$learn)
ac <- attcpo(learn ~ treat, 2011, 2007, 2003, "year", displacements,
        "id", cc, method="rank", yseqlen=10)
#> NULL
ac
#> $y.seq
#>  [1] 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
#> 
#> $attcpo
#>  [1] -0.6139816 -0.5746135 -0.4926910 -0.4654546 -0.4389082 -0.4052153
#>  [7] -0.3382524 -0.2784216 -0.3482870 -0.4197103
#> 
#> $ey1
#>  [1]  9.926265 10.119976 10.215522 10.179855 10.275066 10.353360 10.299730
#>  [8] 10.332749 10.365414 10.394630
#> 
#> $ey0
#>  [1] 10.54025 10.69459 10.70821 10.64531 10.71397 10.75858 10.63798 10.61117
#>  [9] 10.71370 10.81434
#> 
#> $attcpo.se
#>  [1] 0.2434369 0.1783067 0.1521552 0.1391474 0.1617171 0.1723650 0.1799800
#>  [8] 0.1820028 0.2074643 0.3977690
#> 
#> $V
#>               [,1]          [,2]          [,3]          [,4]          [,5]
#>  [1,]  0.059261547  0.0271346702  7.922798e-03 -0.0049010583 -1.065913e-02
#>  [2,]  0.027134670  0.0317932834  1.922095e-02  0.0005911454 -7.678945e-03
#>  [3,]  0.007922798  0.0192209542  2.315120e-02  0.0121502120  6.131054e-05
#>  [4,] -0.004901058  0.0005911454  1.215021e-02  0.0193619973  1.446165e-02
#>  [5,] -0.010659128 -0.0076789447  6.131054e-05  0.0144616515  2.615243e-02
#>  [6,] -0.010391781 -0.0090110230 -5.079483e-03  0.0036000703  1.963714e-02
#>  [7,] -0.012595921 -0.0078279414 -5.928427e-03 -0.0036692683  5.973020e-03
#>  [8,] -0.013583056 -0.0054590911 -5.195060e-03 -0.0059037012 -2.066107e-04
#>  [9,] -0.009568156 -0.0032187790 -4.423962e-03 -0.0051206503 -2.336972e-03
#> [10,] -0.007885109 -0.0008383711 -4.322484e-03 -0.0060123482 -5.358734e-03
#>               [,6]         [,7]          [,8]         [,9]         [,10]
#>  [1,] -0.010391781 -0.012595921 -0.0135830560 -0.009568156 -0.0078851087
#>  [2,] -0.009011023 -0.007827941 -0.0054590911 -0.003218779 -0.0008383711
#>  [3,] -0.005079483 -0.005928427 -0.0051950600 -0.004423962 -0.0043224842
#>  [4,]  0.003600070 -0.003669268 -0.0059037012 -0.005120650 -0.0060123482
#>  [5,]  0.019637138  0.005973020 -0.0002066107 -0.002336972 -0.0053587341
#>  [6,]  0.029709706  0.023154448  0.0110986983  0.001456219 -0.0046638941
#>  [7,]  0.023154448  0.032392816  0.0247329547  0.009074171 -0.0048874575
#>  [8,]  0.011098698  0.024732955  0.0331250224  0.025474571  0.0007723600
#>  [9,]  0.001456219  0.009074171  0.0254745711  0.043041430  0.0434937385
#> [10,] -0.004663894 -0.004887458  0.0007723600  0.043493739  0.1582201895
#> 
#> $Y0tqteobj
#> $qte
#>         5%         6%         7%         8%         9%        10%        11% 
#> -1.5686159 -1.4552872 -1.0986123 -1.0986123 -1.1526795 -1.0498221 -1.0216512 
#>        12%        13%        14%        15%        16%        17%        18% 
#> -0.8556661 -0.7884574 -0.6931472 -0.6998331 -0.7339692 -0.7339692 -0.7308075 
#>        19%        20%        21%        22%        23%        24%        25% 
#> -0.6190392 -0.6380874 -0.5690945 -0.5596158 -0.4989912 -0.4989912 -0.5108256 
#>        26%        27%        28%        29%        30%        31%        32% 
#> -0.4054651 -0.4700036 -0.5596158 -0.5108256 -0.4643056 -0.4198538 -0.4198538 
#>        33%        34%        35%        36%        37%        38%        39% 
#> -0.4198538 -0.3920421 -0.4700036 -0.4426998 -0.3566749 -0.3566749 -0.3566749 
#>        40%        41%        42%        43%        44%        45%        46% 
#> -0.3364722 -0.3364722 -0.3364722 -0.3166696 -0.3036824 -0.2876821 -0.3184537 
#>        47%        48%        49%        50%        51%        52%        53% 
#> -0.3184537 -0.3184537 -0.2876821 -0.2578291 -0.2547750 -0.2513144 -0.2513144 
#>        54%        55%        56%        57%        58%        59%        60% 
#> -0.2513144 -0.2231436 -0.2772108 -0.3934737 -0.3184537 -0.3184537 -0.3184537 
#>        61%        62%        63%        64%        65%        66%        67% 
#> -0.3184537 -0.3184537 -0.3184537 -0.2937611 -0.2696636 -0.2696636 -0.2588616 
#>        68%        69%        70%        71%        72%        73%        74% 
#> -0.2363888 -0.2363888 -0.2363888 -0.2363888 -0.2537805 -0.1788792 -0.1484200 
#>        75%        76%        77%        78%        79%        80%        81% 
#> -0.1484200 -0.1240526 -0.1035407 -0.1358015 -0.1685725 -0.1172792 -0.1780067 
#>        82%        83%        84%        85%        86%        87%        88% 
#> -0.1743534 -0.1664482 -0.1586050 -0.1431008 -0.1431008 -0.2017687 -0.1808412 
#>        89%        90%        91%        92%        93%        94%        95% 
#> -0.1941560 -0.1941560 -0.1177830 -0.1471576 -0.1423162 -0.1823216 -0.1512310 
#> 
#> $ate
#> [1] -0.4458143
#> 
#> $qte.se
#> NULL
#> 
#> $qte.lower
#> NULL
#> 
#> $qte.upper
#> NULL
#> 
#> $ate.se
#> NULL
#> 
#> $ate.lower
#> NULL
#> 
#> $ate.upper
#> NULL
#> 
#> $c
#> NULL
#> 
#> $pscore.reg
#> NULL
#> 
#> $probs
#>  [1] 0.05 0.06 0.07 0.08 0.09 0.10 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19
#> [16] 0.20 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.30 0.31 0.32 0.33 0.34
#> [31] 0.35 0.36 0.37 0.38 0.39 0.40 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49
#> [46] 0.50 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.60 0.61 0.62 0.63 0.64
#> [61] 0.65 0.66 0.67 0.68 0.69 0.70 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79
#> [76] 0.80 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.90 0.91 0.92 0.93 0.94
#> [91] 0.95
#> 
#> $type
#> [1] "On the Treated"
#> 
#> $F.treated.t
#> Empirical CDF 
#> Call: stats::ecdf(treated.t[, yname])
#>  x[1:80] = 7.0031, 7.2442, 7.6009,  ..., 12.044, 12.748
#> 
#> $F.untreated.t
#> Empirical CDF 
#> Call: stats::ecdf(untreated.t[, yname])
#>  x[1:86] = 8.5172, 8.9872, 9.2103,  ...,  12.09, 12.748
#> 
#> $F.treated.t.cf
#> Empirical CDF 
#> Call: ecdf(quantile(untreated.t[, yname], probs = F.untreated.tmin1(treated.tmin1[, 
#>     yname]), type = 1))
#>  x[1:42] = 8.5172, 9.2103, 9.3927,  ..., 12.044, 12.748
#> 
#> $F.treated.tmin1
#> Empirical CDF 
#> Call: ecdf(subset(displacements, year == 2007 & treat == 1)$learn)
#>  x[1:78] = 8.6482, 9.2103, 9.6158,  ..., 11.849, 12.637
#> 
#> $F.treated.tmin2
#> Empirical CDF 
#> Call: ecdf(subset(displacements, year == 2003 & treat == 1)$learn)
#>  x[1:74] = 8.2266, 8.8537, 8.9872,  ..., 11.791, 12.491
#> 
#> $F.treated.change.tmin1
#> NULL
#> 
#> $F.untreated.change.t
#> NULL
#> 
#> $F.untreated.change.tmin1
#> NULL
#> 
#> $F.untreated.tmin1
#> Empirical CDF 
#> Call: stats::ecdf(untreated.tmin1[, yname])
#>  x[1:79] = 7.6962, 9.6158, 9.6803,  ..., 11.938, 12.637
#> 
#> $F.untreated.tmin2
#> NULL
#> 
#> $condQ.treated.t
#> NULL
#> 
#> $condQ.treated.t.cf
#> NULL
#> 
#> $eachIterList
#> NULL
#> 
#> $inffunct
#> NULL
#> 
#> $inffuncu
#> NULL
#> 
#> attr(,"class")
#> [1] "QTE"
#> 
#> attr(,"class")
#> [1] "ATTCPO.OBJ"
ggattcpo(ac)