def test_prediction_intervals(self): pred = converters.prediction_intervals(self.fc_oil) self.assertEqual(pred.shape, (10, 5)) self.assertEqual(list(pred.index), range(2011, 2021)) self.assertEqual( list(pred.columns), [u'point_fc', u'lower80', u'upper80', u'lower95', u'upper95']) self.assertAlmostEqual(pred.point_fc[2011], self.fc_oil.rx2('mean').rx(1)[0], places=3) self.assertAlmostEqual(pred.point_fc[2020], self.fc_oil.rx2('mean').rx(10)[0], places=3) lower = self.fc_oil.rx2('lower') upper = self.fc_oil.rx2('upper') self.assertAlmostEqual(pred.lower80[2011], lower.rx(1, 1)[0], places=3) self.assertAlmostEqual(pred.lower80[2020], lower.rx(10, 1)[0], places=3) self.assertAlmostEqual(pred.upper80[2011], upper.rx(1, 1)[0], places=3) self.assertAlmostEqual(pred.upper80[2020], upper.rx(10, 1)[0], places=3) self.assertAlmostEqual(pred.lower95[2011], lower.rx(1, 2)[0], places=3) self.assertAlmostEqual(pred.lower95[2020], lower.rx(10, 2)[0], places=3) self.assertAlmostEqual(pred.upper95[2011], upper.rx(1, 2)[0], places=3) self.assertAlmostEqual(pred.upper95[2020], upper.rx(10, 2)[0], places=3) self.assertRaises(ValueError, converters.prediction_intervals, self.oil_ts)
def test_prediction_intervals(self): pred = converters.prediction_intervals(self.fc_oil) self.assertEqual(pred.shape, (10, 5)) self.assertEqual(list(pred.index), range(2011, 2021)) self.assertEqual(list(pred.columns), [u'point_fc', u'lower80', u'upper80', u'lower95', u'upper95']) self.assertAlmostEqual(pred.point_fc[2011], 370.3502, places=3) self.assertAlmostEqual(pred.point_fc[2020], 370.3502, places=3) self.assertAlmostEqual(pred.lower80[2011], 204.1084, places=3) self.assertAlmostEqual(pred.lower80[2020], 204.1084, places=3) self.assertAlmostEqual(pred.upper80[2011], 536.5920, places=3) self.assertAlmostEqual(pred.upper80[2020], 536.5920, places=3) self.assertAlmostEqual(pred.lower95[2011], 112.9187, places=3) self.assertAlmostEqual(pred.lower95[2020], 112.9187, places=3) self.assertAlmostEqual(pred.upper95[2011], 627.7818, places=3) self.assertAlmostEqual(pred.upper95[2020], 627.7818, places=3) self.assertRaises(ValueError, converters.prediction_intervals, self.oil_ts)
def test_prediction_intervals(self): pred = converters.prediction_intervals(self.fc_oil) self.assertEqual(pred.shape, (10, 5)) self.assertEqual(list(pred.index), range(2011, 2021)) self.assertEqual(list(pred.columns), [u'point_fc', u'lower80', u'upper80', u'lower95', u'upper95']) self.assertAlmostEqual(pred.point_fc[2011], self.fc_oil.rx2('mean').rx(1)[0], places=3) self.assertAlmostEqual(pred.point_fc[2020], self.fc_oil.rx2('mean').rx(10)[0], places=3) lower = self.fc_oil.rx2('lower') upper = self.fc_oil.rx2('upper') self.assertAlmostEqual(pred.lower80[2011], lower.rx(1, 1)[0], places=3) self.assertAlmostEqual(pred.lower80[2020], lower.rx(10, 1)[0], places=3) self.assertAlmostEqual(pred.upper80[2011], upper.rx(1, 1)[0], places=3) self.assertAlmostEqual(pred.upper80[2020], upper.rx(10, 1)[0], places=3) self.assertAlmostEqual(pred.lower95[2011], lower.rx(1, 2)[0], places=3) self.assertAlmostEqual(pred.lower95[2020], lower.rx(10, 2)[0], places=3) self.assertAlmostEqual(pred.upper95[2011], upper.rx(1, 2)[0], places=3) self.assertAlmostEqual(pred.upper95[2020], upper.rx(10, 2)[0], places=3) self.assertRaises(ValueError, converters.prediction_intervals, self.oil_ts)