// nist_test.rs // // Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough // Copyright (C) 2016 G.vd.Schoot // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or (at // your option) any later version. // // This program is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // // These tests are based on the NIST Statistical Reference Datasets. // See http://www.nist.gov/itl/div898/strd/index.html for more information. // mod gsl; extern crate stat; use stat::*; #[test] fn test_nist() { let lew = &[-213, -564, -35, -15, 141, 115, -420, -360, 203, -338, -431, 194, -220, -513, 154, -125, -559, 92, -21, -579, -52, 99, -543, -175, 162, -457, -346, 204, -300, -474, 164, -107, -572, -8, 83, -541, -224, 180, -420, -374, 201, -236, -531, 83, 27, -564, -112, 131, -507, -254, 199, -311, -495, 143, -46, -579, -90, 136, -472, -338, 202, -287, -477, 169, -124, -568, 17, 48, -568, -135, 162, -430, -422, 172, -74, -577, -13, 92, -534, -243, 194, -355, -465, 156, -81, -578, -64, 139, -449, -384, 193, -198, -538, 110, -44, -577, -6, 66, -552, -164, 161, -460, -344, 205, -281, -504, 134, -28, -576, -118, 156, -437, -381, 200, -220, -540, 83, 11, -568, -160, 172, -414, -408, 188, -125, -572, -32, 139, -492, -321, 205, -262, -504, 142, -83, -574, 0, 48, -571, -106, 137, -501, -266, 190, -391, -406, 194, -186, -553, 83, -13, -577, -49, 103, -515, -280, 201, 300, -506, 131, -45, -578, -80, 138, -462, -361, 201, -211, -554, 32, 74, -533, -235, 187, -372, -442, 182, -147, -566, 25, 68, -535, -244, 194, -351, -463, 174, -125, -570, 15, 72, -550, -190, 172, -424, -385, 198, -218, -536, 96]; let lottery = &[162, 671, 933, 414, 788, 730, 817, 33, 536, 875, 670, 236, 473, 167, 877, 980, 316, 950, 456, 92, 517, 557, 956, 954, 104, 178, 794, 278, 147, 773, 437, 435, 502, 610, 582, 780, 689, 562, 964, 791, 28, 97, 848, 281, 858, 538, 660, 972, 671, 613, 867, 448, 738, 966, 139, 636, 847, 659, 754, 243, 122, 455, 195, 968, 793, 59, 730, 361, 574, 522, 97, 762, 431, 158, 429, 414, 22, 629, 788, 999, 187, 215, 810, 782, 47, 34, 108, 986, 25, 644, 829, 630, 315, 567, 919, 331, 207, 412, 242, 607, 668, 944, 749, 168, 864, 442, 533, 805, 372, 63, 458, 777, 416, 340, 436, 140, 919, 350, 510, 572, 905, 900, 85, 389, 473, 758, 444, 169, 625, 692, 140, 897, 672, 288, 312, 860, 724, 226, 884, 508, 976, 741, 476, 417, 831, 15, 318, 432, 241, 114, 799, 955, 833, 358, 935, 146, 630, 830, 440, 642, 356, 373, 271, 715, 367, 393, 190, 669, 8, 861, 108, 795, 269, 590, 326, 866, 64, 523, 862, 840, 219, 382, 998, 4, 628, 305, 747, 247, 34, 747, 729, 645, 856, 974, 24, 568, 24, 694, 608, 480, 410, 729, 947, 293, 53, 930, 223, 203, 677, 227, 62, 455, 387, 318, 562, 242, 428, 968]; let mavro = &[2.00180, 2.00170, 2.00180, 2.00190, 2.00180, 2.00170, 2.00150, 2.00140, 2.00150, 2.00150, 2.00170, 2.00180, 2.00180, 2.00190, 2.00190, 2.00210, 2.00200, 2.00160, 2.00140, 2.00130, 2.00130, 2.00150, 2.00150, 2.00160, 2.00150, 2.00140, 2.00130, 2.00140, 2.00150, 2.00140, 2.00150, 2.00160, 2.00150, 2.00160, 2.00190, 2.00200, 2.00200, 2.00210, 2.00220, 2.00230, 2.00240, 2.00250, 2.00270, 2.00260, 2.00260, 2.00260, 2.00270, 2.00260, 2.00250, 2.00240]; let michelson = &[299.85, 299.74, 299.90, 300.07, 299.93, 299.85, 299.95, 299.98, 299.98, 299.88, 300.00, 299.98, 299.93, 299.65, 299.76, 299.81, 300.00, 300.00, 299.96, 299.96, 299.96, 299.94, 299.96, 299.94, 299.88, 299.80, 299.85, 299.88, 299.90, 299.84, 299.83, 299.79, 299.81, 299.88, 299.88, 299.83, 299.80, 299.79, 299.76, 299.80, 299.88, 299.88, 299.88, 299.86, 299.72, 299.72, 299.62, 299.86, 299.97, 299.95, 299.88, 299.91, 299.85, 299.87, 299.84, 299.84, 299.85, 299.84, 299.84, 299.84, 299.89, 299.81, 299.81, 299.82, 299.80, 299.77, 299.76, 299.74, 299.75, 299.76, 299.91, 299.92, 299.89, 299.86, 299.88, 299.72, 299.84, 299.85, 299.85, 299.78, 299.89, 299.84, 299.78, 299.81, 299.76, 299.81, 299.79, 299.81, 299.82, 299.85, 299.87, 299.87, 299.81, 299.74, 299.81, 299.94, 299.95, 299.80, 299.81, 299.87]; let pidigits = &[3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9, 3, 2, 3, 8, 4, 6, 2, 6, 4, 3, 3, 8, 3, 2, 7, 9, 5, 0, 2, 8, 8, 4, 1, 9, 7, 1, 6, 9, 3, 9, 9, 3, 7, 5, 1, 0, 5, 8, 2, 0, 9, 7, 4, 9, 4, 4, 5, 9, 2, 3, 0, 7, 8, 1, 6, 4, 0, 6, 2, 8, 6, 2, 0, 8, 9, 9, 8, 6, 2, 8, 0, 3, 4, 8, 2, 5, 3, 4, 2, 1, 1, 7, 0, 6, 7, 9, 8, 2, 1, 4, 8, 0, 8, 6, 5, 1, 3, 2, 8, 2, 3, 0, 6, 6, 4, 7, 0, 9, 3, 8, 4, 4, 6, 0, 9, 5, 5, 0, 5, 8, 2, 2, 3, 1, 7, 2, 5, 3, 5, 9, 4, 0, 8, 1, 2, 8, 4, 8, 1, 1, 1, 7, 4, 5, 0, 2, 8, 4, 1, 0, 2, 7, 0, 1, 9, 3, 8, 5, 2, 1, 1, 0, 5, 5, 5, 9, 6, 4, 4, 6, 2, 2, 9, 4, 8, 9, 5, 4, 9,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, 6, 3, 1, 2, 9, 8, 6, 0, 8, 0, 9, 9, 8, 8, 8, 6, 8, 7, 4, 1, 3, 2, 6, 0, 4, 7, 2]; let numacc1 = &[10000001, 10000003, 10000002]; let mut numacc2 = &mut [0.0; 1001]; let mut numacc3 = &mut [0.0; 1001]; let mut numacc4 = &mut [0.0; 1001]; numacc2[0] = 1.2; numacc3[0] = 1000000.2; numacc4[0] = 10000000.2; let mut i = 1; while i < 1000 { numacc2[i] = 1.1; numacc2[i + 1] = 1.3; numacc3[i] = 1000000.1; numacc3[i + 1] = 1000000.3; numacc4[i] = 10000000.1; numacc4[i + 1] = 10000000.3; i += 2; } // Start of tests // { let mean = stat::mean(lew); let sd = stat::sd(lew); let lag1 = stat::lag1autocorrelation(lew); let expected_mean = -177.435000000000; let expected_sd = 277.332168044316; let expected_lag1 = -0.307304800605679; gsl::test_rel(mean, expected_mean, 1e-15, "lew stat::mean"); gsl::test_rel(sd, expected_sd, 1e-15, "lew stat::sd"); gsl::test_rel(lag1, expected_lag1, 1e-14, "lew autocorrelation"); } { let mean = stat::mean(lottery); let sd = stat::sd(lottery); let lag1 = stat::lag1autocorrelation(lottery); let expected_mean = 518.958715596330; let expected_sd = 291.699727470969; let expected_lag1 = -0.120948622967393; gsl::test_rel(mean, expected_mean, 1e-15, "lottery stat::mean"); gsl::test_rel(sd, expected_sd, 1e-15, "lottery stat::sd"); gsl::test_rel(lag1, expected_lag1, 1e-14, "lottery autocorrelation"); } { let mean = stat::mean(mavro); let sd = stat::sd(mavro); let lag1 = stat::lag1autocorrelation(mavro); let expected_mean = 2.00185600000000; let expected_sd = 0.000429123454003053; let expected_lag1 = 0.937989183438248; gsl::test_rel(mean, expected_mean, 1e-15, "mavro stat::mean"); gsl::test_rel(sd, expected_sd, 1e-13, "mavro stat::sd"); gsl::test_rel(lag1, expected_lag1, 1e-13, "mavro autocorrelation"); } { let mean = stat::mean(michelson); let sd = stat::sd(michelson); let lag1 = stat::lag1autocorrelation(michelson); let expected_mean = 299.852400000000; let expected_sd = 0.0790105478190518; let expected_lag1 = 0.535199668621283; gsl::test_rel(mean, expected_mean, 1e-15, "michelson stat::mean"); gsl::test_rel(sd, expected_sd, 1e-13, "michelson stat::sd"); gsl::test_rel(lag1, expected_lag1, 1e-13, "michelson autocorrelation"); } { let mean = stat::mean(pidigits); let sd = stat::sd(pidigits); let lag1 = stat::lag1autocorrelation(pidigits); let expected_mean = 4.53480000000000; let expected_sd = 2.86733906028871; let expected_lag1 = -0.00355099287237972; gsl::test_rel(mean, expected_mean, 1e-14, "pidigits stat::mean"); gsl::test_rel(sd, expected_sd, 1e-15, "pidigits stat::sd"); gsl::test_rel(lag1, expected_lag1, 1e-14, "pidigits autocorrelation"); } { let mean = stat::mean(numacc1); let sd = stat::sd(numacc1); let lag1 = stat::lag1autocorrelation(numacc1); let expected_mean = 10000002.; let expected_sd = 1.; let expected_lag1 = -0.5; gsl::test_rel(mean, expected_mean, 1e-15, "acc1 stat::mean"); gsl::test_rel(sd, expected_sd, 1e-15, "acc1 stat::sd"); gsl::test_rel(lag1, expected_lag1, 1e-15, "acc1 autocorrelation"); } { let mean = stat::mean(numacc2); let sd = stat::sd(numacc2); let lag1 = stat::lag1autocorrelation(numacc2); let expected_mean = 1.2; let expected_sd = 0.1; let expected_lag1 = -0.999; gsl::test_rel(mean, expected_mean, 1e-15, "acc2 stat::mean"); gsl::test_rel(sd, expected_sd, 1e-15, "acc2 stat::sd"); gsl::test_rel(lag1, expected_lag1, 1e-10, "acc2 autocorrelation"); } { let mean = stat::mean(numacc3); let sd = stat::sd(numacc3); let lag1 = stat::lag1autocorrelation(numacc3); let expected_mean = 1000000.2; let expected_sd = 0.1; let expected_lag1 = -0.999; gsl::test_rel(mean, expected_mean, 1e-15, "acc3 stat::mean"); gsl::test_rel(sd, expected_sd, 1e-9, "acc3 stat::sd"); gsl::test_rel(lag1, expected_lag1, 1e-10, "acc3 autocorrelation"); } { let mean = stat::mean(numacc4); let sd = stat::sd(numacc4); let lag1 = stat::lag1autocorrelation(numacc4); let expected_mean = 10000000.2; let expected_sd = 0.1; let expected_lag1 = -0.999; gsl::test_rel(mean, expected_mean, 1e-15, "acc4 stat::mean"); gsl::test_rel(sd, expected_sd, 1e-7, "acc4 stat::sd"); gsl::test_rel(lag1, expected_lag1, 1e-10, "acc4 autocorrelation"); } }