xuyiqing / gsynth

Generalized Synthetic Control Method
Other
132 stars 40 forks source link

Factor-variables as Indices lead to subscript out of bounds error #13

Open inkrement opened 6 years ago

inkrement commented 6 years ago

Seems like there is some out-of-bounds issue, when someone uses a factor variable as index (in my case converting channel_id and yearweek to chars/integers resolved the issue).

> reg.sub <- gsynth(log(subscribers + 0.001) ~ step_dummy,
+                          data = gsynth_panel1, index = c("channel_id","yearweek"),
 force = "two-way",
+                          CV = T, se = T, inference = "parametric", nboots = 1000, parallel = T)
Error in `[<-`(`*tmp*`, c(data[, ob]), 1, value = 1) : 
  subscript out of bounds