covariance.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:linearmodels 作者: bashtage 项目源码 文件源码
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)'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号