self.R2Y = pd.Series({x:sm.OLS(self.y.data, sm.add_constant(X.drop(x, axis=1))).fit().rsquared
for x in list(X.columns)})
self.SDX = X.std()
self.SDY = self.y.data.std()
self.meanX = X.mean(0)
for t in self.terms.values():
t._setup()
After Change
"r2_y":pd.Series({x:pd.stats.api.ols(y=self.y.data.squeeze(), x=X.drop(x, axis=1)).r2
for x in list(X.columns)}),
"sd_x":X.std(),
"sd_y":self.y.data.std(),
"mean_x":X.mean(axis=0),
"mean_y":self.y.data.mean()
}
// save some info possibly useful for diagnostics, and send to ModelResults
// mat = correlation matrix of X, w/ diagonal replaced by X means
mat = X.corr()
for x in list(mat.columns): mat.loc[x,x] = default_prior_info["mean_x"][x]
self._diagnostics = {
// the Variance Inflation Factors (VIF), which is possibly useful for diagnostics
"VIF":1/(1 - default_prior_info["r2_x"]),
"corr_mean_X":mat
}