A difference based estimator for the coefficients and long-run variance in case of a nonparametric regression model are AR(p).
Specifically, we assume that we observe \(Y(t)\) that satisfy the following equation: $$Y(t) = m(t/T) + \epsilon_t.$$ Here, \(m(\cdot)\) is an unknown function, and the errors \(\epsilon_t\) are AR(p) with p known. Specifically, we ler \(\{\epsilon_t\}\) be a process of the form $$\epsilon_t = \sum_{j=1}^p a_j \epsilon_{t-j} + \eta_t,$$ where \(a_1,a_2,\ldots, a_p\) are unknown coefficients and \(\eta_t\) are i.i.d.\ with \(E[\eta_t] = 0\) and \(E[\eta_t^2] = \nu^2\).
This function produces an estimator \(\widehat{\sigma}^2\) of the long-run variance $$\sigma^2 = \sum_{l=-\infty}^{\infty} cov(\epsilon_0,\epsilon_{l})$$ of the error terms, as well as estimators \(\widehat{a}_1, \ldots, \widehat{a}_p\) of the coefficients \(a_1,a_2,\ldots, a_p\) and an estimator \(\widehat{\nu}^2\) of the innovation variance \(\nu^2\).
The exact estimation procedure as well as description of the tuning parameters needed for this estimation can be found in Khismatullina and Vogt (2020).
estimate_lrv(data, q, r_bar, p)A list with the following elements:
Estimator of the long run variance of the error terms \(\sigma^2\).
Vector of length p of estimated AR coefficients \(a_1,a_2,\ldots, a_p\).
Estimator of the variance of the innovation term \(\nu^2\).
A vector of \(Y(1), Y(2), \ldots, Y(T)\).
Tuning parameters.
AR order of the error terms.
Khismatullina M., Vogt M. Multiscale inference and long-run variance estimation in non-parametric regression with time series errors //Journal of the Royal Statistical Society: Series B (Statistical Methodology). - 2020.