R: Fast Computation of the Loglikelihood Function in AR
FastLoglikelihoodAR
R Documentation
Fast Computation of the Loglikelihood Function in AR
Description
Computation of the loglikelihood is O(1) flops in repeated
evaluations of the loglikelihood holding the data fixed and varying
the parameters. This is useful in exact MLE estimation.
Usage
FastLoglikelihoodAR(phi, n, CD)
Arguments
phi
AR coefficients
n
length of series
CD
Champernowne matrix
Details
The details of this computation are described in McLeod and Zhang (2006).
Value
Loglikelihood
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.
See Also
ChampernowneD,
LoglikelihoodAR
Examples
#Compute the loglikelihood using the direct method as implemented
# in LoglikelihoodAR and using the fast method
phi<-PacfToAR(rep(0.5,10))
p<-length(phi)
z<-SeriesA-mean(SeriesA)
n<-length(z)
L1<-LoglikelihoodAR(phi, z)
cd<-ChampernowneD(z,p,MeanZero=TRUE)
L2<-FastLoglikelihoodAR(phi,n,cd)
out<-c(L1,L2)
names(out)<-c("direct","fast")
out
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(FitAR)
Loading required package: lattice
Loading required package: leaps
Loading required package: ltsa
Loading required package: bestglm
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/FitAR/FastLoglikelihoodAR.Rd_%03d_medium.png", width=480, height=480)
> ### Name: FastLoglikelihoodAR
> ### Title: Fast Computation of the Loglikelihood Function in AR
> ### Aliases: FastLoglikelihoodAR
> ### Keywords: ts
>
> ### ** Examples
>
> #Compute the loglikelihood using the direct method as implemented
> # in LoglikelihoodAR and using the fast method
> phi<-PacfToAR(rep(0.5,10))
> p<-length(phi)
> z<-SeriesA-mean(SeriesA)
> n<-length(z)
> L1<-LoglikelihoodAR(phi, z)
> cd<-ChampernowneD(z,p,MeanZero=TRUE)
> L2<-FastLoglikelihoodAR(phi,n,cd)
> out<-c(L1,L2)
> names(out)<-c("direct","fast")
> out
direct fast
-150.4904 -150.4904
>
>
>
>
>
> dev.off()
null device
1
>