ebenmichael / augsynth

Augmented Synthetic Control Method
MIT License
148 stars 52 forks source link

A problem with augsynth() command #47

Closed julinka14 closed 3 years ago

julinka14 commented 3 years ago

Hello,

thank you for all the great work on this package. I ran into a issue with a command augsynth() and I have no luck solving it. When I try to run:

asyn <- augsynth(Master_data_df_balanced$gdppc ~ Master_data_df_balanced$treated, Master_data_df_balanced$country_no, Master_data_df_balanced$year, 2014, Master_data_df_balanced)

I am getting error message:

Error in UseMethod("group_by") : no applicable method for 'group_by' applied to an object of class "c('double', 'numeric')"

Frankly, I do not understand where the problem lies. This is how my dataframe looks like: image

I am still learning how to work with R and I am sorry if this is trivial question. Any suggestions are appreciated. Thank you!

ebenmichael commented 3 years ago

Thanks for using the package!

I think the issue is that you're directly inputting the columns of the data frame with data$column. Instead you can just use the column names directly like in the vignette and then it should work.

So it should be

asyn <- augsynth(gdppc ~ treated, country_no, year, 2014, Master_data_df_balanced)

julinka14 commented 3 years ago

Thank you very much for your quick answer. I tried your suggestion, but I got the same error message. I tried to google it again with no luck. Then I tried to run similar command but with function single_augsynth() :

asyn <- single_augsynth(gdppc ~ treated, country_no, year, 2014, Master_data_df_balanced, progfunc="None")

I do not know why, but this solution worked for me!

ebenmichael commented 3 years ago

Ok glad it's working with single_augsynth, although it shouldn't be any different! Is there only one treated unit or are there multiple treated units with simultaneous adoption? That'll help me track down if there's a bug.