Пример #1
0
 def test_model(self):
     reg = SP.GM_Endog_Error(self.y, self.X, self.yd, self.q, self.w)
     betas = np.array([[55.36095292], [0.46411479], [-0.66883535],
                       [0.38989939]])
     print(
         'Running reduced-tolernace test in L181 of test_error_sp_sparse.py'
     )
     np.testing.assert_allclose(reg.betas, betas, RTOL + .0001)
     u = np.array([26.55951566])
     np.testing.assert_allclose(reg.u[0], u, RTOL)
     e = np.array([31.23925425])
     np.testing.assert_allclose(reg.e_filtered[0], e, RTOL)
     predy = np.array([53.9074875])
     np.testing.assert_allclose(reg.predy[0], predy, RTOL)
     n = 49
     np.testing.assert_allclose(reg.n, n, RTOL)
     k = 3
     np.testing.assert_allclose(reg.k, k, RTOL)
     y = np.array([80.467003])
     np.testing.assert_allclose(reg.y[0], y, RTOL)
     x = np.array([1., 19.531])
     np.testing.assert_allclose(reg.x.toarray()[0], x, RTOL)
     yend = np.array([15.72598])
     np.testing.assert_allclose(reg.yend[0], yend, RTOL)
     z = np.array([1., 19.531, 15.72598])
     np.testing.assert_allclose(reg.z.toarray()[0], z, RTOL)
     my = 38.43622446938776
     np.testing.assert_allclose(reg.mean_y, my, RTOL)
     sy = 18.466069465206047
     np.testing.assert_allclose(reg.std_y, sy, RTOL)
     vm = np.array([[529.15840986, -15.78336736, -8.38021053],
                    [-15.78336736, 0.54023504, 0.23112032],
                    [-8.38021053, 0.23112032, 0.14497738]])
     np.testing.assert_allclose(reg.vm, vm, RTOL)
     pr2 = 0.346472557570858
     np.testing.assert_allclose(reg.pr2, pr2, RTOL)
     sig2 = 192.5002
     np.testing.assert_allclose(reg.sig2, sig2, RTOL)
     std_err = np.array([23.003401, 0.73500657, 0.38075777])
     np.testing.assert_allclose(reg.std_err, std_err, RTOL)
     z_stat = np.array([[2.40664208, 0.01609994], [0.63144305, 0.52775088],
                        [-1.75659016, 0.07898769]])
     np.testing.assert_allclose(reg.z_stat, z_stat, RTOL)
Пример #2
0
 def test_model(self):
     reg = SP.GM_Endog_Error(self.y, self.X, self.yd, self.q, self.w)
     betas = np.array([[55.36095292], [0.46411479], [-0.66883535],
                       [0.38989939]])
     print('Running reduced precision test in L175 of test_error_sp.py')
     np.testing.assert_allclose(reg.betas, betas, RTOL + .0001)
     u = np.array([26.55951566])
     np.testing.assert_allclose(reg.u[0], u, RTOL)
     e = np.array([31.23925425])
     np.testing.assert_allclose(reg.e_filtered[0], e, RTOL)
     predy = np.array([53.9074875])
     np.testing.assert_allclose(reg.predy[0], predy, RTOL)
     n = 49
     np.testing.assert_allclose(reg.n, n, RTOL)
     k = 3
     np.testing.assert_allclose(reg.k, k, RTOL)
     y = np.array([80.467003])
     np.testing.assert_allclose(reg.y[0], y, RTOL)
     x = np.array([1., 19.531])
     np.testing.assert_allclose(reg.x[0], x, RTOL)
     yend = np.array([15.72598])
     np.testing.assert_allclose(reg.yend[0], yend, RTOL)
     z = np.array([1., 19.531, 15.72598])
     np.testing.assert_allclose(reg.z[0], z, RTOL)
     my = 38.43622446938776
     np.testing.assert_allclose(reg.mean_y, my, RTOL)
     sy = 18.466069465206047
     np.testing.assert_allclose(reg.std_y, sy, RTOL)
     vm = np.array([[5.29158422e+02, -1.57833675e+01, -8.38021080e+00],
                    [-1.57833675e+01, 5.40235041e-01, 2.31120327e-01],
                    [-8.38021080e+00, 2.31120327e-01, 1.44977385e-01]])
     np.testing.assert_allclose(reg.vm, vm, RTOL)
     pr2 = 0.346472557570858
     np.testing.assert_allclose(reg.pr2, pr2, RTOL)
     sig2 = 192.50022721929574
     np.testing.assert_allclose(reg.sig2, sig2, RTOL)
     std_err = np.array([23.003401, 0.73500657, 0.38075777])
     np.testing.assert_allclose(reg.std_err, std_err, RTOL)
     z_stat = np.array([[2.40664208, 0.01609994], [0.63144305, 0.52775088],
                        [-1.75659016, 0.07898769]])
     np.testing.assert_allclose(reg.z_stat, z_stat, RTOL)
Пример #3
0
 def test_model(self):
     reg = SP.GM_Endog_Error(self.y, self.X, self.yd, self.q, self.w)
     betas = np.array([[55.36095292], [0.46411479], [-0.66883535],
                       [0.38989939]])
     np.allclose(reg.betas, betas, 4)
     u = np.array([26.55951566])
     np.allclose(reg.u[0], u, 4)
     e = np.array([31.23925425])
     np.allclose(reg.e_filtered[0], e, 4)
     predy = np.array([53.9074875])
     np.allclose(reg.predy[0], predy, 4)
     n = 49
     np.allclose(reg.n, n)
     k = 3
     np.allclose(reg.k, k)
     y = np.array([80.467003])
     np.allclose(reg.y[0], y, 4)
     x = np.array([1., 19.531])
     np.allclose(reg.x.toarray()[0], x, 4)
     yend = np.array([15.72598])
     np.allclose(reg.yend[0], yend, 4)
     z = np.array([1., 19.531, 15.72598])
     np.allclose(reg.z.toarray()[0], z, 4)
     my = 38.43622446938776
     np.allclose(reg.mean_y, my)
     sy = 18.466069465206047
     np.allclose(reg.std_y, sy)
     vm = np.array([[529.15840986, -15.78336736, -8.38021053],
                    [-15.78336736, 0.54023504, 0.23112032],
                    [-8.38021053, 0.23112032, 0.14497738]])
     np.allclose(reg.vm, vm, 4)
     pr2 = 0.346472557570858
     np.allclose(reg.pr2, pr2)
     sig2 = 192.5002
     np.allclose(round(reg.sig2, 4), round(sig2, 4), 4)
     std_err = np.array([23.003401, 0.73500657, 0.38075777])
     np.allclose(reg.std_err, std_err, 4)
     z_stat = np.array([[2.40664208, 0.01609994], [0.63144305, 0.52775088],
                        [-1.75659016, 0.07898769]])
     np.allclose(reg.z_stat, z_stat, 4)
Пример #4
0
 def test_model(self):
     reg = SP.GM_Endog_Error(self.y, self.X, self.yd, self.q, self.w)
     betas = np.array([[55.36095292], [0.46411479], [-0.66883535],
                       [0.38989939]])
     np.testing.assert_array_almost_equal(reg.betas, betas, 6)
     u = np.array([26.55951566])
     np.testing.assert_array_almost_equal(reg.u[0], u, 6)
     e = np.array([31.23925425])
     np.testing.assert_array_almost_equal(reg.e_filtered[0], e, 6)
     predy = np.array([53.9074875])
     np.testing.assert_array_almost_equal(reg.predy[0], predy, 6)
     n = 49
     self.assertAlmostEqual(reg.n, n)
     k = 3
     self.assertAlmostEqual(reg.k, k)
     y = np.array([80.467003])
     np.testing.assert_array_almost_equal(reg.y[0], y, 6)
     x = np.array([1., 19.531])
     np.testing.assert_array_almost_equal(reg.x[0], x, 6)
     yend = np.array([15.72598])
     np.testing.assert_array_almost_equal(reg.yend[0], yend, 6)
     z = np.array([1., 19.531, 15.72598])
     np.testing.assert_array_almost_equal(reg.z[0], z, 6)
     my = 38.43622446938776
     self.assertAlmostEqual(reg.mean_y, my)
     sy = 18.466069465206047
     self.assertAlmostEqual(reg.std_y, sy)
     vm = np.array([[5.29156458e+02, -1.57833384e+01, -8.38016915e+00],
                    [-1.57833384e+01, 5.40234656e-01, 2.31119606e-01],
                    [-8.38016915e+00, 2.31119606e-01, 1.44976477e-01]])
     np.testing.assert_array_almost_equal(reg.vm, vm, 5)
     pr2 = 0.346472557570858
     self.assertAlmostEqual(reg.pr2, pr2)
     sig2 = 192.50040382591442
     self.assertAlmostEqual(reg.sig2, sig2, 5)
     std_err = np.array([23.003401, 0.73500657, 0.38075777])
     np.testing.assert_array_almost_equal(reg.std_err, std_err, 6)
     z_stat = np.array([[2.40664208, 0.01609994], [0.63144305, 0.52775088],
                        [-1.75659016, 0.07898769]])
     np.testing.assert_array_almost_equal(reg.z_stat, z_stat, 6)