'Returns the value of the Gaussian log-likelihood function at params.
Given the whitened design matrix, the log-likelihood is evaluated
at the parameter vector `params` for the dependent variable `endog`.
Parameters
params : array-like
The parameter estimates
Returns
loglike : float
The value of the log-likelihood function for a GLS Model.
Notes
The log-likelihood function for the normal distribution is
.. math:: -\frac{n}{2}\log\left(\left(Y-\hat{Y}\right)^{\prime}\left(Y-\hat{Y}\right)\right)-\frac{n}{2}\left(1+\log\left(\frac{2\pi}{n}\right)\right)-\frac{1}{2}\log\left(\left|\Sigma\right|\right)
Y and Y-hat are whitened.'

def loglike(self, params):

    nobs2 = (self.nobs / 2.0)
    SSR = np.sum(((self.wendog - np.dot(self.wexog, params)) ** 2), axis=0)
    llf = ((- np.log(SSR)) * nobs2)
    llf -= ((1 + np.log((np.pi / nobs2))) * nobs2)
    if np.any(self.sigma):
        if (self.sigma.ndim == 2):
            det = np.linalg.slogdet(self.sigma)
            llf -= (0.5 * det[1])
        else:
            llf -= (0.5 * np.sum(np.log(self.sigma)))
    return llf
