def test_probs(self, close_figures): nobs = self.nobs probs = self.res.predict_prob() freq = np.bincount(self.endog) / nobs tzi = dia.test_chisquare_prob(self.res, probs[:, :2]) # regression numbers tzi1 = (0.387770845, 0.5334734738) assert_allclose(tzi[:2], tzi1, rtol=5e-5) # smoke test for plot dia.plot_probs(freq, probs.mean(0))
def plot_probs(self, label='predicted', upp_xlim=None, fig=None): """Plot observed versus predicted frequencies for entire sample. """ probs_predicted = self.probs_predicted.sum(0) k_probs = len(probs_predicted) freq = np.bincount(self.results.model.endog.astype(int), minlength=k_probs)[:k_probs] fig = plot_probs(freq, probs_predicted, label=label, upp_xlim=upp_xlim, fig=fig) return fig
def test_probs(self): nobs = self.nobs probs = self.res.predict_prob() freq = np.bincount(self.endog) / nobs tzi = dia.test_chisquare_prob(self.res, probs[:, :2]) # regression numbers tzi1 = (0.387770845, 0.5334734738) assert_allclose(tzi[:2], tzi1) # smoke test for plot try: import matplotlib.pyplot as plt except ImportError: return fig = dia.plot_probs(freq, probs.mean(0)) plt.close(fig)
def test_probs(self): nobs = self.nobs probs = self.res.predict_prob() freq = np.bincount(self.endog) / nobs tzi = dia.test_chisquare_prob(self.res, probs[:, :2]) # regression numbers tzi1 = (0.387770845, 0.5334734738) assert_allclose(tzi[:2], tzi1, rtol=5e-5) # smoke test for plot try: import matplotlib.pyplot as plt except ImportError: return fig = dia.plot_probs(freq, probs.mean(0)) plt.close(fig)