예제 #1
0
 def test_model(self):
     reg = SP.BaseGM_Endog_Error(self.y, self.X, self.yd, self.q, self.w.sparse)
     betas = np.array([[ 55.36095292], [  0.46411479], [ -0.66883535], [  0.38989939]])
     np.testing.assert_array_almost_equal(reg.betas,betas,4)
     u = np.array([ 26.55951566])
     np.testing.assert_array_almost_equal(reg.u[0],u,4)
     e = np.array([ 31.23925425])
     np.testing.assert_array_almost_equal(reg.e_filtered[0],e,4)
     predy = np.array([ 53.9074875])
     np.testing.assert_array_almost_equal(reg.predy[0],predy,4)
     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,4)
     x = np.array([  1.   ,  19.531])
     np.testing.assert_array_almost_equal(reg.x.toarray()[0],x,4)
     yend = np.array([  15.72598])
     np.testing.assert_array_almost_equal(reg.yend[0],yend,4)
     z = np.array([  1.     ,  19.531  ,  15.72598])
     np.testing.assert_array_almost_equal(reg.z.toarray()[0],z,4)
     my = 38.43622446938776
     self.assertAlmostEqual(reg.mean_y,my)
     #std_y
     sy = 18.466069465206047
     self.assertAlmostEqual(reg.std_y,sy)
     #vm
     vm = np.array([[ 529.15840986,  -15.78336736,   -8.38021053],
    [ -15.78336736,    0.54023504,    0.23112032],
    [  -8.38021053,    0.23112032,    0.14497738]])
     np.testing.assert_array_almost_equal(reg.vm,vm,4)
     sig2 = 192.5002
     self.assertAlmostEqual(round(reg.sig2,4),round(sig2,4),4)
예제 #2
0
 def test_model(self):
     reg = SP.BaseGM_Endog_Error(self.y, self.X, self.yd, self.q, self.w.sparse)
     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.toarray()[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.toarray()[0],z,6)
     my = 38.43622446938776
     self.assertAlmostEqual(reg.mean_y,my)
     #std_y
     sy = 18.466069465206047
     self.assertAlmostEqual(reg.std_y,sy)
     #vm
     vm = np.array([[ 529.15644447,  -15.78333817,   -8.38016887],
    [ -15.78333817,    0.54023465,    0.2311196 ],
    [  -8.38016887,    0.2311196 ,    0.14497647]])
     np.testing.assert_array_almost_equal(reg.vm,vm,5)
     sig2 = 192.50040382591442
     self.assertAlmostEqual(reg.sig2,sig2,5)
예제 #3
0
 def test_model(self):
     reg = SP.BaseGM_Endog_Error(self.y, self.X, self.yd, self.q,
                                 self.w.sparse)
     betas = np.array([[55.36095292], [0.46411479], [-0.66883535],
                       [0.38989939]])
     print(
         'Running reduced-precision test in L125 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)
     #std_y
     sy = 18.466069465206047
     np.testing.assert_allclose(reg.std_y, sy, RTOL)
     #vm
     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)
     sig2 = 192.5002
     np.testing.assert_allclose(reg.sig2, sig2, RTOL)
예제 #4
0
 def test_model(self):
     reg = SP.BaseGM_Endog_Error(self.y, self.X, self.yd, self.q,
                                 self.w.sparse)
     betas = np.array([[55.36095292], [0.46411479], [-0.66883535],
                       [0.38989939]])
     #raising a warning causes a failure...
     print('Running reduced precision test in L120 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)
     #std_y
     sy = 18.466069465206047
     np.testing.assert_allclose(reg.std_y, sy, RTOL)
     #vm
     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)
     sig2 = 192.50022721929574
     np.testing.assert_allclose(reg.sig2, sig2, RTOL)
예제 #5
0
 def test_model(self):
     reg = SP.BaseGM_Endog_Error(self.y, self.X, self.yd, self.q,
                                 self.w.sparse)
     betas = np.array([[55.36095292], [0.46411479], [-0.66883535],
                       [0.38989939]])
     np.testing.assert_allclose(reg.betas, betas, 4)
     u = np.array([26.55951566])
     np.testing.assert_allclose(reg.u[0], u, 4)
     e = np.array([31.23925425])
     np.testing.assert_allclose(reg.e_filtered[0], e, 4)
     predy = np.array([53.9074875])
     np.testing.assert_allclose(reg.predy[0], predy, 4)
     n = 49
     np.testing.assert_allclose(reg.n, n)
     k = 3
     np.testing.assert_allclose(reg.k, k)
     y = np.array([80.467003])
     np.testing.assert_allclose(reg.y[0], y, 4)
     x = np.array([1., 19.531])
     np.testing.assert_allclose(reg.x[0], x, 4)
     yend = np.array([15.72598])
     np.testing.assert_allclose(reg.yend[0], yend, 4)
     z = np.array([1., 19.531, 15.72598])
     np.testing.assert_allclose(reg.z[0], z, 4)
     my = 38.43622446938776
     np.testing.assert_allclose(reg.mean_y, my)
     #std_y
     sy = 18.466069465206047
     np.testing.assert_allclose(reg.std_y, sy)
     #vm
     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, 4)
     sig2 = 192.50022721929574
     np.testing.assert_allclose(reg.sig2, sig2, 4)