def test_model_combo_regi_error(self):
     #Columbus:
     reg = SP.GM_Combo_Het_Regimes(self.y,
                                   self.X2,
                                   self.regimes,
                                   self.yd,
                                   self.q,
                                   w=self.w,
                                   regime_lag_sep=True,
                                   regime_err_sep=True)
     betas = np.array([[42.01151458], [-0.13917151], [-0.65300184],
                       [0.54737064], [0.2629229], [34.21569751],
                       [-0.15236089], [-0.49175217], [0.65733173],
                       [-0.07713581]])
     np.testing.assert_allclose(reg.betas, betas, RTOL)
     vm = np.array([
         77.49519689, 0.57226879, -1.18856422, -1.28088712, 0.866752, 0.,
         0., 0., 0., 0.
     ])
     np.testing.assert_allclose(reg.vm[0], vm, RTOL)
     u = np.array([7.81039418])
     np.testing.assert_allclose(reg.u[0], u, RTOL)
     predy = np.array([7.91558582])
     np.testing.assert_allclose(reg.predy[0], predy, RTOL)
     e = np.array([7.22996911])
     np.testing.assert_allclose(reg.e_filtered[0], e, RTOL)
     chow_r = np.array([[1.90869079e-01, 6.62194273e-01],
                        [4.56118982e-05, 9.94611401e-01],
                        [3.12104263e-02, 8.59771748e-01],
                        [1.56368204e-01, 6.92522476e-01],
                        [7.52928732e-01, 3.85550558e-01]])
     np.testing.assert_allclose(reg.chow.regi, chow_r, RTOL)
     chow_j = 1.1316136604755913
     np.testing.assert_allclose(reg.chow.joint[0], chow_j, RTOL)
     #Artficial:
     model = SP.GM_Combo_Het_Regimes(self.y_a,
                                     self.x_a1,
                                     yend=self.x_a2,
                                     q=self.q_a,
                                     regimes=self.regi_a,
                                     w=self.w_a,
                                     regime_err_sep=True,
                                     regime_lag_sep=True)
     model1 = GM_Combo_Het(self.y_a[0:(self.n2)].reshape((self.n2), 1),
                           self.x_a1[0:(self.n2)],
                           yend=self.x_a2[0:(self.n2)],
                           q=self.q_a[0:(self.n2)],
                           w=self.w_a1)
     model2 = GM_Combo_Het(self.y_a[(self.n2):].reshape((self.n2), 1),
                           self.x_a1[(self.n2):],
                           yend=self.x_a2[(self.n2):],
                           q=self.q_a[(self.n2):],
                           w=self.w_a1)
     tbetas = np.vstack((model1.betas, model2.betas))
     np.testing.assert_allclose(model.betas, tbetas, RTOL)
     vm = np.hstack((model1.vm.diagonal(), model2.vm.diagonal()))
 def test_model_combo(self):
     reg = SP.GM_Combo_Het_Regimes(self.y,
                                   self.X2,
                                   self.regimes,
                                   self.yd,
                                   self.q,
                                   w=self.w)
     betas = np.array([[3.69372678e+01], [-8.29474998e-01
                                          ], [3.08667517e+01],
                       [-7.23753444e-01], [-3.01900940e-01],
                       [-2.21328949e-01], [6.41902155e-01],
                       [-2.45714919e-02]])
     np.testing.assert_allclose(reg.betas, betas, RTOL)
     u = np.array([0.94039246])
     np.testing.assert_allclose(reg.u[0], u, RTOL)
     e_filtered = np.array([0.8737864])
     np.testing.assert_allclose(reg.e_filtered[0], e_filtered, RTOL)
     predy_e = np.array([18.68732105])
     np.testing.assert_allclose(reg.predy_e[0], predy_e, RTOL)
     predy = np.array([14.78558754])
     np.testing.assert_allclose(reg.predy[0], predy, RTOL)
     n = 49
     np.testing.assert_allclose(reg.n, n, RTOL)
     k = 7
     np.testing.assert_allclose(reg.k, k, RTOL)
     y = np.array([15.72598])
     np.testing.assert_allclose(reg.y[0], y, RTOL)
     x = np.array([[0., 0., 1., 19.531]])
     np.testing.assert_allclose(reg.x[0].toarray(), x, RTOL)
     yend = np.array([[0., 80.467003, 24.7142675]])
     np.testing.assert_allclose(reg.yend[0].toarray(), yend, RTOL)
     z = np.array([[0., 0., 1., 19.531, 0., 80.467003, 24.7142675]])
     np.testing.assert_allclose(reg.z[0].toarray(), z, RTOL)
     my = 35.128823897959187
     np.testing.assert_allclose(reg.mean_y, my, RTOL)
     sy = 16.732092091229699
     np.testing.assert_allclose(reg.std_y, sy, RTOL)
     vm = np.array([
         71.26851365, -0.58278032, 50.53169815, -0.74561147, -0.79510274,
         -0.10823496, -0.98141395, 1.16575965
     ])
     np.testing.assert_allclose(reg.vm[0], vm, RTOL)
     pr2 = 0.6504148883602958
     np.testing.assert_allclose(reg.pr2, pr2, RTOL)
     pr2_e = 0.527136896994038
     np.testing.assert_allclose(reg.pr2_e, pr2_e, RTOL)
     std_err = np.array([
         8.44206809, 0.72363219, 9.85790968, 0.77218082, 0.34084146,
         0.21752916, 0.14371614, 0.39226478
     ])
     np.testing.assert_allclose(reg.std_err, std_err, RTOL)
     chow_r = np.array([[0.54688708, 0.45959243], [0.01035136, 0.91896175],
                        [0.03981108, 0.84185042]])
     np.testing.assert_allclose(reg.chow.regi, chow_r, RTOL)
     chow_j = 0.78070369988354349
     np.testing.assert_allclose(reg.chow.joint[0], chow_j, RTOL)