createSensitivityResults: Constructs robust confidence intervals for Delta =...

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

createSensitivityResultsR Documentation

Constructs robust confidence intervals for \Delta = \Delta^{SD}(M), \Delta^{SDB}(M) and \Delta^{SDM}(M) for vector of possible M values.

Description

Constructs robust confidence intervals for a choice \Delta = \Delta^{SD}(M), \Delta^{SDB}(M) and \Delta^{SDM}(M) for vector of possible M values. By default, the function constructs robust confidence intervals for \Delta^{SD}(M).

Usage

createSensitivityResults(betahat, sigma,
                         numPrePeriods, numPostPeriods,
                         method = NULL,
                         Mvec = NULL,
                         l_vec = .basisVector(index = 1, size = numPostPeriods),
                         monotonicityDirection = NULL,
                         biasDirection = NULL,
                         alpha = 0.05,
                         parallel = FALSE,
                         seed = 0)

Arguments

betahat

Vector of estimated event study coefficients.

sigma

Covariance matrix of event study coefficients.

numPrePeriods

Number of pre-periods.

numPostPeriods

Number of post-periods.

method

String that specifies the choice of method for constructing robust confidence intervals. This must be one of "FLCI", "Conditional", "C-F" (conditional FLCI hybrid), or "C-LF" (conditional least-favorable hybrid). Default equals NULL and the function automatically sets method based on the recommendations in Rambachan & Roth (2021) depending on the choice of Delta. If Delta = DeltaSD, default selects the FLCI. If Delta = DeltaSDB or DeltaSDM, default delects the conditional FLCI hybrid.

Mvec

Vector of M values for which the user wishes to construct robust confidence intervals. If NULL, the function constructs a grid of length 10 that starts at M = 0 and ends at M equal to the upper bound constructed from the pre-periods using the function DeltaSD_upperBound_Mpre if number of pre-periods > 1 or the standard deviation of the first pre-period coefficient if number of pre-periods = 1. Default equals null.

l_vec

Vector of length numPostPeriods that describes the scalar parameter of interest, theta = l_vec'tau. Default equals to first basis vector, (1, 0, ..., 0)

biasDirection

This must be specified if the user wishes to add an additional bias restriction to \Delta^{SD}(M). If "positive", bias is restricted to be positive, \delta \ge 0. If "negative", bias is restricted to be negative, \delta \le 0. Default equals NULL.

monotonicityDirection

This must be specified if the user wishes to add an additional monotonicity restriction to \Delta^{SD}(M). If "increasing", underlying trend specified to be increasing, \delta_t \ge \delta_{t-1}. If "decreasing", underlying trend specified to be decreasing \delta_t \le \delta_{t-1}. Default equals NULL

alpha

Desired size of the robust confidence sets. Default equals 0.05 (corresponding to 95% confidence interval)

parallel

Logical to indicate whether the user would like to construct the robust confidence intervals in parallel. This uses the Foreach package and doParallel package. Default equals FALSE.

seed

Random seed for internal computations; included for reproducibility.

Value

Returns a dataframe with columns

lb

Lower bound of robust confidence sets.

ub

Upper bound of robust confidence sets.

method

Method for constructing robust confidence sets

Delta

The set Delta that was specified.

M

Values of M associated with each robust confidence set.

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>
  createSensitivityResults(betahat        = BCdata_EventStudy$betahat,
                           sigma          = BCdata_EventStudy$sigma,
                           numPrePeriods  = length(BCdata_EventStudy$prePeriodIndices),
                           numPostPeriods = length(BCdata_EventStudy$postPeriodIndices),
                           alpha          = 0.05)


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