# LoglikelihoodAR: Exact Loglikelihood for AR In FitAR: Subset AR Model Fitting

## Description

The exact loglikelihood function, defined in eqn. (6) of McLeod & Zhang (2006) is computed. Requires O(n) flops, n = length(z).

## Usage

 1 LoglikelihoodAR(phi, z, MeanValue = 0) 

## Arguments

 phi AR parameters z time series data, not assumed mean corrected MeanValue usually this is mean(z) but it could be another value for example the MLE of the mean

## Details

Eqn (6) of McLeod and Zhang (2006) may be written

-(n/2) \log(\hatσ_a^2) - (1/2) \log(g_p),

where \hatσ_a^2 is the residual variance and g_p is the covariance determinant.

## Value

The value of the loglikelihood is returned

## Warning

No check is done for stationary-causal process

## Note

For MLE computation it is better to use FastLoglikelihoodAR since for repeated likelihood evaluations this requires only O(1) flops vs O(n) flops, where n = length(z).

## Author(s)

A.I. McLeod and Y. Zhang

## References

McLeod, A.I. and Zhang, Y. (2006). Partial autocorrelation parameterization for subset autoregression. Journal of Time Series Analysis, 27, 599-612.

FastLoglikelihoodAR
 1 2 3 4 5 6 7 8 #Fit a subset model to Series A and verify the loglikelihood out<-FitAR(SeriesA, c(1,2,7)) out #either using print.default(out) to see the components in out #or applying LoglikelihoodAR () by first obtaining the phi parameters as out$phiHat. # LoglikelihoodAR(out$phiHat, SeriesA, MeanValue=mean(SeriesA))