Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if permute:
results = results.rename(columns={"DF": "Num_perm", "P-val": "Perm-P-val"})
self.coefs = results
self.fitted = True
self.residuals = res
self.fits = (y.squeeze() - res).values
self.data["fits"] = (y.squeeze() - res).values
self.data["residuals"] = res
# Fit statistics
if "Intercept" in self.design_matrix.columns:
center_tss = True
else:
center_tss = False
self.rsquared = rsquared(y.squeeze(), res, center_tss)
self.rsquared_adj = rsquared_adj(
self.rsquared, len(res), len(res) - x.shape[1], center_tss
)
half_obs = len(res) / 2.0
ssr = np.dot(res, res.T)
self.logLike = (-np.log(ssr) * half_obs) - (
(1 + np.log(np.pi / half_obs)) * half_obs
)
self.AIC = 2 * x.shape[1] - 2 * self.logLike
self.BIC = np.log((len(res))) * x.shape[1] - 2 * self.logLike
if summarize:
return self.summary()