Skip to content
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 occurred at simulating error step #43

Open
di-yuan-88 opened this issue Jun 25, 2020 · 4 comments
Open

error occurred at simulating error step #43

di-yuan-88 opened this issue Jun 25, 2020 · 4 comments

Comments

@di-yuan-88
Copy link

Hi,
We ran into the following error with some of our gsynth model:
Simulating errors ...Error in { : task 602 failed - "'data' must be of a vector type, was 'NULL'"

In our study, we have lots of treated units with varying treatment timing. So we just tried to run gsynth on the entire dataset and a subset only with treated units at a certain period. The error only occurs when using the subset (the 2nd model in the sample code).

I also attached the sample data & code to reproduce the error. The code:

test1 <- readRDS("tmpdata/testdata.RDS")

out1 <- gsynth(dv1 ~ treatment + covar1 + covar2 + covar3 + covar4 + covar5 + covar6, data = test1, index = c("id", "TimePeriod"), na.rm = TRUE, force = "two-way", CV = TRUE, r = c(0,5), se = TRUE, inference = "nonparametric", min.T0 = 7, seed = 1, nboots = 1000, parallel = TRUE, cores = 4)

test2 <- test1 %>% group_by(id) %>% mutate(check = sum(treatment)) %>% ungroup() %>% filter(check == 7 | check == 0) %>% select(-check)

out2 <- gsynth(dv1 ~ treatment + covar1 + covar2 + covar3 + covar4 + covar5 + covar6, data = test2, index = c("id", "TimePeriod"), na.rm = TRUE, force = "two-way", CV = TRUE, r = c(0,5), se = TRUE, inference = "parametric", min.T0 = 7, seed = 1, nboots = 1000, parallel = TRUE, cores = 4)

I found the error seems to be related to a particular covariate and random number generator: when I remove "covar6" from the model, the error disappears, and also I ran multiple times, sometimes it went through...

Also, I'm on PC Windows 10 with R version is 4.0.0. and gsynth 1.0.9

Many thanks!

Dee

testdata.zip

@xuyiqing
Copy link
Owner

xuyiqing commented Jun 25, 2020 via email

@di-yuan-88
Copy link
Author

Hi Professor,

Thanks for your prompt reply! Here is the sample data & code:
error-rep.zip

We did use the 'id' option when plotting individual unit's "actual vs. synthetic control trajectory", but the results (the trajectory of synthetic control) of some units are not the same from the 1st & 2nd model in the attached code.

Thanks!
Dee

@lzy318
Copy link
Collaborator

lzy318 commented Jun 26, 2020

Hi Dee,
Could you try the latest version of gsynth (version 1.1.6), it seems that this problem has been fixed in the latest version.

@di-yuan-88
Copy link
Author

Hi, just download the latest version, and it works now.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants