LOCALTREND Procedure |
@LocalTrend performs a "local smoothing regression", which creates an estimate of a trend using fitted values from a locally weighted regression on constant and linear trend.
@LocalTrend(options) x start end y
Parameters
|
x |
input series |
|
start, end |
range of x to use. By default, the defined range of x. |
|
y |
output series |
Options
SPAN=window width [13]
Width of the moving window for the trend regression (should be odd—it will be rounded up to the nearest odd value if it's even). The wider this is, the "stiffer" is the estimated trend function.
Example
*
* Makridakis et al, Forecasting Methods and Applications, 3rd edition
* Example 3/3 from pp 101-106
*
open data shampoo.dat
calendar(m) 1990
data(format=free,org=columns) 1990:1 1992:12 shampoo
*
@localtrend(span=49) shampoo / curve49
@localtrend(span=19) shampoo / curve19
@localtrend(span=7) shampoo / curve7
*
graph(overlay=dots,ovsame,footer="Very stiff curve") 2
# curve49
# shampoo
graph(overlay=dots,ovsame,footer="Moderately stiff curve") 2
# curve19
# shampoo
graph(overlay=dots,ovsame,footer="Very loose curve") 2
# curve7
# shampoo
Copyright © 2026 Thomas A. Doan