Exemplo n.º 1
0
 /*
 SmallCsvFile has the values:
 A:  B:  C:
 1   6   11
 2   7   12
 3   8   13
 4   9   14
 5   10  15
 ---------
 Averages:
 3   8   13
 Grand Mean = 8
 SST = 280
 SSE = 30
 SSB = 250
 dft = 14
 dfe = 12
 dfb = 2
 msb = 125
 msw = 2.5
 F = 50
 P = 0.0000015127924217375413
 */
 public AnovaTestsSmallCsv()
 {
     rData = new RawData();
     CsvParser parser = new CsvParser();
     bool parsed = parser.TryParseData(@"TestFiles/SmallCsvFile.csv", out rData);
     data = new AnovaOneway(rData);
     //AnovaResult res = data.GenerateAnovaResult();
     //Debug.WriteLine(res);
 }
Exemplo n.º 2
0
        public void CsvParser()
        {
            CsvParser csv = new CsvParser();
            string path = @"TestFiles/CSVFile.csv";
            RawData data;
            bool success = csv.TryParseData(path, out data);
            Assert.IsTrue(success);
            string[] groupNames = new[] {"A", "B", "C", "D", "E"};

            List<double[]> expectedArrays = new List<double[]>
            {
                new[] {1d, 4, 2, 7, 8, 3, 1, 2, 3, 3},
                new[] {5.3, 2, 7.5, 54, 23, 16},
                new[] {84d, 14, 34, 17, 26},
                new[] {57.7334, 16.6543, 45, 35.333335, 45, 95.0000000001, 65, 33},
                new[] {13.4444444444444, 1, 0, 100, 99, 8008135, 77777777777777}
            }
                ;
            List<double[]> actualArrays = new List<double[]>
            {
                data[0].Entries.ToArray(),
                data[1].Entries.ToArray(),
                data[2].Entries.ToArray(),
                data[3].Entries.ToArray(),
                data[4].Entries.ToArray()
            };
            for (int i = 0; i < 5; i++)
            {
                double[] expectedDoubles = expectedArrays[i];
                double[] actualDoubles = actualArrays[i];
                for (int j = 0; j < expectedDoubles.Length; j++)
                {
                    Assert.AreEqual(expectedDoubles[j], actualDoubles[j]);
                }
            }
        }