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
Error in value[[jvseq[[jjj]]]] : subscript out of bounds #74
Comments
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! |
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 |
Thanks for sharing - this is on my summer to-do list and not forgotten! |
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) |
Have balanced panel as variable dat.
df_bacon <- bacon(outcome ~ order,
data = dat,
id_var = "state_abbrev",
time_var = "date_weekly")
Get:
Error in value[[jvseq[[jjj]]]] : subscript out of bounds
The text was updated successfully, but these errors were encountered: