'Fit the model
A ValueError is raised if there are singular values smaller than the
tolerance. The treatment of singular arrays might change in future.
Parameters
tolerance : float
eigenvalue tolerance, values smaller than which is considered 0'

def _fit(self, tolerance=1e-08):

    (nobs, k_yvar) = self.endog.shape
    (nobs, k_xvar) = self.exog.shape
    k = np.min([k_yvar, k_xvar])
    x = np.array(self.exog)
    x = (x - x.mean(0))
    y = np.array(self.endog)
    y = (y - y.mean(0))
    (ux, sx, vx) = svd(x, 0)
    vx_ds = vx.T
    mask = (sx > tolerance)
    if (mask.sum() < len(mask)):
        raise ValueError('exog    is    collinear.')
    vx_ds[:, mask] /= sx[mask]
    (uy, sy, vy) = svd(y, 0)
    vy_ds = vy.T
    mask = (sy > tolerance)
    if (mask.sum() < len(mask)):
        raise ValueError('endog    is    collinear.')
    vy_ds[:, mask] /= sy[mask]
    (u, s, v) = svd(ux.T.dot(uy), 0)
    self.cancorr = np.array([max(0, min(s[i], 1)) for i in range(len(s))])
    self.x_cancoef = vx_ds.dot(u[:, :k])
    self.y_cancoef = vy_ds.dot(v.T[:, :k])
