'Create a plot of the pairwise products of within-group
residuals against the corresponding time differences.  This
plot can be used to assess the possible form of an isotropic
covariance structure.
Parameters
ax : Matplotlib axes instance
An axes on which to draw the graph.  If None, new
figure and axes objects are created
xpoints : scalar or array-like
If scalar, the number of points equally spaced points on
the time difference axis used to define bins for
calculating local means.  If an array, the specific points
that define the bins.
min_n : integer
The minimum sample size in a bin for the mean residual
product to be included on the plot.'

def plot_isotropic_dependence(self, ax=None, xpoints=10, min_n=50):

    from statsmodels.graphics import utils as gutils
    resid = self.model.cluster_list(self.resid)
    time = self.model.cluster_list(self.model.time)
    (xre, xdt) = ([], [])
    for (re, ti) in zip(resid, time):
        ix = np.tril_indices(re.shape[0], 0)
        re = ((re[ix[0]] * re[ix[1]]) / (self.scale ** 2))
        xre.append(re)
        dists = np.sqrt(((ti[ix[0], :] - ti[ix[1], :]) ** 2).sum(1))
        xdt.append(dists)
    xre = np.concatenate(xre)
    xdt = np.concatenate(xdt)
    if (ax is None):
        (fig, ax) = gutils.create_mpl_ax(ax)
    else:
        fig = ax.get_figure()
    ii = np.flatnonzero((xdt == 0))
    v0 = np.mean(xre[ii])
    xre /= v0
    if np.isscalar(xpoints):
        xpoints = np.linspace(0, max(xdt), xpoints)
    dg = np.digitize(xdt, xpoints)
    dgu = np.unique(dg)
    hist = np.asarray([np.sum((dg == k)) for k in dgu])
    ii = np.flatnonzero((hist >= min_n))
    dgu = dgu[ii]
    dgy = np.asarray([np.mean(xre[(dg == k)]) for k in dgu])
    dgx = np.asarray([np.mean(xdt[(dg == k)]) for k in dgu])
    ax.plot(dgx, dgy, '-', color='orange', lw=5)
    ax.set_xlabel('Time    difference')
    ax.set_ylabel('Product    of    scaled    residuals')
    return fig
