Stata 15 help for tssmooth hwinters

[TS] tssmooth hwinters -- Holt-Winters nonseasonal smoothing


tssmooth hwinters [type] newvar = exp [if] [in] [, options]

options Description ------------------------------------------------------------------------- Main replace replace newvar if it already exists parms(#a #b) use #a and #b as smoothing parameters samp0(#) use # observations to obtain initial values for recursion s0(#cons #lt) use #cons and #lt as initial values for recursion forecast(#) use # periods for the out-of-sample forecast

Options diff alternative initial-value specification; see Options

Maximization maximize_options control the maximization process; seldom used from(#a #b) use #a and #b as starting values for the parameters ------------------------------------------------------------------------- You must tsset your data before using tssmooth hwinters; [TS] tsset. exp may contain time-series operators; see tsvarlist.


Statistics > Time series > Smoothers/univariate forecasters > Holt-Winters nonseasonal smoothing


tssmooth hwinters is used in smoothing or forecasting a series that can be modeled as a linear trend in which the intercept and the coefficient on time vary over time.


+------+ ----+ Main +-------------------------------------------------------------

replace replaces newvar if it already exists.

parms(#a #b), 0 < #a < 1 and 0 < #b < 1, specifies the parameters. If parms() is not specified, the values are chosen by an iterative process to minimize the in-sample sum-of-squared prediction errors.

If you experience difficulty converging (many iterations and "not concave" messages), try using from() to provide better starting values.

samp0(#) and s0(#cons #lt) specify how the initial values #cons and #lt for the recursion are obtained.

By default, initial values are obtained by fitting a linear regression with a time trend using the first half of the observations in the dataset.

samp0(#) specifies that the first # observations be used in that regression.

s0(#cons #lt) specifies that #cons and #lt be used as initial values.

forecast(#) specifies the number of periods for the out-of-sample prediction; 0 < # < 500. The default is forecast(0), which is equivalent to not performing an out-of-sample forecast.

+---------+ ----+ Options +----------------------------------------------------------

diff specifies that the linear term is obtained by averaging the first difference of exp_t and the intercept is obtained as the difference of exp in the first observation and the mean of D.exp_t.

If the diff option is not specified, a linear regression of exp_t on a constant and t is fit.

+--------------+ ----+ Maximization +-----------------------------------------------------

maximize_options controls the process for solving for the optimal alpha and beta when parms() is not specified.

maximize_options: nodifficult, technique(algorithm_spec), iterate(#), [no]log, trace, gradient, showstep, hessian, showtolerance, tolerance(#), ltolerance(#), nrtolerance(#), and nonrtolerance; see [R] maximize. These options are seldom used.

from(#a #b), 0 < #a < 1 and 0 < #b < 1, specifies starting values from which the optimal values of alpha and beta will be obtained. If from() is not specified, from(.5 .5) is used.


Setup . webuse bsales

Perform Holt-Winters nonseasonal smoothing on sales . tssmooth hwinters hw1=sales

Same as above, but use .7 and .3 as smoothing parameters . tssmooth hwinters hw2=sales, parms(.7 .3)

Same as above, but perform out-of-sample forecast using 3 periods . tssmooth hwinters hw3=sales, parms(.7 .3) forecast(3)

Stored results

tssmooth hwinters stores the following in r():

Scalars r(N) number of observations r(alpha) alpha smoothing parameter r(beta) beta smoothing parameter r(rss) sum-of-squared errors r(prss) penalized sum-of-squared errors, if parms() not specified r(rmse) root mean squared error r(N_pre) number of observations used in calculating starting values r(s2_0) initial value for linear term r(s1_0) initial value for constant term r(linear) final value of linear term r(constant) final value of constant term

Macros r(method) smoothing method r(exp) expression specified r(timevar) time variables specified in tsset r(panelvar) panel variables specified in tsset

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index