Click or drag to resize

SeriesAutocovariance Method (IReadOnlyListDouble, Int32)

Computes the auto-covariance of the series at the given lag.

Namespace:  Meta.Numerics.Statistics
Assembly:  Meta.Numerics (in Meta.Numerics.dll) Version: 4.1.4
public static double Autocovariance(
	this IReadOnlyList<double> series,
	int lag


Type: System.Collections.GenericIReadOnlyListDouble
The data series from which to compute the auto-covariance.
Type: SystemInt32
The lag at which to compute the auto-covariance.

Return Value

Type: Double
The value of the auto-covariance at the given lag.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IReadOnlyListDouble. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

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

The computation of an auto-covariance via this method is O(N). If you need to compute more than a handful of auto-covariances, it is more efficient to call the Autocovariance(IReadOnlyListDouble), which computes all of them in O(N log N).

While the sample auto-covariance does converge to the population auto-covariance in the large-N limit, this convergence is very slow. If you want an estimate of the population auto-covariance, use SeriesPopulationStatistics(IReadOnlyListDouble) to obtain a much better estimate.

See Also