コード例 #1
0
 def test_debiased(self, data):
     wm = HeteroskedasticWeightMatrix(debiased=True)
     z, e, nobs, nvar = data.z, data.e, data.nobs, data.nvar
     weight = wm.weight_matrix(data.x, z, e)
     ze = z * e
     scale = nobs / (nobs - nvar)
     assert_allclose(weight, scale * ze.T @ ze / nobs)
コード例 #2
0
 def test_center(self, data):
     wm = HeteroskedasticWeightMatrix(True)
     z, e, nobs = data.z, data.e, data.nobs
     weight = wm.weight_matrix(data.x, z, e)
     ze = z * e
     ze -= ze.mean(0)
     assert_allclose(weight, ze.T @ ze / nobs)
コード例 #3
0
    def test_config(self, data):
        wm = HeteroskedasticWeightMatrix()
        z, e, nobs = data.z, data.e, data.nobs
        weight = wm.weight_matrix(data.x, z, e)
        ze = z * e

        assert_allclose(weight, ze.T @ ze / nobs)
        assert wm.config['center'] is False
        assert wm.config['debiased'] is False