GetARMeanMLE(FitAR)R Documentation

Exact mle for mean in AR(p)

Description

Details of this algorithm are given in McLeod and Zhang (2006).

Usage

GetARMeanMLE(z, phi)

Arguments

z vector of length n containing the time series
phi vector of AR coefficients

Value

estimate of mean

Author(s)

A.I. McLeod

References

McLeod, A.I. and Zhang, Y. (2006, Accepted), Faster ARMA Maximum Likelihood Estimation, Computational Statistics and Data Analysis.

See Also

mean

Examples

#Simulate a time series with mean zero and compute the exact
#mle for mean and compare with sample average.
 set.seed(3323)
 phi<-c(2.7607,-3.8106,2.6535,-0.9238)
 z<-SimulateGaussianAR(phi,1000)
 ans1<-mean(z)
 ans2<-GetARMeanMLE(z,phi)
# define a direct MLE function
"DirectGetMeanMLE" <-
function(z, phi){
    GInv<-solve(toeplitz(TacvfAR(z, length(z)-1)))
    g1<-colSums(GInv)
    sum(g1*z)/sum(g1)
}
ans3<-DirectGetMeanMLE(z,phi)
ans<-c(ans1,ans2,ans3)
names(ans)<-c("mean", "GetARMeanMLE","DirectGetMeanMLE")
ans

[Package FitAR version 1.0 Index]