pretrends: Power calculations and visualization for pre-trends tests

View source: R/pretrends-plot.R

pretrendsR Documentation

Power calculations and visualization for pre-trends tests

Description

Conducts power calculations for test of pre-treatment trends. Provides a plot for visualization, and also analyses of distortions from pre-testing.

Usage

pretrends(
  betahat,
  sigma,
  deltatrue,
  tVec,
  referencePeriod = 0,
  prePeriodIndices = which(tVec < referencePeriod),
  postPeriodIndices = which(tVec > referencePeriod)
)

Arguments

betahat.

The estimated event-plot coefficients

sigma.

The covariance matrix for betahat

deltatrue.

The hypothesized difference in trends.

tVec.

The vector of time periods corresponding with the coefficients in beta

referencePeriod.

(Optional) The omitted pre-treatment reference period normalized to 0. Default is t=0

prePeriodIndices.

(Optional) The indices of beta corresponding with pre-treatment periods. Default is which(tVec<referencePeriod)

postPeriodIndices.

(Optional) The indices of beta corresponding with post-treatment periods. Default is which(tVec > referencePeriod)

Value

df_eventplot. A dataframe with columns t, bethat, deltatrue, se (the SEs of betahat), and meanAfterPretesting (expectation of betahat conditional on no significant pre-period coefficient)

df_power. A dataframe with the power of the pre-test (probability of finding no significant pre-period coefficient under deltatrue), Bayes Factor (ratio of probability of passing pre-test under delta true relative to under parallel trends), and Likelihood Ratio (likelihood of realized betahat under deltatrue relative to under parallel trends).

event_plot. An event plot with betahat, its standard errors, and the hypothesized trend (deltatrue)

event_plot_pretest. The same as event_plot, but with an added series that shows the expected value of betahatconditional on passing the pre-test under deltatrue.


jonathandroth/pretrends documentation built on March 31, 2024, 11:47 a.m.