def test_inverse_recovers_input_with_nonzero_bias(self): arma = Arma([1.3, -0.8, 0.2, -0.1], [-0.3, 0.5], bias=0.6) inv_arma = arma.inverse() y = arma.transform(X=self.u) u_again = inv_arma.transform(X=y) np.testing.assert_allclose(self.u, u_again)
def test_inverse_recovers_input_with_zero_bias(self): arma = Arma([-1.1, -0.6, -0.1], [0.5, 0.3]) inv_arma = arma.inverse() y = arma.transform(X=self.u) u_again = inv_arma.transform(X=y) np.testing.assert_allclose(self.u, u_again)
def test_inverse_arma_switches_orders(self): arma = Arma([-1.1, -0.6, -0.1], [0.5, 0.3]) inv_arma = arma.inverse() self.assertEqual(inv_arma.p, arma.q) self.assertEqual(inv_arma.q, arma.p) self.assertEqual(len(inv_arma.a), inv_arma.p) self.assertEqual(len(inv_arma.b), inv_arma.q)
def test_inverse_pure_ma_is_pure_ar(self): arma = Arma([], [-1.1, -0.6, -0.1]) inv_arma = arma.inverse() self.assertEqual(inv_arma.q, 0) self.assertEqual(len(inv_arma.b), 0)
def test_inverse_pure_ar_is_pure_ma(self): arma = Arma([0.5, 0.3], []) inv_arma = arma.inverse() self.assertEqual(inv_arma.p, 0) self.assertEqual(len(inv_arma.a), 0)