Comments (4)
Hi,
Are you able to create a reprex or add some example data?
It's hard to debug without some more information as a whole host of things could cause indexing issues.
Thanks!
from bacondecomp.
I ran into the same error, and after some debugging realized it was because I had mis-specified my formula (I was regressing my outcome on the treatment variable, rather than on the interaction of treatment and post). Perhaps @notanastronomer had a similar issue?
In my case the problem was purely user error, but perhaps it would be possible to include a more informative error message. The code was erroring out in the create_treatment_groups
function, specifically on this line. The problem was that the two_by_twos
dataframe was empty since I had fed in a variable that had no variation in the treatment time. One possible fix to the problem I encountered (again, not sure if this is the same as OP's), is to just check that two_by_twos
has positive length and throw an (informative) error if not.
from bacondecomp.
Thanks for sharing - this is on my summer to-do list and not forgotten!
from bacondecomp.
Hi Ed,
Sounds good--here's a quick reprex illustrating the issue I was having in case helpful. Thanks for creating and maintaining this cool package!
library(bacondecomp)
# set up some fake data
fake_data = expand.grid(treat = c(0, 1), post=c(0, 1))
fake_data$id = rep(c(1, 2), 2)
n = nrow(fake_data)
fake_data$outcome = rnorm(n)
fake_data$treat_post = fake_data$treat * fake_data$post
# this errors
bacon(outcome ~ treat, data=fake_data, id_var='id', time_var='post')
#> Error in value[[jvseq[[jjj]]]]: subscript out of bounds
# this runs
bacon(outcome ~ treat_post, data=fake_data, id_var='id', time_var='post')
#> type weight avg_est
#> 1 Treated vs Untreated 1 -2.75051
#> treated untreated estimate weight type
#> 2 1 99999 -2.750506 1 Treated vs Untreated
Created on 2021-04-30 by the reprex package (v2.0.0)
from bacondecomp.
Related Issues (20)
- Calculate beta_hat_within HOT 1
- Calculate skl's (new weights)
- Calculate new beta_2x2s
- General modularization
- Unpack formula terms properly
- Flexibility in formula
- Testing HOT 6
- Add tests for summary function HOT 1
- "Unbalanced Panel" when groups are different sizes HOT 13
- Does not work when time variable is date? Error in as.Date.numeric(value): 'origin' must be supplied HOT 3
- Is it possible to use interacted FE? HOT 3
- Change data doesn't work HOT 2
- Speeding up linear regression HOT 1
- "Unbalanced panel" in panel data HOT 1
- The only variable 'treated' is collinear with the fixed effects. HOT 11
- The weighted bacon estimation is not equal to the TWFE when the panel data is unbalanced. HOT 4
- Dependent variable is a constant error, when it is not. HOT 5
- bacondecomp / unbalanced panel HOT 2
- Weighted regression HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bacondecomp.