TimeSeriesAutocovariance Method (Int32)
public double Autocovariance( int lag )
Public Function Autocovariance ( lag As Integer ) As Double
public: double Autocovariance( int lag )
member Autocovariance : lag : int -> float
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.