arch.covariance.kernel.Gallant

class arch.covariance.kernel.Gallant(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, bandwidth_method: str = 'newey-west')[source]

Alternative name for Parzen covariance estimator.

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.

bandwidth_method: str = 'newey-west'

The method used to estimate the bandwidth when bandwidth is None. “newey-west” uses the nonparametric estimate of Newey and West (1994) and “andrews” uses the AR(1) plug-in estimate of Andrews (1991), see opt_bandwidth. Not case sensitive, and hyphens and underscores are ignored as in the names of kernels, so that “newey_west” and “neweywest” are “newey-west”. Ignored if bandwidth is provided, and by ZeroLag.

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, or if bandwidth_method is not a str.

  • 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; if bandwidth_method is not one of the available names; or if bandwidth_method is “andrews” and the bandwidth must be estimated but the AR(1) cannot be fitted to the columns of x with positive weight, for example because they are all constant.

See also

Parzen

Kernel covariance estimator using the Parzen kernel.

Methods

Properties

bandwidth

The bandwidth used by the covariance estimator.

bandwidth_method

The method used to estimate the bandwidth.

bandwidth_scale

The power used in optimal bandwidth calculation.

centered

Flag indicating whether the data are centered (demeaned).

cov

The estimated covariances.

force_int

Flag indicating whether the bandwidth is restricted to be an integer.

kernel_const

The constant used in optimal bandwidth calculation.

kernel_weights

The weights used in covariance calculation.

name

The covariance estimator's name.

opt_bandwidth

Estimate optimal bandwidth.

rate

The optimal rate used in bandwidth selection.