loglikef computes the logarithm of likelihood function from the PARMA
sequence x for matrices
phi (of size $T \times p$) and theta (of size $T \times (q+1)$)
inputed in their Fourier representation as a and b, respectively.loglikef(ab, x, conpars)[a,b] taken as a vector, where
a is Fourier representation of phi
(use phi=ab2phth(a) to recover phi),
b is Fourier representation of theta
(use del=[T,p,q,naf,nbf,del_mask,iaf,ibf,stype]:
T period of PC-T structure,
p, q maximum PAR and PMA order, respectively,
naf, nbf total active coefficients in a and by.phi and theta coefficients
and a and b coefficients is one-to-one, so first
logarithm of likelihood is computed for transformed coefficients and then these coefficients are transformed to phi and theta.
Fourier series parametrization permits us
to reduce the total number of parameters by constraining some frequencies to have zero amplitude. Then the code includes
the computation of covariance matrix from the parameters phi, del, theta.
Since the inverse of the computed covariance is needed for computing the likelihood, and it is sometimes ill conditioned (or even singular), the condition is improved by removing rows and columns corresponding to very small eigenvalues. This corresponds to removing input data that is highly linearly dependent on the remaining input data. The procedure contains a threshold ZTHRS (which current value is 10*eps) that governs the discarding of rows and column corresponding to small eigenvalues (these are determined by a Cholesky decomposition). Any eigenvalue smaller than the threshold has its row and column deleted from the matrix. Then the
inverse and the likelihood are computed from the reduced rank covariance matrix.R_w_ma, parmaresid, parmaf