arch.covariance.kernel.CovarianceEstimator.opt_bandwidth¶
- property CovarianceEstimator.opt_bandwidth : float[source]¶
Estimate optimal bandwidth.
- Returns:¶
The estimated optimal bandwidth.
- Return type:¶
- Raises:¶
ValueError – If
bandwidth_methodis “andrews” and the AR(1) cannot be fitted to the columns of x with positive weight, for example because they are all constant.
Notes
Computed as
\[\hat{b}_T = c_k \left[\hat{\alpha}\left(q\right) T \right]^{\frac{1}{2q+1}}\]where \(c_k\) is a kernel-dependent constant, T is the sample size, q determines the optimal bandwidth rate for the kernel.
The constants and the values of q are from [1]. For example, \(c_k\) is 1.1447 and q is 1 for the Bartlett kernel, 2.6614 and 2 for the Parzen kernel, and 1.3221 and 2 for the quadratic-spectral kernel. When
bandwidth_methodis “newey-west”, the default, \(\hat{\alpha}\left(q\right)\) is not the parametric (AR(1)) estimate that is suggested in [1]. It is the nonparametric estimate of [2],\[\hat{\alpha}\left(q\right) = \left( \frac{\sum_{j=-n}^{n} \left|j\right|^q \hat{\sigma}_j} {\sum_{j=-n}^{n} \hat{\sigma}_j} \right)^2\]where \(\hat{\sigma}_j\) is the lag-j autocovariance of the data combined using
weights, which is the real part of the autocovariance \(T^{-1}\sum_t v_t\bar{v}_{t-j}\) of the combined series \(v_t\) if x is complex, and \(n = \lfloor 4 \left(T / 100\right)^{r} \rfloor\). The rate r is 2/9 for the Bartlett kernel, 4/25 for the Parzen kernel and 2/25 for the quadratic-spectral kernel, as in [2].When
bandwidth_methodis “andrews”, \(\hat{\alpha}\left(q\right)\) is the AR(1) plug-in estimate of [1], equations (6.3) and (6.4), which has no pilot lag. An AR(1), \(u_{a,t}=\mu_a+\rho_a u_{a,t-1}+\epsilon_{a,t}\), is fitted to each column \(a\) of x by OLS, and \(\hat{\sigma}_a^2\) is the sum of the squared residuals divided by \(T-1\). Then\[\hat{\alpha}\left(1\right) = \frac{\sum_a w_a 4\hat{\rho}_a^2\hat{\sigma}_a^4 / \left[\left(1-\hat{\rho}_a\right)^6 \left(1+\hat{\rho}_a\right)^2\right]} {\sum_a w_a\hat{\sigma}_a^4 / \left(1-\hat{\rho}_a\right)^4}, \quad \hat{\alpha}\left(2\right) = \frac{\sum_a w_a 4\hat{\rho}_a^2\hat{\sigma}_a^4 / \left(1-\hat{\rho}_a\right)^8} {\sum_a w_a\hat{\sigma}_a^4 / \left(1-\hat{\rho}_a\right)^4}\]where \(w_a\) are the
weightsand the sums are over the columns with a positive weight. The constant \(\mu_a\) makes the estimate the same whether or not x is centered, as insandwich::bwAndrewsin R. The constants \(c_k\) are the values ofkernel_constfor all kernels. They are \(\left(q k_q^2 / \int k^2\right)^{1/(2q+1)}\) in the notation of [1], rounded to 4 decimals. The formula is applied to every kernel using its own \(q\), which is 1 or 2. Constant columns do not change the sums and are ignored. The real and imaginary parts of complex data are separate columns that both have the weight of the column.Both estimates of \(\hat{\alpha}\left(q\right)\) are ratios that do not change if the data are multiplied by a constant. Before they are computed, the data are divided by the power of 2 nearest their largest absolute value, which is exact, so that data with a very large or very small scale do not overflow or underflow. All columns are divided by the same value, since a different value for each column would change the weights of the columns in the “andrews” estimate.
In both cases the bandwidth is at most the number of observations less 1, and is rounded up if
force_intis True. ZeroLag ignoresbandwidth_method, and its bandwidth is 0.\(\hat{b}_T\) is the bandwidth S of the kernel \(k(h/S)\) in [1] and [2]. A kernel that is 0 beyond 1 weights lag h by \(k(h/(H+1))\) for a bandwidth H, so the estimator uses \(H=\max(\hat{b}_T-1, 0)\), whose weights are those of \(\hat{b}_T\). The quadratic-spectral kernel uses \(H=\hat{b}_T\). See
bandwidth.References