Learn R Programming

FGN (version 2.0-12)

GetFitFGN: Fit FGN Time Series Model

Description

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. In this model, alpha=2-2*H.

Usage

GetFitFGN(z, MeanZeroQ = FALSE, algorithm=c("emle", "wmle"), ciQ=FALSE)

Arguments

z
time series data vector
MeanZeroQ
optional argument, default is MeanZeroQ=FALSE. Set to TRUE if the mean is known to be zero
algorithm
"emle" or "wmle" for exact or Whittle mle
ciQ
TRUE or FALSE according as 95 percent confidence interval computed and plotted

Value

a list with four/five elements:
H
MLE for H
Loglikelihood
value of the maximized loglikelihood
alpha
MLE for alpha
algorithm
either "emle" or "wmle"
ci
95 percent confidence interval for H

Details

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.

References

McLeod, A.I., Yu, Hao, Krougly, Zinovi L. (2007). Algorithms for Linear Time Series Analysis, Journal of Statistical Software.

See Also

optimize, optim, Boot.FitFGN, FitFGN, FitRegressionFGN

Examples

Run this code
#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"))

Run the code above in your browser using DataLab