def __init__(self, x, y, z, params, debiased=False, kappa=1):
if not (x.shape[0] == y.shape[0] == z.shape[0]):
raise ValueError('x, y and z must have the same number of rows')
if not x.shape[1] == len(params):
raise ValueError('x and params must have compatible dimensions')
self.x = x
self.y = y
self.z = z
self.params = params
self._debiased = debiased
self.eps = y - x @ params
self._kappa = kappa
self._pinvz = pinv(z)
nobs, nvar = x.shape
self._scale = nobs / (nobs - nvar) if self._debiased else 1
self._name = 'Unadjusted Covariance (Homoskedastic)'
评论列表
文章目录