# loglikef: Calculation of the logarithm of likelihood function (using... In perARMA: Periodic Time Series Analysis

## Description

Procedure 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.

## Usage

 1 loglikef(ab, x, conpars) 

## Arguments

 ab matrix [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=ab2phth(b[,1]) to recover del and theta=ab2phth(b[,2:q+1]) to recover theta). Vector ab contains only non-zero coefficients form a and b. x input time series. conpars vector of parameters [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 b, respectively, del_mask vector of length T (it will be used in the future, so far the user should set del_mask=matrix(1,T,1)), iaf, ibf linear indexes of active coefficients in a and b, respectively, stype numeric parameter connected with covariance matrix computation, so far should be equal to 0 to use procedure R_w_ma (see R_w_ma description). In the future also other values of stype will be available for full covariance matrix computation.

## Details

This method of computation of logarithm of likelihood function makes use of the representation of the periodically varying parameters by Fourier series. This alternative parametrization of PARMA system, introduced by Jones and Breslford, can sometimes substantially reduce the number of parameters required to represent PARMA system. Mapping between 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.

## Value

negative value of the logarithm of likelihood function: y.

## Note

In the loglikef procedure, motivated by the possibility of deficient rank sequences, we made a variant of the Cholesky decomposition. In proposed approach upper traingular matrix eliminates data points that are lineary dependant on previous ones and removes their consideration in the likelihood value calculation. As a consequence data vector is reduced so that covariance matrix is positive definite and problem of non-invertible covariance matrix is avoided.
This function is used in parmaf procedure, thus for more details please look also at parmaf code.

Harry Hurd

## References

Box, G. E. P., Jenkins, G. M., Reinsel, G. (1994), Time Series Analysis, 3rd Ed., Prentice-Hall, Englewood Cliffs, NJ.

Brockwell, P. J., Davis, R. A., (1991), Time Series: Theory and Methods, 2nd Ed., Springer: New York.

Jones, R., Brelsford, W., (1967), Time series with periodic structure, Biometrika 54, 403-408.

Makagon, A., (1999), Theoretical prediction of periodically correlated sequences, Probability and Mathematical Statistics 19 (2), 287-322.

Sakai, H., (1989), On the spectral density matrix of a periodic ARMA process, J. Time Series Analysis, v. 12, no. 2, pp. 73-82.

Vecchia, A., (1985), Maximum Likelihood Estimation for Periodic Autoregressive Moving Average Models, Technometrics, v. 27, pp.375-384.

R_w_ma, parmaresid, parmaf