'The likelihood function for the OLS model.
Parameters
params : array-like
The coefficients with which to estimate the log-likelihood.
scale : float or None
If None, return the profile (concentrated) log likelihood
(profiled over the scale parameter), else return the
log-likelihood using the given scale value.
Returns
The likelihood function evaluated at params.'

def loglike(self, params, scale=None):

    nobs2 = (self.nobs / 2.0)
    nobs = float(self.nobs)
    resid = (self.endog - np.dot(self.exog, params))
    if hasattr(self, 'offset'):
        resid -= self.offset
    ssr = np.sum((resid ** 2))
    if (scale is None):
        llf = ((((- nobs2) * np.log((2 * np.pi))) - (nobs2 * np.log((ssr / nobs)))) - nobs2)
    else:
        llf = (((- nobs2) * np.log(((2 * np.pi) * scale))) - (ssr / (2 * scale)))
    return llf
