def __init__(self, x, eps, sigma, full_sigma, gls=False, debiased=False, constraints=None):
super(HeteroskedasticCovariance, self).__init__(x, eps, sigma, full_sigma,
gls=gls,
debiased=debiased,
constraints=constraints)
self._name = 'Heteroskedastic (Robust) Covariance'
k = len(x)
weights = inv(sigma) if gls else eye(k)
bigx = blocked_diag_product(x, weights)
nobs = eps.shape[0]
e = eps.T.ravel()[:, None]
bigxe = bigx * e
m = bigx.shape[1]
xe = zeros((nobs, m))
for i in range(nobs):
xe[i, :] = bigxe[i::nobs].sum(0)[None, :]
self._moments = xe
评论列表
文章目录