-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathstl.3
89 lines (89 loc) · 2.98 KB
/
stl.3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
.SA 0
.PH "'STL'Seasonal-Trend Decomposition'STL'"
.P
PURPOSE
.P
STL decomposes a time series into seasonal and trend components.
It returns the components and robustness weights.
.nf
.P
SYNOPSIS
.P
stl(y, n, np, ns, nt, nl, isdeg, itdeg, ildeg, nsjump, ntjump,
nljump, ni, no, rw, season, trend, work)
integer n, np, ns, nt, nl, isdeg, itdeg, ildeg, nsjump, ntjump,
nljump, ni, no
real y(n), rw(n), season(n), trend(n), work(n+2*np,5)
.fi
.P
ARGUMENTS
.P
.in +8
.ti -8
y input, time series to be decomposed.
.ti -8
n input, number of values in y.
.ti -8
np input, the period of the seasonal component. For example, if the
time series is monthly with a yearly cycle, then np=12.
.ti -8
ns input, length of the seasonal smoother.
The value of ns should be an odd integer greater than or equal to 3;
ns>6 is recommended.
As ns increases
the values of the seasonal component at a given point in the seasonal cycle
(e.g., January values of a monthly series with a yearly cycle)
become smoother.
.ti -8
nt input, length of the trend smoother.
The value of nt should be an odd integer greater than or equal to 3;
a value of nt between 1.5*np and 2*np is recommended.
As nt increases the values of the trend component become smoother.
.ti -8
nl input, length of the low-pass filter.
The value of nl should be an odd integer greater than or equal to 3;
the smallest odd integer greater than or equal to np is recommended.
.ti -8
isdeg input, degree of locally-fitted polynomial in seasonal smoothing.
The value is 0 or 1.
.ti -8
itdeg input, degree of locally-fitted polynomial in trend smoothing.
The value is 0 or 1.
.ti -8
ildeg input, degree of locally-fitted polynomial in low-pass smoothing.
The value is 0 or 1.
.ti -8
nsjump input, skipping value for seasonal smoothing.
The seasonal smoother skips ahead nsjump points and then linearly interpolates in between.
The value of nsjump should be a positive integer;
if nsjump=1, a seasonal smooth is calculated at all n points.
To make the procedure run faster,
a reasonable choice for nsjump is 10%-20% of ns.
.ti -8
ntjump input, skipping value for trend smoothing.
.ti -8
nljump input, skipping value for the low-pass filter.
.ti -8
ni input, number of loops for updating the seasonal and trend components.
The value of ni should be a positive integer.
See the next argument for advice on the choice of ni.
.ti -8
no input, number of iterations of robust fitting.
The value of no should be a nonnegative integer.
If the data are well behaved without outliers,
then robustness iterations are not needed.
In this case set no=0, and set ni=2 to 5
depending on how much security you want that the seasonal-trend looping converges.
If outliers are present then no=3 is a very secure value
unless the outliers are radical,
in which case no=5 or even 10 might be better.
If no>0 then set ni to 1 or 2.
.ti -8
rw output, final robustness weights. All rw are 1 if no=0.
.ti -8
season output, seasonal component.
.ti -8
trend output, trend component.
.ti -8
work workspace of (n+2*np)*5 locations.
.in -8