insongkim / PanelMatch

118 stars 36 forks source link

Panel Estimate and Graph #115

Closed suyone closed 1 year ago

suyone commented 1 year ago

Hi, thank you for creating this package! When I do a summary of my PanelEstimate results, I get ATT for only t+0 when my lag=2. I dropped missing observations in the dependent variable, but I still do not get the ATT for t+1 and t+2. How can I fix this problem? Also, in the graph attached, I wanted to clarify what the black bars on the left side are. My guess is that it is the id, but I hope to check if that is right.

The codes and data I used are as follows:

library(haven) data <- as.data.frame(read_dta("data.dta")) data$year <- as.integer(data$year) data$id <- as.integer(data$id) library(PanelMatch) DisplayTreatment(unit.id = "id", time.id = "year", legend.position = "none", xlab= "year", ylab = "id", treatment = "treatment", data = data) PM.results <- PanelMatch(lag = 2, time.id = "year", unit.id = "id", treatment = "treatment", refinement.method = "none", data = data, match.missing = TRUE, qoi = "att", outcome.var = "y", lead = 0, forbid.treatment.reversal = FALSE) PE.results <- PanelEstimate (sets = PM.results, data = data) summary(PE.results) Matches created with 2 lags

Standard errors computed with 1000 Weighted bootstrap samples

Estimate of Average Treatment Effect on the Treated (ATT) by Period: $summary estimate std.error 2.5% 97.5% t+0 -0.04706432 0.167289 -0.3620742 0.2883987

$lag [1] 2

$iterations [1] 1000

$qoi [1] "att"

str(data) 'data.frame': 44210 obs. of 4 variables: $ id : int 1 2 3 4 5 6 7 8 10 11 ... $ year : int 2016 2016 2016 2016 2016 2016 2016 2016 2016 2016 ... $ y : num 1.38 3.67 1 4.24 3.29 ... ..- attr(, "format.stata")= chr "%9.0g" $ treatment: num 0 0 0 0 0 0 0 0 0 0 ... ..- attr(, "format.stata")= chr "%9.0g"

Rplot01_0124 data.csv

adamrauh commented 1 year ago

Hi @suyone -- take a look at the "lead" parameter. I think you may need to adjust that. And yes! the data on the left of the graph are the IDs. There are a few built in parameters to the DisplayTreatment function you might want to use to make the plot more readable (hide.y.axis.label and dense.plot, for instance).

Let us know if you have other questions.