GetFitFGN {FGN} | R Documentation |
Exact maximum likelihood estimation of the parameter H
in fractional Gaussian noise (FGN).
This is a utility function used by FitFGN
but
it is also useful in simulation experiments since it is
faster than using FitFGN
.
See example below.
GetFitFGN(z, MeanZeroQ = FALSE)
z |
time series data vector |
MeanZeroQ |
optional argument, default is MeanZeroQ=FALSE. Set to TRUE if the mean is known to be zero |
The function optimize
is used.
It is very rare but it has been observed that optimize
can incorrectly choose
an endpoint. If this happens a warning is given and optim
is used.
a list with two elements:
Loglikelihood |
value of the maximized loglikelihood |
H |
MLE for H |
A.I. McLeod
McLeod, A.I., Yu, Hao, Krougly, Zinovi L. (2007). Algorithms for Linear Time Series Analysis, Journal of Statistical Software.
optimize
,
optim
,
Boot.FitFGN
,
FitFGN
,
FitRegressionFGN
#Example 1 #fit Gaussian White Noise, H=0.5 z<-rnorm(500, 100, 10) GetFitFGN(z) #Example 2 #estimate H for NileMin series data(NileMin) GetFitFGN(NileMin) #Example 3 #Timing comparison for GetFitFGN and FitFGN ns<-c(500,1000) #may extend this to other n's H<-0.8 nR<-10 tim1<-tim2<-numeric(length(ns)) for (i in 1:length(ns)){ n <- ns[i] t1<-t2<-0 s1<-proc.time()[1] for (iR in 1:nR){ z<-SimulateFGN(n, H) H1<-GetFitFGN(z) } e1<-proc.time()[1] t1<-t1+(e1-s1) s2<-proc.time()[1] for (iR in 1:nR){ z<-SimulateFGN(n, H) H2<-FitFGN(z) } e2<-proc.time()[1] t2<-t2+(e2-s2) tim1[i]<-t1 tim2[i]<-t2 } tb<-matrix(c(tim1,tim2),ncol=2) dimnames(tb)<-list(ns,c("GetFitFGN","FitFGN"))