Learn R Programming

FitAR (version 1.94)

LoglikelihoodAR: Exact Loglikelihood for AR

Description

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

Usage

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

Value

  • The value of the loglikelihood is returned

Warning

No check is done for stationary-causal process

Details

Eqn (6) of McLeod and Zhang (2006) may be written $$-(n/2) \log(\hat\sigma_a^2) - (1/2) \log(g_p),$$ where $\hat\sigma_a^2$ is the residual variance and $g_p$ is the covariance determinant.

References

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

See Also

FastLoglikelihoodAR

Examples

Run this code
#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))

Run the code above in your browser using DataLab