xuyiqing / gsynth

Generalized Synthetic Control Method
Other
131 stars 40 forks source link

Error in synth.core (object 'r.cv' not found) #57

Open munshimdrasel opened 3 years ago

munshimdrasel commented 3 years ago

Hy,

I'm getting the following error while running gsynth package.

Error in synth.core(Y = Y, X = X, D = D, I = I, W = W, r = r, r.end = r.end, : object 'r.cv' not found In addition: Warning messages: 1: In min(T0) : no non-missing arguments to min; returning Inf 2: In min(T0.ub) : no non-missing arguments to min; returning Inf 3: In min(T0.ub) : no non-missing arguments to min; returning Inf 4: In min(T0) : no non-missing arguments to min; returning Inf 5: In matrix(est.co$xi, TT, Ntr, byrow = FALSE) : data length exceeds size of matrix

I'm using following datasets (showing first 6 lines):

      ID NOx..tons. HEAT.INPUT SUM_OP_TIME   time inputed

1: 10017-002 9.508 280816.9 744.00 201605 0 2: 10017-002 27.296 412025.3 744.00 201808 0 3: 10017-002 10.696 253168.6 743.98 201508 0 4: 10017-002 24.366 392890.2 720.00 201606 0 5: 10017-002 28.349 339108.0 720.00 202009 1 6: 10017-002 34.954 373253.5 744.00 201905 0

out <- gsynth(NOx..tons. ~ inputed+ HEAT.INPUT + SUM_OP_TIME, data=ampd_sy_va3, index = c("ID","time"), force = "two-way", CV = TRUE, r = c(0, 5), se = TRUE, inference = "parametric", nboots = 1000, parallel = FALSE)

Can you please let me know how to resolve this?

xuyiqing commented 3 years ago

Hi are you using the most up-to-date version from Github? If yes, could you check your data by plotting using the panelView package?

On Fri, Mar 12, 2021 at 5:22 AM Munshi Md Rasel @.***> wrote:

Hy,

I'm getting the following error while running gsynth package.

Error in synth.core(Y = Y, X = X, D = D, I = I, W = W, r = r, r.end = r.end, : object 'r.cv' not found In addition: Warning messages: 1: In min(T0) : no non-missing arguments to min; returning Inf 2: In min(T0.ub) : no non-missing arguments to min; returning Inf 3: In min(T0.ub) : no non-missing arguments to min; returning Inf 4: In min(T0) : no non-missing arguments to min; returning Inf 5: In matrix(est.co$xi, TT, Ntr, byrow = FALSE) : data length exceeds size of matrix

I'm using following datasets (showing first 6 lines):

  ID NOx..tons. HEAT.INPUT SUM_OP_TIME   time inputed

1: 10017-002 9.508 280816.9 744.00 201605 0 2: 10017-002 27.296 412025.3 744.00 201808 0 3: 10017-002 10.696 253168.6 743.98 201508 0 4: 10017-002 24.366 392890.2 720.00 201606 0 5: 10017-002 28.349 339108.0 720.00 202009 1 6: 10017-002 34.954 373253.5 744.00 201905 0

out <- gsynth(NOx..tons. ~ inputed+ HEAT.INPUT + SUM_OP_TIME, data=ampd_sy_va3, index = c("ID","time"), force = "two-way", CV = TRUE, r = c(0, 5), se = TRUE, inference = "parametric", nboots = 1000, parallel = FALSE)

Can you please let me know how to resolve this?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/xuyiqing/gsynth/issues/57, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2PKGBHQTUKFVHQLMDSQILTDIBPRANCNFSM4ZCI4TVA .

munshimdrasel commented 3 years ago

Hello Professor,

I'm using the version from Github. After looking into my data using panelView I'm seeing there are missing data in my datasets. image

In such case what should I do? Do I need to remove missing data?

Regards, Rasel

liulch commented 3 years ago

Perhaps the problem may be that for post-treatment periods, you only have observations for treated units (which cannot be used for fitting the model)?