*! version 1.0.0 28Mar2026

Title

shwinters_forecast -- Holt-Winters seasonal forecasts with confidence intervals

Syntax

shwinters_forecast varname [if] [in] [, forecast(#)
level(#)
replace
figure
prefix(string)
twowayopts(string)
model_options]

forecast(#) number of periods to forecast; default is forecast(2)

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

replace replace existing forecast variables and added observations

figure display forecast graph

prefix(string) prefix for forecast variable names

twowayopts(string) options to pass to twoway graph

model_options any tssmooth shwinters options

You must tsset your data before using shwinters_forecast; see [TS] tsset.

Description

shwinters_forecast fits a Holt-Winters seasonal model using tssmooth shwinters
and computes analytic confidence intervals for forecasts following the methodology
of Yar & Chatfield (1990) for additive models and Chatfield & Yar (1991) for multiplicative models.

Options

forecast(#) use # periods for the out-of-sample forecast; default is forecast(2).

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

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

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.

twowayopts(string) specifies options to pass to the twoway graph
when the figure option is used. This allows customization of the graph
appearance, such as changing colors, adding titles, modifying legends, etc.

model_options are any options allowed by tssmooth shwinters.

Examples

Setup

. webuse air2, clear

. gen date = m(1949m1) + _n - 1

. format date %tm

. tsset date

Produce forecasts for 12 future periods

. shwinters_forecast air, forecast(12)

Same as above but add graph and specify that the forecasts in memory be replaced

. shwinters_forecast air, forecast(12) fig replace

Same as above but specify an additive seasonal model

. shwinters_forecast air, forecast(12) fig replace additive

Here we show how to deal with data that are not tsset seasonally. In the current data
the time variable t is sequentially numbered. We specify the tssmooth option period(12)
to handle the seasonality

. webuse air2, clear

. tsset t

. shwinters_forecast air, forecast(12) fig replace period(12)

Saved Results

shwinters_forecast saves the following results:

Scalars

r(forecast) forecast horizon

r(cv) coefficient of variation

r(alpha) alpha smoothing parameter

r(beta) beta smoothing parameter

r(gamma) gamma smoothing parameter

r(rmse) root mean squared error

r(is_multiplicative) indicator of whether the model is multiplicative

Matrices

r(results) matrix of forecasts

References

Yar, M. and C. Chatfield. 1990. Prediction intervals for the Holt-Winters
forecasting procedure. International Journal of Forecasting 6(1): 127-137.

Chatfield, C. and M. Yar. 1991. Prediction intervals for multiplicative
Holt-Winters. International Journal of Forecasting 7(1): 31-37.

Citation of shwinters_forecast

shwinters_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). SHWINTERS_FORECAST: Stata module to compute Holt-Winters seasonal forecasts with confidence intervals

Author

Ariel Linden

Linden Consulting Group, LLC

alinden@lindenconsulting.org

Also See

tssmooth shwinters, graph twoway, arima_forecast (if installed)