createSensitivityPlot: Constructs sensitivity plot for Delta = Delta^{SD}(M),...

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

createSensitivityPlotR Documentation

Constructs sensitivity plot for \Delta = \Delta^{SD}(M), \Delta^{SDB}(M) and \Delta^{SDM}(M)

Description

This function constructs sensitivity plots that examine how the robust confidence sets change as the parameter M varies for \Delta = \Delta^{SD}(M), \Delta^{SDB}(M) and \Delta^{SDM}(M). Similar plots are constructed in Section 6 of Rambachan & Roth (2021).

Usage

createSensitivityPlot(robustResults, originalResults,
                      rescaleFactor = 1, maxM = Inf, add_xAxis = TRUE)

Arguments

robustResults

Dataframe that contains the upper/lower bounds of robust confidence sets for each choice of M. Contains columns: method – Method of constructing robust confidence set (e.g., "FLCI"), lb – Lower bound of robust confidence set, ub – Upper bound of robust confidence set, M – M values associated with each robust confidence set.

originalResults

Dataframe that contains the original confidence set for the parameter of interest. Contains columns: method – Method of constructing confidence set (e.g., "Original"), lb – Lower bound of confidence set, ub – Upper bound of confidence set.

rescaleFactor

Scalar that is used to rescale the user specified choices of M and the upper/lower bounds of the confidence sets. Default equals one.

maxM

Scalar that specifies the maximum M value to plot in the sensitivity plot. Default equals infinity (no truncation).

add_xAxis

Logical specifying whether to plot the x-axis in the sensitivity plot. Default equals TRUE.

Value

Returns ggplot object of the sensitivity 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>
  robustResults <-
    createSensitivityResults(betahat        = BCdata_EventStudy$betahat,
                             sigma          = BCdata_EventStudy$sigma,
                             numPrePeriods  = length(BCdata_EventStudy$prePeriodIndices),
                             numPostPeriods = length(BCdata_EventStudy$postPeriodIndices),
                             alpha          = 0.05)
  originalResults <-
    constructOriginalCS(betahat        = BCdata_EventStudy$betahat,
                        sigma          = BCdata_EventStudy$sigma,
                        numPrePeriods  = length(BCdata_EventStudy$prePeriodIndices),
                        numPostPeriods = length(BCdata_EventStudy$postPeriodIndices),
                        alpha          = 0.05)
  createSensitivityPlot(robustResults, originalResults)


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