📄 tssmooth_ma.hlp
字号:
{smcl}
{* 07mar2005}{...}
{cmd:help tssmooth ma}{right:dialog: {bf:{dialog tssmooth_ma:tssmooth ma}}}
{hline}
{title:Title}
{p2colset 5 25 27 2}{...}
{p2col :{hi:[TS] tssmooth ma} {hline 2}}Moving-average filter{p_end}
{p2colreset}{...}
{title:Syntax}
{phang}
Moving average with uniform weights
{p 8 23 2}
{cmd:tssmooth} {cmd:ma} {dtype} {newvar} {cmd:=} {it:{help exp}} {ifin}{cmd:,}
{opt w:indow}{cmd:(}{it:#l}[{it:#c}[{it:#f}]]{cmd:)} [{cmd:replace}]
{phang}
Moving average with specified weights
{p 8 23 2}
{cmd:tssmooth} {cmd:ma} {dtype} {newvar} {cmd:=} {it:{help exp}} {ifin}{cmd:,}
{opt we:ights}{cmd:(}[{it:numlist_l}] {cmd:<}{it:#c}{cmd:>} [{it:numlist_f}]{cmd:)} [{cmd:replace}]
{p 4 6 2}You must {helpb tsset} your data before using
{cmd:tssmooth ma}.{p_end}
{p 4 6 2}{it:{help exp}} may contain time-series operators; see
{help tsvarlist}.{p_end}
{title:Description}
{pstd}
{cmd:tssmooth ma} creates a new series in which each observation is an average
of nearby observations in the original series.
{pstd}
In the first syntax, {cmd:window()} is required and specifies the span of the
filter. {cmd:tssmooth ma} constructs a uniformly weighted moving average of
the expression.
{pstd}
In the second syntax, {cmd:weights()} is required and specifies the weights to
be used. {cmd:tssmooth ma} then applies the specified weights to construct a
weighted moving average of the expression.
{title:Options}
{phang}
{cmd:window(}{it:#l}[{it:#c}[{it:#f}]]{cmd:)} describes the span of the
uniformly weighted moving average.
{pmore}
{it:#l} specifies the number of lagged terms to be included,
{bind:0 {ul:<} {it:#l} {ul:<} one-half} the number of observations in the
sample.
{pmore}
{it:#c} is optional and specifies whether to include the current observation
in the filter. 0 indicates exclusion and 1, inclusion. The current
observation is excluded by default.
{pmore}
{it:#f} is optional and specifies the number of forward terms to be included,
{bind:0 {ul:<} {it:#f} {ul:<} one-half} the number of observations in the
sample.
{phang}
{cmd:weights(}[{it:numlist_l}] {cmd:<}{it:#_c}{cmd:>} [{it:numlist_f}]{cmd:)}
is required for the weighted moving average and describes the span of
the moving average, as well as the weights to be applied
to each term in the average. Note that the middle term literally is
surrounded by {cmd:<} and {cmd:>}, so you might type
{cmd:weights(1/2 <3> 2/1)}.
{pmore}
{it:numlist_l} is optional and specifies the weights that are to be applied
to the lagged terms when computing the moving average.
{pmore}
{it:#_c} is required and specifies the weight to be applied to the current
term.
{pmore}
{it:numlist_f} is optional and specifies the weights to be applied
to the forward terms when computing the moving average.
{pmore}
The number of elements in each {it:{help numlist}} is limited to one-half the
number of observations in the sample.
{phang}
{opt replace} replaces {newvar} if it already exists.
{title:Examples}
{psee}{cmd:. tssmooth ma sm1 = sales, window(2 1)}
{psee}{cmd:. tssmooth ma sm2 = sales, weights(2 1 <1>)}
{title:Also see}
{psee}
Manual: {bf:[TS] tssmooth ma}
{psee}
Online: {helpb arima}, {helpb egen}, {helpb generate},
{helpb tsset}, {helpb tssmooth dexponential}, {helpb tssmooth exponential},
{helpb tssmooth hwinters}, {helpb tssmooth nl}, {helpb tssmooth shwinters}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -