Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The weighted bacon estimation is not equal to the TWFE when the panel data is unbalanced. #83

Closed
lzy318 opened this issue Mar 13, 2023 · 4 comments

Comments

@lzy318
Copy link

lzy318 commented Mar 13, 2023

Hello,

Thanks for writing such a great package. I am using this package to do some diagnostic analysis. However, I find that when the panel data is unbalanced, the weighted bacon 2*2 estimation is not numerically equal to the TWFE estimation. For example, I use

df1 <- bacondecomp::math_reform
sample.use <- sample(c(1:dim(df1)[1]),500,replace = F)
df2 <- df1[sample.use,]
df2_bacon <- bacon(incearn_ln ~ reform_math,
data = df2,
id_var = "state",
time_var = "class")
sum(df2_bacon$estimate*df2_bacon$weight)
feols(incearn_ln ~ reform_math|state+class,data=df2)

The results given by bacon and twfe are different.

@kylebutts
Copy link
Collaborator

Hi Ziyu,

Thanks for the reprex; always helpful for addressing. I'm under the impression that the Bacon decomposition relies on a balanced panel, so I wouldn't say the difference is necessarily an error. That being said, we should probably in the package check for a balanced panel and error otherwise to avoid this confusion

@lzy318
Copy link
Author

lzy318 commented Mar 13, 2023

Thanks a lot for the quick response. Can the conclusion in the original paper apply to the unbalanced case?

@kylebutts
Copy link
Collaborator

While the general issues are still there, namely $D_{it}$ is residualized on unit and time dummies and hence you're doing some sort of average of heterogeneous treatment effects. So in this sense, the conclusions of "Be careful!!" definitely still holds. However, the algebra that produces the nice 2x2 comparisons with analytical weights relies on a balanced dataset.

@lzy318
Copy link
Author

lzy318 commented Mar 13, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants