Giter Club home page Giter Club logo

Comments (4)

EdJeeOnGitHub avatar EdJeeOnGitHub commented on June 23, 2024

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.

simondgreenhill avatar simondgreenhill commented on June 23, 2024

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.

EdJeeOnGitHub avatar EdJeeOnGitHub commented on June 23, 2024

Thanks for sharing - this is on my summer to-do list and not forgotten!

from bacondecomp.

simondgreenhill avatar simondgreenhill commented on June 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.