Description Usage Arguments Details Value Author(s) References Examples

Determines the optimal and data-driven moving average lag *q*.

1 | ```
qn(x)
``` |

`x` |
a numeric vector or univariate time series. |

For univariate time series *x[t]*, the moving average filter is defined as

*mhat[t] = ∑ x[t]/(2q+1)*

for *q + 1 ≤ t ≤ n + q*. The optimal and
data-driven moving average lag *q* can be determined by using the rule-of-thumb
estimator proposed in Section 3 of D. Qiu *et al.* (2013). It is determined by
sample size *n*, variance *γ(0)* and curvature *m''* of the univariate
series, where *m''* is the second derivative of an unknown nonparameteric trend
function *m(t)*. To obtain the preliminary estimators of variance *γ(0)* and
curvature *m''*, *m(t)* can be initially fitted by a cubic polynomial model.
See L. Yang and R. Tscherning (1999) for more details. For the case when *q > n*,
the optimal moving average lag *q* is set to be an integer part of *n^{4/5}/2*.

`qn` |
the optimal moving average lag |

Debin Qiu

D. Qiu, Q. Shao, and L. Yang (2013), Efficient inference for autoregressive coeficient in
the presence of trend. *Journal of Multivariate Analysis* 114, 40-53.

L. Yang, R. Tscherning (1999), Multivariate bandwidth selection for local linear
regression. *Journal of the Royal Statistical Society. Series B. Statistical
Methodology* 61, 793-815.

1 2 3 4 |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.