[TS] tssmooth -- Smooth and forecast univariate time-series data
Syntax
tssmooth smoother [type] newvar = exp [if] [in] [, ...]
Smoother category smoother
-------------------------------------------------------------------------
Moving average ma
Recursive
exponential exponential
double exponential dexponential
nonseasonal Holt-Winters hwinters
seasonal Holt-Winters shwinters
Nonlinear filter nl
-------------------------------------------------------------------------
Description
tssmooth creates new variable newvar and fills it in by passing the
specified expression (usually a variable name) through the requested
smoother.
Example of tssmooth ma
Setup
. webuse sales1
. tsset
Create uniformly weighted moving average of sales by using two lagged
terms, using three forward terms, and including the current observation
in the filter
. tssmooth ma sm1=sales, window(2 1 3)
Example of tssmooth exponential
Setup
. webuse sales1, clear
Perform single-exponential smoothing on sales
. tssmooth exponential double sm2a=sales
Example of tssmooth dexponential
Setup
. webuse sales2, clear
Perform double-exponential smoothing on sales
. tssmooth dexponential double sm2a=sales
Example of tssmooth hwinters
Setup
. webuse bsales, clear
Perform Holt-Winters nonseasonal smoothing on sales
. tssmooth hwinters hw1=sales
Example of tssmooth shwinters
Setup
. webuse turksales, clear
Perform Holt-Winters seasonal smoothing on sales
. tssmooth shwinters shw1=sales
Example of tssmooth nl
Setup
. webuse sales2, clear
Perform nonlinear smoothing on sales using a median smoother of span 5
. tssmooth nl nl1=sales, smoother(5)