Beispiel #1
0
        public void EffectiveSizeTest()
        {
            int Length = 10;

            double[] Series = new double[Length];
            for (int i = 0; i < Length; i++)
            {
                Series[i] = RandomSeries();
            }

            double rho = MCMCDiagnostics.ACF(Series, 1, x => x * x);
            double ESS = (1 - rho) / (1 + rho) * Length;

            Assert.AreEqual(ESS, MCMCDiagnostics.EffectiveSize(Series, x => x * x), 10e-13);
        }
Beispiel #2
0
        public void EffectiveSizeTest()
        {
            const int length = 10;
            var       series = new double[length];

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

            double rho = MCMCDiagnostics.ACF(series, 1, x => x * x);
            double ess = (1 - rho) / (1 + rho) * length;

            Assert.AreEqual(ess, MCMCDiagnostics.EffectiveSize(series, x => x * x), 10e-13);
        }
Beispiel #3
0
 public void LagNegative()
 {
     Assert.That(() => MCMCDiagnostics.ACF(new double[10], -1, x => x), Throws.TypeOf <ArgumentOutOfRangeException>());
 }
Beispiel #4
0
 private static double CalculateAutocorrelation(Signal signal, int lag)
 {
     return(MCMCDiagnostics.ACF(signal.Readouts, lag, x => x));
 }