insongkim / PanelMatch

118 stars 36 forks source link

Extracting SEs/CIs from placebo_test #132

Closed antonpeez closed 9 months ago

antonpeez commented 1 year ago

Dear PanelMatch team,

Thank you all again for the terrific work on the package and for the excellent recent work on the placebo_test command in particular. I have two related questions on the command and its output.

  1. Is there a way to extract the CIs displayed in placebo_test plots? Or might there be a way to calculate them manually myself from the placebo_test output (i.e., from [["bootstrapped.estimates"]])? In other words, I am looking for the equivalent of summary(PE.results) (specifically, the SEs; Standard errors computed with 1000 Weighted bootstrap samples), but for placebo_test results. Based on the list item resulting from running placebo_test and if I understand the package documentation correctly, the SEs/CIs do not seem to be contained in the list item.
  2. Once these SEs/CIs are extracted/saved, would it be correct to display them in a single pre-/post-treatment plot along with the post-treatment point estimates and CIs from summary(PE.results)?

Thank you again!

Anton

adamrauh commented 1 year ago

Hi @antonpeez , thanks for using the package!

  1. I'm not sure if this has made its way onto the CRAN version yet, but in the se_comparison branch, you should be able to extract standard errors with something like the following:
    
    PM.results <- PanelMatch(lag = 4, time.id = "year", unit.id = "wbcode2",
                                                  treatment = "dem", refinement.method = "mahalanobis",
                                                  data = dem_small, match.missing = TRUE,
                                                  covs.formula = ~ I(lag(tradewb, 1:4)),
                                                  size.match = 5, qoi = "att",
                                                  outcome.var = "y", lead = 0:4, forbid.treatment.reversal = FALSE,
                                                  placebo.test = TRUE)

pt <- placebo_test(PM.results, data = dem_small, se.method = "unconditional", plot = FALSE)

pt[["standard.errors"]]


There's currently no way to get CIs directly -- we will have to add this in a future update...

2. Yes, I believe so. Making it easier for users to generate this kind of plot is also something we are working on. But, it hasn't been added to the package yet. Sorry about that!
antonpeez commented 9 months ago

Many, many thanks for the very helpful and quick response back in November, @adamrauh, and for all the terrific work on the package. I appreciate it!