*! version 0.3.1 20Mar2023

Title

pretrends -- Stata implementation of the pretrends R package

Syntax

Stata version of the pretrends R package, which implements power calculations and visualization for pre-trends tests.

pretrends
,
[options coefplot_options]

At least one of numpre() or pre() and post() are required options to indicate which portion of the vector correspond to the pre and post periods; at least one of slope() or delta() must be specified as well. In addition, power calculations can be done sepparately (computes the slope of a linear trend for which pre-trends tests have a given power level):

pretrends power #.#
,
[options]

Power or Test
b(str) name of coefficient matrix; default is e(b)

vcov(str) name of vcov matrix; default is e(V)

numpreperiods(int) number of pre-treatment periods; rest vector entries are assumed to be post-treatment (required or specify pre()/post())

preperiodindex(numlist) pre-period indices (required or specify numpreperiods())

postperiodindex(numlist) post-period indices (required or specify numpreperiods())

omit omit dropped levels from b and vcov parsing names of b (e.g. omitted variables in regression)

alpha(real) 1 - confidence level; default 0.05

Test Only
slope(real) hypothesized linear trend (can specify undocumented option power() to find slope for given power internally)

deltatrue(str) name of vector with hypothesized trend (specify slope() for linear slope)

matasave(str) save resulting mata object (default: PreTrendsResults)

nocoefplot supress coefficient plot (coefplot package required by default)

colorspec(str) the first color is taken as the color of the event study bars; the second and third are passed to ciopts(lcolor()) for the linear trend and pre/post means.

cached use cached results for coefficient plot

Description

See the online examples for details or refer to the examples below.

Example 1: Slope with power

. tempname beta sigma

. mata {

st_matrix(st_local("beta"), PreTrendsExampleBeta())

st_matrix(st_local("sigma"), PreTrendsExampleSigma())

}

. pretrends power 0.5, numpre(3) b(`beta') v(`sigma')

Example 2: Linear Trend

. pretrends, numpre(3) b(`beta') v(`sigma') slope(`r(slope)')

Example 3: Quadratic Custom Trend

. mata st_matrix("deltatrue", 0.024 * ((-4::3) :- (-1)):^2)

. pretrends, numpre(3) b(`beta') v(`sigma') deltatrue(deltatrue) coefplot

Stored results

pretrends stores the following in r():

Scalars

r(slope) linear slope if one was provided or calculated

r(Power) estimated power (probability that we find a significant pre-trend under hypothesized trend)

r(Bayes) ratio of probability of passing pre-test under hypothesized trend relative to parallel trends (not available with power sub-command)

r(LR) likelihood ratio of observed coefficients under hypothesized trend relative to parallel trends (not available with power sub-command)

Macros

r(mata) name of mata object where results are stored (see below; not available with power sub-command)

Matrices

r(results) collected results (time vector, coef, CI bounds, hypothesized trend, means after testing; not available with power sub-command)

r(deltatrue) hypothesized trend (not available with power sub-command)

The following data are available in r(mata) (default name: PreTrendsResults; not available with power sub-command):

real scalar slope
computed slope (or missing if delta was supplied)

real scalar deltatrue
hypothesized trend (computed or delta if the latter was provided)

real scalar Power
estimated power

real scalar Bayes
bayes factor

real scalar LR
likelihood ratio

real matrix ES
matrix with collected results for event study plots (time
vector, coef, CI bounds, hypothesized trend, means after testing)

References

See the paper by Roth (2022).