M.J.
M.J.

Reputation: 1

Problem with dataframe in tidysynth: synthetic_control() does not take time unit accordingly

I am trying to implement a synthetic control with the tidysynth package. I am using monthly data, ranging from January 1987 to Decembe 2002. The dataframe is in the long format and contains 14 units, each of which has data from 01-1987 to 12-2002.

data.frame':    2688 obs. of  7 variables:
 $ district     : int  1 1 1 1 1 1 1 1 1 1 ...
 $ district_name: chr  "401-Braunau" "401-Braunau" "401-Braunau" "401-Braunau" ...
 $ month        : Date, format: "1987-01-01" "1987-02-01" ...
 $ unemployment : num  2274 2062 1744 1370 1224 ...
 $ population   : num  91463 91463 91463 91463 91463 ...
 $ education    : num  157 115 87 81 59 47 34 25 66 83 ...
 $ employed     : num  NA NA NA NA NA NA NA NA NA NA ...


# Implement

d_tot %>% glimpse()

d_tot_out <- d_tot %>%
  
synthetic_control(outcome = unemployment, # outcome
                  unit = district_name, # unit index in the panel data
                  time = month, # time index in the panel data
                  i_unit = "415-Steyr", # unit where the intervention occurred
                  i_time = as.Date(1995-01-01), # time period when the intervention occurred
                  generate_placebos=FALSE # generate placebo synthetic controls (for inference)
  )

However, when implementing the synthetic_control() function, it does not define the time.unit properly, as the intervention date is shown as
1975-06-17. Can anyone tell me how to handle monthly data within the tidysynth package?

I tried to convert it to date format.

Upvotes: 0

Views: 31

Answers (0)

Related Questions