Skip to contents

Step 1-2 of Borusyak, Jaravel and Spiess (2024), Theorem 2: fit the two-way fixed-effect model on untreated cells only and use it to impute \(Y_{it}(0)\) everywhere.

Usage

morie_impute_untreated(Y, treated, X = NULL, max_iter = 2000L, tol = 1e-13)

Arguments

Y

Balanced outcome matrix, units by periods.

treated

Logical matrix of treated cells.

X

Optional list of covariate matrices, each units by periods.

max_iter, tol

Solver controls.

Value

A list with Y0, alpha (unit effects), lambda (period effects) and beta (covariate coefficients, NULL when X is absent).

References

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

Examples

set.seed(1)
Y <- matrix(rnorm(20), 10, 2)
treated <- matrix(FALSE, 10, 2)
treated[8:10, 2] <- TRUE
morie_impute_untreated(Y, treated)
#> $Y0
#>             [,1]       [,2]
#>  [1,]  0.4557936  0.4295337
#>  [2,]  0.2998732  0.2736133
#>  [3,] -0.7153047 -0.7415645
#>  [4,] -0.2965796 -0.3228395
#>  [5,]  0.7403493  0.7140894
#>  [6,] -0.4195711 -0.4458309
#>  [7,]  0.2487493  0.2224895
#>  [8,]  0.7383247  0.7120648
#>  [9,]  0.5757814  0.5495215
#> [10,] -0.3053884 -0.3316483
#> 
#> $alpha
#>  [1]  0.4449807  0.2890603 -0.7261175 -0.3073925  0.7295364 -0.4303839
#>  [7]  0.2379364  0.7275118  0.5649685 -0.3162013
#> 
#> $lambda
#> [1]  0.01081289 -0.01544699
#> 
#> $beta
#> NULL
#>