-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
First, thank you for the great work with the package and adopting feols. Really useful!
I am trying to use the bacon function but I keep getting the error that the dependent variable is a constant, when it is not:
bacon(n_tot ~ tt, data = panel[panel$random==1,],
+ id_var = "id_grid",
+ time_var = "period",
+ quietly = TRUE)
Error in fixest::feols(outcome ~ treated | time + id, data = data1) :
The dependent variable is a constant. The estimation with fixed-effects cannot be done.
I assume it has to do with the fact that I have lots of zeros, but around 5% are non-zeros:
quantile(panel[panel$random==1,]$n_tot,seq(0.95,1,0.01))
95% 96% 97% 98% 99% 100%
0.0000000 0.9677419 0.9677419 1.0000000 1.0714286 8.7096774
It seems to be a bacon function error since it runs smoothly when I use feols directly:
feols(as.formula("n_tot ~ tt | id_grid + period"), data=panel[panel$random==1,])
OLS estimation, Dep. Var.: n_tot
Observations: 457,125
Fixed-effects: id_grid: 6,625, period: 69
Standard-errors: Clustered (id_grid)
Estimate Std. Error t value Pr(>|t|)
tt -0.003755 0.002513 -1.49411 0.13519
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
RMSE: 0.250655 Adj. R2: 0.20454
Within R2: 1.141e-5
- Is there a way to feed the feols result directly into the bacon function?
- Why does that error keep coming up? How to handle it?
Thank you!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels