models.py 文件源码

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

项目:pyprocessmacro 作者: QuentinAndre 项目源码 文件源码
def coeff_summary(self):
        """
        Get the estimates of the terms in the model.
        :return: A DataFrame of betas, se, t (or z), p, llci, ulci for all variables of the model.
        """
        results = self.estimation_results
        if results:
            if "t" in results.keys():  # Model has t-stats rather than z-stats
                coeffs = np.array(
                    [results["betas"], results["se"], results["t"], results["p"], results["llci"], results["ulci"]]).T
                df = pd.DataFrame(coeffs, index=results["names"],
                                  columns=["coeff", "se", "t", "p", "LLCI", "ULCI"])
            else:  # Model has z-stats.
                coeffs = np.array(
                    [results["betas"], results["se"], results["z"], results["p"], results["llci"], results["ulci"]]).T
                df = pd.DataFrame(coeffs, index=results["names"],
                                  columns=["coeff", "se", "Z", "p", "LLCI", "ULCI"])
        else:
            raise NotImplementedError(
                "The model has not been estimated yet. Please estimate the model first."
            )
        return df
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号