ARllog: log-likelihood associated with an AR(p) model defined either through
its natural coefficients or through the roots of the associated lag-polynomial
Description
This function is related to Chapter 6 on dynamical models.
It returns the numerical value of the log-likelihood associated with a time
series and an AR(p) model, along with the natural coefficients $psi$ of the AR(p) model
if it is defined via the roots lr and lc of the associated lag-polynomial.
The function thus uses either the natural parameterisation of the AR(p) model
$$x_t - \mu + \sum_{i=1}^p \psi_i (x_{t-i}-\mu) = \varepsilon_t$$
or the parameterisation via the lag-polynomial roots
$$\prod_{i=1}^p (1-\lambda_i B) x_t = \varepsilon_t$$
where $B^j x_t = x_{t-j}$.
complex roots, stored as real part for odd indices and
imaginary part for even indices
mu
drift coefficient $\mu$ such that $(x_t-\mu)_t$ is a standard AR$(p)$ series
sig2
variance of the Gaussian white noise $(\varepsilon_t)_t$
compsi
boolean variable indicating whether the coefficients $\psi_i$ need to be retrieved
from the roots of the lag-polynomial, i.e. if the model is defined by pepsi (when compsi
is FALSE) or by lr and l
pepsi
potential p+1 coefficients $\psi_i$ if compsi is FALSE, with 1 as
the compulsory first value