arch.covariance.kernel.NeweyWest

class arch.covariance.kernel.NeweyWest(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]

Alternative name for Bartlett 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.

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.

See also

Bartlett

Kernel covariance estimator using the Bartlett kernel.

Methods

Properties

bandwidth

The bandwidth used by the covariance estimator.

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.