xuyiqing / fect

fixed effect counterfactual estimators
Other
57 stars 20 forks source link

How to specific placebo.period? Gives NA when inputting an interval? #45

Open MatthieuStigler opened 1 month ago

MatthieuStigler commented 1 month ago

Could you please give an example of how to specify the placebo.period argument? The help file says:

two-element numeric vector specifying the range of pre-treatment period

But using for example placebo.period = -c(3,6) will return an object with att.placebo=NAN?

Also, could you elaborate on what happens when one uses say placebo.period = -3? Is the model estimated without the year corresponding to -3?

Thanks!

reprex

library(fect)
#> Registered S3 method overwritten by 'GGally':
#>   method from   
#>   +.gg   ggplot2
data(fect)

out_3 <- fect(Y ~ D + X1 + X2, data = simdata1, 
            index = c("id","time"), force = "two-way",
            parallel = FALSE, placeboTest=TRUE, placebo.period = -3) 

out_3_6 <- fect(Y ~ D + X1 + X2, data = simdata1, 
            index = c("id","time"), force = "two-way",
            parallel = FALSE, placeboTest=TRUE, placebo.period = -c(3,6)) 

out_3$placebo.period
#> [1] -3
out_3$att.placebo
#> [1] 0.9009807

out_3_6$placebo.period
#> [1] -3 -6
out_3_6$att.placebo
#> [1] NaN

Created on 2024-10-15 with reprex v2.1.1