3

I am using the did_imputation package in R for the Imputation Estimator from Borusyak, Jaravel, and Spiess (2021). I suspect to have some issues regarding the formatting of my variables, especially with regards to the date variables (of observation and time of treatment). Here is a small sample of my dataset:

data <- data.frame(
  coicop = c("CP01111", "CP01112", "CP01113", "CP01114", "CP01115"),
  date = as.Date(c("2010-02-01", "2010-02-01", "2010-02-01", "2010-02-01", "2010-02-01")),
  YoY_Inflation = c(-0.559, -6.039, 0.191, 0.537, -1.572),
  tname = c("2010-2", "2010-2", "2010-2", "2010-2", "2010-2"),
  gname = c(NA, "2012-1", NA, "2010-1", NA),
  stringsAsFactors = FALSE
)

I have tried the following command:

did_imputation(data = data, yname = "YoY_Inflation", tname = "tname", gname = "gname", idname = "coicop")

Unfortunately, this gives me an error message: "Error in .subset2(x, i, exact = exact): no such index at level 1"

The documentation does not specify in what format the date of treatment and date of observation have to specified. I have tried to use dates, which was not successfull either. I would very much like to preserve the monthly nature of the data. All examples I could find online are based on yearly data, which are formatted as numeric, integer, or double.

Does anybody have experience with this?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.