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
评论列表
文章目录