'Error in dataprep function of Synth package - treated unit not found in unit.variable

I'm using the Synth package to evaluate the effect of a policy - Synthetic Control. However, when using the dataprep function in R it gives an error:

Error in dataprep(foo = general_data, predictors = c("PROD_PEC", "CONSU_FERT", :

treated unit not found in unit.variable.

Follow all the steps of Abadie's original model.

Example:

dataprep.out <- dataprep(foo = dados_gerais,
  predictors = c("PROD_PEC", "CONSU_FERT", "AGROTOXICO", "TERRAS_AGRICOLAS", 
                 "CARBONO_FLORESTAL", "CHUVAS",  "TEMPERATURA", 
                 "MAO_DE_OBRA", "CAPITAL_HUMANO"),
  predictors.op = "mean",
  time.predictors.prior = 1991:2009,
  special.predictors = list(
    list("VBP_AGRO_CO2_EQ", 1991:2009 , "mean"),
    list("PROD_PEC", seq(1991, 2009, 2), "mean"),
    list("CONSU_FERT", seq(1991, 2009, 2), "mean"),
    list("AGROTOXICO", seq(1991, 2009, 2), "mean"),
    list("TERRAS_AGRICOLAS", seq(1991, 2009, 2), "mean"),
    list("CARBONO_FLORESTAL", seq(1991, 2009, 2), "mean"),
    list("CHUVAS", seq(1991, 2009, 2), "mean"),
    list("TEMPERATURA", seq(1991, 2009, 2), "mean"),
    list("MAO_DE_OBRA", seq(1991, 2009, 2), "mean"),
    list("CAPITAL_HUMANO", seq(1991, 2009, 2), "mean")),
  dependent = "VBP_AGRO_CO2_EQ",
  unit.variable = "ID_PAIS",
  unit.names.variable = "NOME_PAIS",
  time.variable = "ANO",
  treatment.identifier = 19,
  controls.identifier = c(1,2, 4:10),
  time.optimize.ssr = 1991:2009,
  time.plot = 1991:2019)

Here is a useful resource about the Synth package that I used to help guide/troubleshoot: "Synth: An R Package for Synthetic Control Methodsin Comparative Case Studies"

I appreciate if you can help me.

r


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source