这是帮助文件 Title
[TS] tssmooth nl -- Nonlinear filter
Syntax
tssmooth nl [type] newvar = exp [if] [in], smoother(smoother[, twice ])[replace]
where smoother is specified as Sm[Sm[...]] and Sm is one of
{1|2|3|4|5|6|7|8|9}[R] 3[R]S[S|R][S|R]... E H
The numbers specified in smoother represent the span of a running mediansmoother. For example, a number 3specifies that each value be replaced by the median of the point and the twoadjacent data values. The letter Hindicates that a Hanning linear smoother, which is a span-3 smoother with binomial weights, beapplied.
The letters E, S, and R are three refinements that can be combined withthe running median and Hanning smoothers. First, the end points of a smooth can be given special treatment. This is specified by the E operator. Second, smoothing by 3, the span-3 running median, tends to produce flat-topped hills andvalleys. The splitting operator, S,"splits" these repeated values, applies the end-point operator tothem, and then "rejoins" the series. Third, it is sometimes useful to repeat an odd-span median smoother or the splitting operator until the smooth nolonger changes. Following a digit or anS with an R specifies this type of repetition.
Finally, the twice operator specifies that after smoothing, the smootherbe reapplied to the resulting rough, and any recovered signal be added back tothe original smooth.
Letters may be specified in lowercase, if preferred. Examples of smoother[, twice] include
3RSSH 3RSSH,twice 4253H 4253H,twice 43RSR2H,twice 3rssh 3rssh,twice 4253h 4253h,twice 43rsr2h,twice
You must tsset your data before using tssmooth nl; see [TS] tsset. exp may contain time-series operators; see tsvarlist.
Menu
Statistics > Time series > Smoothers/univariate forecasters >Nonlinear filter
Description
tssmooth nl uses nonlinear smoothers to identify the underlying trend ina series.
Options
+------+ ----+ Main+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
smooth(smoother[, twice]) is required; it specifies the nonlinearsmoother to be used.
replace replaces newvar if it already exists.
Examples
Setup . webuse sales2
Perform nonlinear smoothing to sales using a median smoother of span 5 . tssmooth nl nl1=sales, smoother(5)
Perform nonlinear smoothing to sales by applying span-3 median smoothertwice, then applying the split operator to repeated values twice, and finallyapplying a Hanning smoother . tssmooth nl nl2=sales, smoother(3RSSH)
Same as above, except after smoothing, reapply the smoother to theresulting rough, and add any recovered signal back to the original smooth . tssmooth nl nl3=sales, smoother(3RSSH, twice)
Stored results
tssmooth nl stores the following in r():
Scalars r(N) number ofobservations
Macros r(method) nl r(smoother) specified smoother r(timevar) time variablespecified in tsset r(panelvar) panel variablespecified in tsset
3RSSH 3RSSH,twice 4253H 4253H,twice 43RSR2H,twice 3rssh 3rssh,twice 4253h 4253h,twice 43rsr2h,twice 这几种smoother分别代表什么含义?如果我要做股票收益的平滑应该选择哪种最好? 之前尝试过用hwinters做非季节性平滑,但处理数据的时候发现有些收益率序列根本就不能用hwinters做非季节平滑,那么如果选择非线性的平滑方法,应该怎么做?
|