'Loglikelihood for timeseries model
Notes
needs to be overwritten by subclass
make more generic with using function _convertparams
which could also include parameter transformation
_convertparams_in, _convertparams_out
allow for different distributions t, ged,...'

def loglike(self, params):

    (p, q) = (self.nar, self.nma)
    ar = np.concatenate(([1], params[:p]))
    ma = np.concatenate(([0], params[p:(p + q)]))
    mu = params[(-1)]
    params = (ar, ma, mu)
    h = self.geth(params)
    self.params_converted = params
    self.h = h
    sigma2 = np.maximum(h, 1e-06)
    axis = 0
    nobs = len(h)
    axis = 0
    llike = ((-0.5) * ((np.sum(np.log(sigma2), axis) + np.sum(((self.endog ** 2) / sigma2), axis)) + (nobs * np.log((2 * np.pi)))))
    return llike
