Click or drag to resize
TimeSeriesAutocovariance Method (Int32)
Computes the autocovariance of the series at the given lag.

Namespace:  Meta.Numerics.Statistics
Assembly:  Meta.Numerics (in Meta.Numerics.dll) Version: (
public double Autocovariance(
	int lag


Type: SystemInt32
The lag at which to compute the autocovariance.

Return Value

Type: Double
The value of the autocovariance at the given lag.

In a length-N time series, there are N-k lag-k observations. Nonetheless, the definition of the lag-k autocovariance requires division by N, not N-k. This counterintuitive convention insures that the autocovariance has desirable positive definiteness properties and agrees with the computation via FFT.

The computation of an autocovariance via this method is O(N). If you need to compute more than a handfull of autocovariances, it is more efficient to call the Autocovariance, which computes all of them in O(N log N).

While the sample autocovariance does converge to the population autocovariance in the large-N limit, this convergence is very slow. If you want the value of the population covariance, use PopulationStatistics to obtain a much better estimate.

See Also