def test_plot_summary(self, data): model = GEV(data, fit_method="mle", ci=0.05, ci_method="delta") fig, ax1, ax2, ax3, ax4 = model.plot_summary() assert len(fig.get_axes()) == 4 assert ax1.has_data() assert ax2.has_data() assert ax3.has_data() assert ax4.has_data()
def test_plot_summary(self): for i in range(len(self.datasets)): model = GEV(self.datasets[i], fit_method = "mle", ci = 0.05, ci_method='delta') fig, ax1, ax2, ax3, ax4 = model.plot_summary() self.assertEqual(len(fig.get_axes()), 4) self.assertTrue(ax1.has_data()) self.assertTrue(ax2.has_data()) self.assertTrue(ax3.has_data()) self.assertTrue(ax4.has_data())
def test_plot_summary(self): for i in range(len(self.datasets)): model = GEV(self.datasets[i], fit_method="mle", ci=0.05, ci_method='delta') fig, ax1, ax2, ax3, ax4 = model.plot_summary() self.assertEqual(len(fig.get_axes()), 4) self.assertTrue(ax1.has_data()) self.assertTrue(ax2.has_data()) self.assertTrue(ax3.has_data()) self.assertTrue(ax4.has_data())
def test_mle_fit(self): for i in range(len(self.datasets)): model = GEV(self.datasets[i], fit_method = "mle", ci = 0.05, ci_method='delta') params = (-model.c, model.loc, model.scale) assert_array_almost_equal(params, self.expected_mle_params[i], decimal = 3) assert_almost_equal(model._nnlf(params), self.expected_mle_nnlf[i], decimal = 3) assert_array_almost_equal(model._se, self.expected_mle_se[i], decimal = 4)
def test_lmoments_fit(self): for i in range(len(self.datasets)): model = GEV(self.datasets[i], fit_method="lmoments") params = (-model.c, model.loc, model.scale) assert_array_almost_equal(params, self.expected_lmom_params[i], decimal=3)
def test_mle_fit(self): for i in range(len(self.datasets)): model = GEV(self.datasets[i], fit_method="mle", ci=0.05, ci_method='delta') params = (-model.c, model.loc, model.scale) assert_array_almost_equal(params, self.expected_mle_params[i], decimal=3) assert_almost_equal(model._nnlf(params), self.expected_mle_nnlf[i], decimal=3) assert_array_almost_equal(model._se, self.expected_mle_se[i], decimal=4)
def test_lmoments_fit(self, data, params): model = GEV(data, fit_method="lmoments") _params = (-model.c, model.loc, model.scale) assert_array_almost_equal(_params, params, decimal=3)
def test_mle_fit(self, data, params, nnlf, se): model = GEV(data, fit_method="mle", ci=0.05, ci_method="delta") _params = (-model.c, model.loc, model.scale) assert_array_almost_equal(_params, params, decimal=3) assert_almost_equal(model._nnlf(params), nnlf, decimal=3) assert_array_almost_equal(model._se, se, decimal=4)