ebenmichael / augsynth

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

Error in X[trt == 0, , drop = F] : (subscript) logical subscript too long #108

Closed iljamackans closed 1 week ago

iljamackans commented 1 week ago

Hello!

I'm facing the following error when I try to run augsynth function

One outcome and one treatment time found. Running single_augsynth. Error in X[trt == 0, , drop = F] : (subscript) logical subscript too long

In my data set total number of units is 7 of which 6 units are control units and 1 unit is treatment unit. Total number of time series is 44 (I have given number to each month from 2021 January to 2024 August). The treatment occurs starting from period 36 till the period 44. I have checked that class of treatment variable (michelin_dummy) is "numeric". There are no other values ​​for the variable except 0 and 1.

My code is following:

augsynth_model_occupancy <- augsynth( occupancy ~ michelin_dummy | conflicts_number + avg_temp + covid_19_deaths_per_10000 + co2_emission_per_10000 + inflation + disasters_dummy, unit = "cid",
time = "period_num",
data = data_2021_2024,
t_int = 36,
fixedeff = TRUE,
scm = TRUE
)

Here one can see that 3rd unit (which is treatment unit) received treatment from period no. 36 to period no. 44.

subset(data_2021_2024, cid == 3 & period_num >= 36)[, c("cid", "period_num", "michelin_dummy")] cid period_num michelin_dummy 124 3 36 1 125 3 37 1 126 3 38 1 127 3 39 1 128 3 40 1 129 3 41 1 130 3 42 1 131 3 43 1 132 3 44 1

Thank you for your help in advance!