'Fit a linear model using ridge regression.
Parameters
alpha : scalar or array-like
The penalty weight.  If a scalar, the same penalty weight
applies to all variables in the model.  If a vector, it
must have the same length as `params`, and contains a
penalty weight for each coefficient.
Notes
Equivalent to fit_regularized with L1_wt = 0 (but implemented
more efficiently).'

def _fit_ridge(self, alpha):

    (u, s, vt) = np.linalg.svd(self.exog, 0)
    v = vt.T
    q = (np.dot(u.T, self.endog) * s)
    s2 = (s * s)
    if np.isscalar(alpha):
        sd = (s2 + (alpha * self.nobs))
        params = (q / sd)
        params = np.dot(v, params)
    else:
        vtav = (self.nobs * np.dot(vt, (alpha[:, None] * v)))
        d = (np.diag(vtav) + s2)
        np.fill_diagonal(vtav, d)
        r = np.linalg.solve(vtav, q)
        params = np.dot(v, r)
    from statsmodels.base.elastic_net import RegularizedResults
    return RegularizedResults(self, params)
