View source: R/sensitivityresults.R View source: R/HonestDiD-Temp.R
createEventStudyPlot | R Documentation |
Constructs event study plot using the estimated event study coefficients and standard errors.
createEventStudyPlot(betahat, stdErrors = NULL, sigma = NULL,
numPrePeriods, numPostPeriods, alpha = 0.05, timeVec,
referencePeriod, useRelativeEventTime = FALSE)
betahat |
Vector of estimated event study coefficients. |
stdErrors |
Vector of standard errors associated with the estimated event study coefficients. Default equals NULL. Either stdErrors or sigma must be specified by the user. If stdErrors is not specified but sigma is, the stdErrors are set to equal the square root of the diagonal elements of sigma. |
sigma |
Covariance matrix of event study coefficients. Default equals NULL. Either stdErrors or sigma must be specified by the user. |
numPrePeriods |
Number of pre-periods. |
numPostPeriods |
Number of post-periods. |
alpha |
Desired size of confidence intervals. Default = 0.05. |
timeVec |
Vector that contains the time periods associated with the event study coefficients. This vector should not include the reference period that is normalized to zero. |
referencePeriod |
Scalar that contains the time period associated with the reference period. |
useRelativeEventTime |
Logical that specifies whether user would like the plot to be in relative event time (normalizes the reference period to be zero). Default equals FALSE. |
Returns ggplot object of the event study plot.
Ashesh Rambachan
Rambachan, Ashesh and Jonathan Roth. "An Honest Approach to Parallel Trends." 2021.
# Simple use case; for more detailed examples,
# see <https://github.com/asheshrambachan/HonestDiD#honestdid>
createEventStudyPlot(betahat = BCdata_EventStudy$betahat,
sigma = BCdata_EventStudy$sigma,
numPrePeriods = length(BCdata_EventStudy$prePeriodIndices),
numPostPeriods = length(BCdata_EventStudy$postPeriodIndices),
alpha = 0.05,
timeVec = BCdata_EventStudy$timeVec,
referencePeriod = BCdata_EventStudy$referencePeriod)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.