arch.covariance.kernel.TukeyParzen¶
-
class arch.covariance.kernel.TukeyParzen(x: ndarray | DataFrame | Series, bandwidth: float | None =
None, df_adjust: int =0, center: bool =True, weights: ndarray | DataFrame | Series | None =None, force_int: bool =False)[source]¶ Tukey-Parzen kernel covariance estimation.
- Parameters:¶
- x: ndarray | DataFrame | Series¶
The data to use in covariance estimation. Observations are in rows and variables in columns. Integer, Boolean and float32 data are converted to float64, and complex data to complex128. float16 data are not accepted. Must have at least 2 rows and 1 column, and must not contain NaN or infinite values.
- bandwidth: float | None =
None¶ The kernel’s bandwidth. If None, optimal bandwidth is estimated. Must be finite and non-negative.
- df_adjust: int =
0¶ Degrees of freedom to remove when adjusting the covariance. Uses the number of observations in x minus df_adjust when dividing inner-products. Must be at least 0 and smaller than the number of observations in x.
- center: bool =
True¶ A flag indicating whether x should be demeaned before estimating the covariance.
- weights: ndarray | DataFrame | Series | None =
None¶ An array of weights used to combine when estimating optimal bandwidth. If not provided, a vector of 1s is used. Must have nvar elements, be finite and non-negative, and at least one must be strictly positive.
- force_int: bool =
False¶ Force bandwidth to be an integer.
- Raises:¶
TypeError – If x cannot be converted to float64 or complex128 (it is float16, or contains strings or objects that are not numbers), if weights cannot be converted to float64, if bandwidth is not a real number, if df_adjust is not an integer (a float, including 5.0, or a Boolean is not accepted), or if center or force_int is not a bool.
ValueError – If x is not 2-d, has fewer than 2 rows or no columns or contains NaN or infinite values; if bandwidth is negative or not finite; if df_adjust is negative or not smaller than the number of observations; or if weights does not have nvar finite elements, has a negative element or has only zeros.
Notes
The kernel weights are computed using
\[\begin{split}w=\begin{cases} 0.436 + 0.564 \cos{\pi z} & z\leq1 \\ 0 & z>1 \end{cases}\end{split}\]where \(z=\frac{h}{H}, h=0, 1, \ldots, H\) where H is the bandwidth.
If the bandwidth is not provided, it is estimated using the constants of [1] and the automatic lag selection of [2]. See
opt_bandwidthfor details.Complex data. The estimators accept complex data, for which they are Hermitian. The lag-\(j\) autocovariance is \(\hat{\Gamma}_j=T^{-1}\sum_t x_t x_{t-j}^H\), where \(^H\) is the conjugate transpose, \(\hat{\Gamma}_{-j}=\hat{\Gamma}_j^H\), and the long-run covariance \(\hat{\Omega}=\hat{\Gamma}_0+\sum_{j\geq 1}w_j(\hat{\Gamma}_j+ \hat{\Gamma}_j^H)\) is a complex Hermitian matrix. If \(x_t=a_t+ib_t\), then \(\hat{\Omega}=\hat{\Omega}_{aa}+\hat{\Omega}_{bb}+ i(\hat{\Omega}_{ba}-\hat{\Omega}_{ab})\), where \(\hat{\Omega}_{uv}\) is the long-run covariance of the real data \(u\) and \(v\) with the same kernel and bandwidth. The automatic bandwidth combines the columns of x using
weightsand uses the real part of the autocovariances of this complex series. The pseudo-covariance \(E[x_t x_{t-j}^\prime]\) is not estimated, and the estimates are complex128 arrays. Real data give float64 estimates.References
Methods
Properties
The bandwidth used by the covariance estimator.
The power used in optimal bandwidth calculation.
Flag indicating whether the data are centered (demeaned).
The estimated covariances.
Flag indicating whether the bandwidth is restricted to be an integer.
The constant used in optimal bandwidth calculation.
The weights used in covariance calculation.
The covariance estimator's name.
Estimate optimal bandwidth.
The optimal rate used in bandwidth selection.