Exemple #1
0
        public void test_FittedValues_throws_MathError()
        {
            /*If any explanatory variable list is different size than y.Count, MathError is thrown.*/

            List <double> y = new List <double>()
            {
                2, 3
            };

            List <List <double> > lists = new List <List <double> >()
            {
                list, list2, list3
            };

            Assert.Throws <MathError>(() => ModelFit.FittedValues(y, lists));
        }
Exemple #2
0
        public void test_FittedValues()
        {
            /*Tested on R, a model lm(list ~ list2 + list3)
             * gives fitted values of 0.9818711, 3.5873076, 5.7066397, 8.1032177, 10.5016440, 3.8193199   */
            List <double> expected = new List <double>()
            {
                0.9818711, 3.5873076, 5.7066397, 8.1032177, 10.5016440, 3.8193199
            };
            List <List <double> > explanatory = new List <List <double> >()
            {
                list2, list3
            };

            List <double> results = ModelFit.FittedValues(list, explanatory);

            results = results.Select(y => Math.Round(y, 7)).ToList();

            Assert.AreEqual(expected, results);
        }