'The loglikelihood of an AR(p) process
Parameters
params : array
The fitted parameters of the AR model
Returns
llf : float
The loglikelihood evaluated at `params`
Notes
Contains constant term.  If the model is fit by OLS then this returns
the conditonal maximum likelihood.
.. math:: \frac{\left(n-p\right)}{2}\left(\log\left(2\pi\right)+\log\left(\sigma^{2}\right)\right)-\frac{1}{\sigma^{2}}\sum_{i}\epsilon_{i}^{2}
If it is fit by MLE then the (exact) unconditional maximum likelihood
is returned.
.. math:: -\frac{n}{2}log\left(2\pi\right)-\frac{n}{2}\log\left(\sigma^{2}\right)+\frac{1}{2}\left|V_{p}^{-1}\right|-\frac{1}{2\sigma^{2}}\left(y_{p}-\mu_{p}\right)^{\prime}V_{p}^{-1}\left(y_{p}-\mu_{p}\right)-\frac{1}{2\sigma^{2}}\sum_{t=p+1}^{n}\epsilon_{i}^{2}
where
:math:`\mu_{p}` is a (`p` x 1) vector with each element equal to the
mean of the AR process and :math:`\sigma^{2}V_{p}` is the (`p` x `p`)
variance-covariance matrix of the first `p` observations.'

def loglike(self, params):

    if (self.method == 'cmle'):
        return self._loglike_css(params)
    else:
        return self._loglike_mle(params)
