def test_eq_hsq(self): ''' Gencov should be the same as hsq if z1 = z2, hsq + intercept_hsq are 0 and all intermediate rg's are > 0 (because Hsq.weights lower-bounds the hsq guess at 0 but Gencov.weights lower-bounds the rho_g guess at -1). The setup below guarantees that all intermediate rho_g guesses will be 1 ''' self.ld = np.abs(np.random.normal(size=100).reshape((50, 2))) + 2 self.z1 = (np.sum(self.ld, axis=1) + 10).reshape((50, 1)) gencov = reg.Gencov(self.z1, self.z1, self.ld, self.w_ld, self.N1, self.N1, self.M, 0, 0, 0, 0, n_blocks=3, intercept_gencov=1) hsq = reg.Hsq(np.square(self.z1), self.ld, self.w_ld, self.N1, self.M, n_blocks=3, intercept=1) print(gencov.summary(['asdf', 'asdf'])) print(hsq.summary(['asdf', 'asdf'])) assert_array_almost_equal(gencov.tot, hsq.tot) assert_array_almost_equal(gencov.tot_se, hsq.tot_se) assert_array_almost_equal(gencov.tot_cov, hsq.tot_cov)
def test_summary(self): # not much to test; we can at least make sure no errors at runtime self.gencov.summary(['asdf']) self.ld += np.arange(4).reshape((4, 1)) self.z1 += np.arange(4).reshape((4, 1)) gencov = reg.Gencov(self.z1, self.z2, self.ld, self.w_ld, self.N1, self.N2, self.M, self.hsq1, self.hsq2, 1.0, 1.0, n_blocks=3) gencov.summary(['asdf'])
def setUp(self): self.ld = np.abs(np.random.normal(size=100).reshape((50, 2))) + 2 self.z1 = np.random.normal(size=50).reshape((50, 1)) self.z2 = np.random.normal(size=50).reshape((50, 1)) self.w_ld = np.random.normal(size=50).reshape((50, 1)) self.N1 = 9 * np.ones((50, 1)) self.N2 = 7 * np.ones((50, 1)) self.M = np.matrix((700, 222)) self.hsq1 = 0.5 self.hsq2 = 0.6 self.gencov = reg.Gencov(self.z1, self.z2, self.ld, self.w_ld, self.N1, self.N2, self.M, self.hsq1, self.hsq2, 1.0, 1.0, n_blocks=3, intercept_gencov=1)
def setUp(self): self.z1 = np.ones((4, 1)) * 4 self.z2 = np.ones((4, 1)) self.ld = np.ones((4, 1)) self.w_ld = np.ones((4, 1)) self.N1 = 9 * np.ones((4, 1)) self.N2 = 7 * np.ones((4, 1)) self.M = np.matrix((7)) self.hsq1 = 0.5 self.hsq2 = 0.6 self.gencov = reg.Gencov(self.z1, self.z2, self.ld, self.w_ld, self.N1, self.N2, self.M, self.hsq1, self.hsq2, 1.0, 1.0, n_blocks=3, intercept_gencov=1)