statsmodels.stats.correlation_tools.kernel_covariance(exog, loc, groups, kernel=None, bw=None)[source]

Use kernel averaging to estimate a multivariate covariance function.

The goal is to estimate a covariance function C(x, y) = cov(Z(x), Z(y)) where x, y are vectors in R^p (e.g. representing locations in time or space), and Z(.) represents a multivariate process on R^p.

The data used for estimation can be observed at arbitrary values of the position vector, and there can be multiple independent observations from the process.


The rows of exog are realizations of the process obtained at specified points.


The rows of loc are the locations (e.g. in space or time) at which the rows of exog are observed.


The values of groups are labels for distinct independent copies of the process.

kernelMultivariateKernel instance, optional

An instance of MultivariateKernel, defaults to GaussianMultivariateKernel.

bwarray_like or scalar

A bandwidth vector, or bandwidth multiplier. If a 1d array, it contains kernel bandwidths for each component of the process, and must have length equal to the number of columns of exog. If a scalar, bw is a bandwidth multiplier used to adjust the default bandwidth; if None, a default bandwidth is used.

A real-valued function C(x, y) that returns an estimate of the covariance
between values of the process located at x and y.



Genton M, W Kleiber (2015). Cross covariance functions for multivariate geostatics. Statistical Science 30(2).

Last update: May 25, 2024