From cc682b1945fa720f2804d5478a00c66d9896a5c6 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 23 Feb 2018 10:49:00 +0100 Subject: [PATCH] Added mean error test --- tests/Math/Statistic/Forecast/ErrorTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/Math/Statistic/Forecast/ErrorTest.php b/tests/Math/Statistic/Forecast/ErrorTest.php index 7aace9f8b..0ffcad770 100644 --- a/tests/Math/Statistic/Forecast/ErrorTest.php +++ b/tests/Math/Statistic/Forecast/ErrorTest.php @@ -55,4 +55,18 @@ class ErrorTest extends \PHPUnit\Framework\TestCase ) ); } + + public function testMeanError() + { + $errors = [ + 400 - 300, + 600 - 700, + 200 - 200, + 500 - -300 + ]; + + self::assertEquals(300, Error::getMeanAbsoulteError($errors), '', 0.01); + self::assertEquals(125000, Error::getMeanSquaredError($errors), '', 0.01); + self::assertEquals(406.2019, Error::getRootMeanSquaredError($errors), '', 0.01); + } }