示例#1
0
 def __sample_wishart2(self, residual):
     residual = np.atleast_2d(residual)
     assert residual.shape[1] == self.p
     self.nuobar = self.nuubar + residual.shape[0]
     self.randnvec = np.random.randn(self.n_randn)
     self.randchivec = np.random.chisquare(self.nuobar - self.work_chisq)
     wishart.calc_sobar(self.Subar, self.Sobar, residual)
     info = np.array(0)
     wishart.chol_wishart2(self.randnvec, self.randchivec, self.umat,
               self.cmat, self.Sobar, info)
     assert info == 0
     return self.umat
示例#2
0
    def __sample_wishart(self, residual):
        residual = np.atleast_2d(residual)
        assert residual.shape[1] == self.p
        self.nuobar = self.nuubar + residual.shape[0]
        self.randnvec = np.random.randn(self.n_randn)
        self.randchivec = np.random.chisquare(self.nuobar - self.work_chisq)
        wishart.calc_sobar(self.Subar, self.Sobar, residual)
        self.cmat = np.asfortranarray(np.linalg.cholesky(np.linalg.inv(self.Sobar)).T)
        wishart.chol_wishart(self.randnvec, self.randchivec, self.umat,
                             self.cmat, self.rmat)

        return np.dot(self.rmat.T, self.rmat)