qn: Optimal and Data-Driven Moving Average Lag q

Description Usage Arguments Details Value Author(s) References Examples

Description

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

Usage

1
qn(x)

Arguments

x

a numeric vector or univariate time series.

Details

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.

Value

qn

the optimal moving average lag q.

Author(s)

Debin Qiu

References

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.

Examples

1
2
3
4
## load the global temperature data:
## first column is time and second column is temperature.
data(globtemp)
(q.n <- qn(globtemp))

debinqiu/rmaf documentation built on May 15, 2019, 1:54 a.m.