2

Apparently Math.Net library does not contain a function for obtaining the autocorrelation of a sample.

How can this be achievied using the same library?

Jonas
  • 1,365
  • 3
  • 21
  • 39
  • Please take a look [HERE](https://stackoverflow.com/questions/46419323/cross-correlation-using-mathdotnet-c-sharp/47389474#47389474). It includes both, cross and auto correlation. – jsanalytics Nov 20 '17 at 10:25

1 Answers1

3

The function:

double ACF<T>(IEnumerable<T> series, int lag, Func<T, double> f)

in MathNet.Numerics.Statistics.Mcmc

calculates an autocorrelation.

An example of using it is in the unit test.

A snippet from it is:

var series = new double[length];

for (int i = 0; i < length; i++)
{ series[i] = RandomSeries(); }

double result = MCMCDiagnostics.ACF(series, lag, x=>x*x);
MEF2A
  • 238
  • 1
  • 5