# loglikec: Calculation of the logarithm of likelihood function In perARMA: Periodic Time Series Analysis

## Description

Function loglikec, given phi, del, theta encoded in ptvec, evaluates the logarithm of likelihood function from the PARMA series. Procedure returns also values of the AIC, FPE, BIC information criteria and MSE of residuals, what enables to examine residuals and evaluate godness of model fit.

## Usage

 1 loglikec(ptvec, x, conpars) 

## Arguments

 ptvec vector of parameters for PARMA(p,q) model, containing matrix parameters phi (of size T \times p), del (of size T \times 1), theta (of size T \times q) as following ptvec = [phi[,1],...,phi[,p],del,theta[,1], ...,theta[,q]]. x input time series. conpars vector of parameters [T, p, q, stype], T period of PC-T structure, p, q maximum PAR and PMA order, 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

In this procedure first series x is filtered by matrix coefficients phi, del, theta. The code to compute logarithm of likelihood function must 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

list of values:

 loglik logarithm of likehood function (nagative value). aicval value of AIC criterion. fpeval value of FPE criterion. bicval value of BIC criterion.

## Note

In the loglikec 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.

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.

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

Vecchia, A., (1985), Periodic autoregressive-moving average (PARMA) modeling with applications to water resources, Water Resources Bulletin, v. 21, no. 5.

R_w_ma, parmafil
 1 2 3 4 5 6 7 8 9 ## Do not run ## It could take a few seconds #data(volumes) #pmean<-permest(t(volumes),24, 0.05, NaN,'volumes', pp=0) #xd=pmean$xd #estimators<-perYW(volumes,24,2,NaN) #estvec=c(estimators$phi[,1],estimators$phi[,2],estimators$del) #loglikec(estvec,xd,c(24,2,0,0))