Skip to contents

Entry point onto morie_boryis; see there for the three-step imputation procedure of Borusyak, Jaravel and Spiess (2024), Theorem 2.

Usage

morie_causdidev(y, D, unit, time, X = NULL, weights = NULL)

Arguments

y

Outcome, long format.

D

Binary 0/1 absorbing treatment, long format.

unit, time

Panel identifiers.

X

Optional time-varying covariates (vector or matrix, one column per covariate), long format.

weights

Target weights: NULL or "equal" (default) averages treated cells equally; "cohort" weights by cohort size; or supply your own per-observation weights. All three routes are available, since the paper's Theorem 2 imputes identically whatever the estimand.

Value

The list returned by morie_boryis.

References

Borusyak, K., Jaravel, X. and Spiess, J. (2024). Revisiting event study designs: robust and efficient estimation. Review of Economic Studies, 91(6), 3253-3285.

Examples

set.seed(1)
nu <- 6; T <- 5
unit <- rep(1:nu, each = T)
time <- rep(1:T, nu)
ft <- rep(c(Inf, Inf, Inf, 4, 4, 3), each = T)
D <- as.integer(time >= ft)
y <- rnorm(nu * T) + D * 1.5
morie_causdidev(y, D, unit, time)
#> $estimate
#> [1] 1.012478
#> 
#> $se
#> [1] 0.6437863
#> 
#> $ci
#> [1] -0.2493203  2.2742757
#> 
#> $tau_it
#>            [,1]        [,2]       [,3]       [,4]        [,5]
#> [1,] -0.7066393 -0.02792423 -0.7649001  1.5813997 -0.08193605
#> [2,] -0.9065197  0.26999573  0.8031875  0.5560344 -0.72269798
#> [3,]  1.5227426  0.26942261 -0.4593651 -2.1374341  0.80463402
#> [4,] -0.3456817 -0.44832042  0.7940022  2.0867774  1.46189490
#> [5,]  0.3205738  0.05235070 -0.3729245 -1.0214509  1.19016388
#> [6,]  0.1155244 -0.11552440  0.3518148  1.2598075  1.75833640
#> 
#> $imputed_y0
#>             [,1]        [,2]        [,3]        [,4]      [,5]
#> [1,]  0.08018553  0.21156755 -0.07072856  0.01388114 0.4114438
#> [2,]  0.08605130  0.21743332 -0.06486279  0.01974691 0.4173096
#> [3,] -0.01096140  0.12042063 -0.16187548 -0.07726578 0.3202969
#> [4,]  0.30074813  0.43213016  0.14983405  0.23444375 0.6320064
#> [5,]  0.59840357  0.72978560  0.44748949  0.53209919 0.9296619
#> [6,] -0.17165314 -0.04027111 -0.32256722 -0.23795752 0.1596052
#> 
#> $weights
#>             [,1]        [,2]        [,3]       [,4]       [,5]
#> [1,]  0.11904762  0.11904762  0.04761905 -0.1428571 -0.1428571
#> [2,]  0.11904762  0.11904762  0.04761905 -0.1428571 -0.1428571
#> [3,]  0.11904762  0.11904762  0.04761905 -0.1428571 -0.1428571
#> [4,] -0.07142857 -0.07142857 -0.14285714  0.1428571  0.1428571
#> [5,] -0.07142857 -0.07142857 -0.14285714  0.1428571  0.1428571
#> [6,] -0.21428571 -0.21428571  0.14285714  0.1428571  0.1428571
#> 
#> $linearity_residual
#> [1] 1.088019e-14
#> 
#> $se_note
#> [1] "clustered on unit using the estimator's exact linear weights; treated cells contribute their deviation from the average effect, which is the conservative choice"
#> 
#> $event
#> $event$`0`
#> [1] 0.4723805
#> 
#> $event$`1`
#> [1] 1.303955
#> 
#> $event$`2`
#> [1] 1.758336
#> 
#> 
#> $cohort_att
#> $cohort_att$`2`
#> [1] 1.12332
#> 
#> $cohort_att$`3`
#> [1] 0.9293463
#> 
#> 
#> $pretrend_by_rel
#> $pretrend_by_rel$`-3`
#> [1] -0.01255397
#> 
#> $pretrend_by_rel$`-2`
#> [1] -0.09348177
#> 
#> $pretrend_by_rel$`-1`
#> [1] 0.1018511
#> 
#> 
#> $pretrend_max_abs
#> [1] 0.1018511
#> 
#> $pretrend_note
#> [1] "the imputation uses EVERY untreated period, so parallel trends is assumed throughout the pre-period, not only just before adoption; these residuals are zero in expectation under that assumption"
#> 
#> $unit_effects
#> [1]  0.11621089  0.12207667  0.02506397  0.33677350  0.63442894 -0.13562777
#> 
#> $period_effects
#> [1] -0.03602537  0.09535666 -0.18693945 -0.10232975  0.29523293
#> 
#> $covariate_coef
#> NULL
#> 
#> $n_treated_cells
#> [1] 7
#> 
#> $n_untreated_cells
#> [1] 23
#> 
#> $n_units
#> [1] 6
#> 
#> $n_periods
#> [1] 5
#> 
#> $no_forbidden_comparisons
#> [1] "no treated observation enters the fit, so an already-treated unit cannot act as a control"
#> 
#> $method
#> [1] "Borusyak-Jaravel-Spiess (2024) imputation estimator"
#>