The exact loglikelihood function, defined in eqn. (6) of McLeod & Zhang (2006) is computed. Requires O(n) flops, n = length(z).
LoglikelihoodAR(phi, z, MeanValue = 0)
time series data, not assumed mean corrected
usually this is mean(z) but it could be another value for example the MLE of the mean
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.
The value of the loglikelihood is returned
No check is done for stationary-causal process
For MLE computation it is better to use
since for repeated likelihood evaluations this requires
only O(1) flops vs O(n) flops, where n = length(z).
A.I. McLeod and Y. Zhang
McLeod, A.I. and Zhang, Y. (2006). Partial autocorrelation parameterization for subset autoregression. Journal of Time Series Analysis, 27, 599-612.
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.