createEventStudyPlot: Constructs event study plot

View source: R/sensitivityresults.R View source: R/HonestDiD-Temp.R

createEventStudyPlotR Documentation

Constructs event study plot

Description

Constructs event study plot using the estimated event study coefficients and standard errors.

Usage

createEventStudyPlot(betahat, stdErrors = NULL, sigma = NULL,
                     numPrePeriods, numPostPeriods, alpha = 0.05, timeVec,
                     referencePeriod, useRelativeEventTime = FALSE)

Arguments

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.

Value

Returns ggplot object of the event study plot.

Author(s)

Ashesh Rambachan

References

Rambachan, Ashesh and Jonathan Roth. "An Honest Approach to Parallel Trends." 2021.

Examples


  # 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)


asheshrambachan/HonestDiD documentation built on July 15, 2024, 12:56 p.m.