Description Usage Arguments Value Author(s) References See Also Examples
Details of this algorithm are given in McLeod and Zhang (2007).
1 | GetARMeanMLE(z, phi)
|
z |
vector of length n containing the time series |
phi |
vector of AR coefficients |
Estimate of mean
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 9 10 11 12 13 14 15 16 17 18 19 20 21 | #Simulate a time series with mean zero and compute the exact
#mle for mean and compare with sample average.
## Not run: #save time building package!
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(phi, 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
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.