'cached_means should always contain the most recent calculation
of the group-wise mean vectors.  This function should be
called every time the regression parameters are changed, to
keep the cached means up to date.'

def update_cached_means(self, mean_params):

    endog = self.endog_li
    exog = self.exog_li
    offset = self.offset_li
    linkinv = self.family.link.inverse
    self.cached_means = []
    for i in range(self.num_group):
        if (len(endog[i]) == 0):
            continue
        lpr = np.dot(exog[i], mean_params)
        if (offset is not None):
            lpr += offset[i]
        expval = linkinv(lpr)
        self.cached_means.append((expval, lpr))
