Title

power_step -- Power analysis for a step intervention with AR(1) Error

Syntax

power_step,
ntime(#)
trperiod(#)
phi(#)
[ alpha(#) ]

* ntime(#) specify the number of time periods in the series

* trperiod(#) specify the time period when the intervention begins

* phi(#) specify the correlation coefficient between adjacent (autoregressive) error terms

alpha(#) significance level; default is alpha(0.05)

* ntime(), trperiod(), phi() are required.

Description

power_step computes power for an interrupted time series analysis (ITSA) in which the intervention is expected to change the level (step) of
the series (McLeod and Vingilis 2008). The results are computed in terms of the size of the intervention effect in units corresponding to
standard deviations of the pre-intervention series (presented as the scaled intervention parameter δ). The power estimates assume that the intervention
analysis will be performed using an autoregressive moving-average (ARMA) model.

The computations and output of power_step largely mirror those found at https://www.stats.uwo.ca/faculty/aim/2007/OnlinePower/TwoSided.html.
However, there are cases in which the results between the online calculator and power_step slightly differ. This is due to the fact that
Javascript does not naturally compute the cumulative standard distribution function (CDF) and therefore the author uses an approximation. Conversely,
power_step uses normal() to compute the CDF.

Options

ntime(integer) specifies the number of time periods to generate in the series; ntime() is required.

trperiod(integer) specifies the time period when the intervention begins; trperiod() is required.

phi(#) specifies the correlation coefficient between adjacent (autoregressive) error terms.; phi() is required.

alpha(#) sets the significance level of the test. The default is alpha(0.05).

Examples

This example is taken from McLeod and Vingilis (2008). The results show that the probability of detecting a one
standard deviation level change from the pre-intervention is 51%

. power_step , nt(40) trp(20) phi(0.50)

Increasing the lengths of the pre-intervention and post-intervention series to 50 results in a substantial increase
in power. The probability of detecting a one standard deviation change is now 85%

. power_step , nt(100) trp(50) phi(0.50)

Stored results

power_step stores the following in r():

Scalars

r(p0) power at δ = 0

r(p1) power at δ = 0.25

r(p2) power at δ = 0.50

r(p3) power at δ = 0.75

r(p4) power at δ = 1.0

r(p5) power at δ = 1.25

r(p6) power at δ = 1.50

r(p7) power at δ = 1.75

r(p8) power at δ = 2.0

r(p9) power at δ = 2.25

r(p10) power at δ = 2.50

r(p11) power at δ = 2.75

r(p12) power at δ = 3.0

References

McLeod, A. I. and E. R. Vingilis. 2008.
Power computations in time series analyses for traffic safety interventions.
Accident Analysis & Prevention.
40: 1244-1248.

Citation of power_step

power_step is not an official Stata command. It is a free contribution
to the research community, like a paper. Please cite it as such:

Linden A. (2025). POWER_STEP: Stata module to compute power for a step intervention with AR(1) Error.

Author

Ariel Linden

Linden Consulting Group, LLC

alinden@lindenconsulting.org

Help: arima