'Prediction table
Parameters
threshold : scalar
Number between 0 and 1. Threshold above which a prediction is
considered 1 and below which a prediction is considered 0.
Notes
pred_table[i,j] refers to the number of times "i" was observed and
the model predicted "j". Correct predictions are along the diagonal.'

def pred_table(self, threshold=0.5):

    model = self.model
    actual = model.endog
    pred = np.array((self.predict() > threshold), dtype=float)
    bins = np.array([0, 0.5, 1])
    return np.histogram2d(actual, pred, bins=bins)[0]
