*! version 1.0.0 20Jan2026

Title

arima_forecast - Compute ARIMA forecast standard errors and generate dynamic forecasts

Syntax

arima_forecast
[, options]

An arima model must be estimated prior to running arima_forecast

Forecast Settings
h(#) forecast horizon; default is h(1)

level(#) set confidence level; default is level(95)

Output Options
prefix(string) prefix for forecast variable names

replace replace existing forecast variables and added observations

figure generate forecast plot

twoway_options any available twoway graph options

Description

arima_forecast is a post-estimation command for arima that computes forecast standard errors
for ARIMA models and generates dynamic forecasts with confidence interval using the theoretical variance formula for
ARIMA models, following the approach implemented in R's
predict.Arima
function from the stats package. These standard errors lead to wider (and more realistic) confidence intervals
than those produced in Stata using manual computation with predict ..., mse as standard errors.
arima_forecast optionally generates a forecast plot similar to that produced by the
forecast
package in R.

Options

Forecast Settings

h(#) specifies the forecast horizon, i.e., the number of periods to
forecast. The default is h(1).

level(#); see [R] Estimation options.

Output Options

prefix(string) specifies a prefix for the forecast variable names.
If not specified, variables will be named pred, se, ll#,
and ul# (where # is the confidence level). For example, with
prefix(my) and level(95), variables will be named
mypred, myse, myll95, and myul95.

replace removes any existing forecast variables and observations
from the previous run before generating new forecasts. This option is
useful when you want to update forecasts with different specifications
or correct a previous run.

figure generates a forecast plot showing the original series,
point forecasts, and confidence intervals. The plot is styled to resemble
the forecast
package's (in R) output.

twoway_options are any standard twoway graph options that
can be used to customize the forecast plot when the figure option
is specified.

Remarks

arima_forecast has the following requirements and will produce an error if not followed:

(1) Can only be used after arima estimation.

(2) The ARIMA model must be specified using the arima(p,d,q) syntax.
Models specified using separate ar() and ma() options are
not supported.

(3) For seasonal models, use the sarima(P,D,Q,s) syntax. Do not use
separate sar(), sma(), mar(), or mma() options.

(4) Models with covariates (explanatory variables) are not supported.

(5) Models estimated with if or in qualifiers are not supported.

(6) Models with differencing (d > 0 or D > 0) must be estimated with the
noconstant option, consistent with standard ARIMA theory.

Examples

Setup

. webuse gnp96, clear

. tsset date

Simple ARIMA model with differencing and autoregressive component:

. arima gnp, arima(1,1,0) noconstant

Produce 8 future forecasts and generate figure

. arima_forecast, h(8) figure

Re-run arima_forecast and produce 12 future forecasts figure

. arima_forecast, h(12) figure replace

Setup

. webuse air2, clear

. tsset t

Multiplicative SARIMA model:

. arima air, arima(0,1,1) sarima(0,1,1,12) noconstant

Produce 12 future forecasts and generate figure

. arima_forecast, h(12) fig

Replace existing forecasts and generate new ones:

. arima_forecast, h(12) level(99) replace figure

Saved Results

arima_forecast saves the following results:

Scalars

r(h) forecast horizon

Matrices

r(se) forecast standard error matrix

References

The forecast standard error computation follows established time series
theory as described in:

Box, G. E. P., Jenkins, G. M., Reinsel, G. C., & Ljung, G. M. (2015).
Time Series Analysis: Forecasting and Control (5th ed.).
John Wiley & Sons. [Section 5.2.3: Forecast error variance, pp. 144-146]

Hamilton, J. D. (1994). Time Series Analysis.
Princeton University Press. [Section 4.8: Forecasting, pp. 80-84]

Brockwell, P. J., & Davis, R. A. (2016).
Introduction to Time Series and Forecasting (3rd ed.).
Springer. [Section 3.5: Prediction, pp. 102-106]

The specific implementation follows the algorithm used in R's
predict.Arima
function, which is based on the psi-weight approach described in:

Hyndman, R. J., & Athanasopoulos, G. (2021).
Forecasting: Principles and Practice (3rd ed.).
OTexts. [Section 8.5: Prediction intervals for ARIMA models]

For the special case of ARIMA(3,1,0) and differenced models, the
treatment follows the polynomial expansion method described in:

Ansley, C. F., & Newbold, P. (1980).
Finite sample properties of estimators for autoregressive moving average models.
Journal of Econometrics, 13(2), 159-183.

Citation of arima_forecast

arima_forecast 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. (2026). ARIMA_FORECAST: Stata module to compute ARIMA forecast standard errors and generate dynamic forecasts

Author

Ariel Linden

Linden Consulting Group, LLC

alinden@lindenconsulting.org

Also See

arima, arima postestimation, tsappend