specFGN: Spectral Density of Fractional Gaussian Noise

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/WhittleEst.R

Description

Calculation of the spectral density f of normalized fractional Gaussian noise with self-similarity parameter H at the Fourier frequencies 2*pi*j/m (j=1,...,(m-1)).

B.specFGN computes (approximations of) the B(λ, H) component of the spectrum f_H(λ).

Usage

1
2
  specFGN(eta, m, ...)
B.specFGN(lambd, H, k.approx=3, adjust = (k.approx == 3), nsum = 200)

Arguments

eta

parameter vector eta = c(H, *).

m

sample size determining Fourier frequencies.

...

optional arguments for B.specFGN(): k.approx, etc

lambd

numeric vector of frequencies in [0, pi]

H

Hurst parameter in (1/2, 1), (can be outside, here).

k.approx

either integer (the order of the Paxson approximation), or NULL, NA for choosing to use the slow direct sum (of nsum terms.)

adjust

logical indicating (only for k.approx == 3, the default) that Paxson's empirical adjustment should also be used.

nsum

if the slow sum is used (e.g. for k.approx = NA), the number of terms.

Details

Note that

  1. cov(X(t),X(t+k)) = integral[ exp(iuk)f(u)du ]

  2. f=theta1*spec and integral[log(spec)]=0.

Since longmemo version 1.1-0, a fast approximation is available (and default), using k.approx terms and an adjustment (adjust=TRUE in the default case of k.approx=3), which is due to the analysis and S code from Paxson (1997).

Value

specFGN() returns an object of class "spec" (see also spectrum) with components

freq

the Fourier frequencies om_j in (0,pi)) at which the spectrum is computed. Note that om_j = 2*pi*j/m for j=1,..., m-1, and m = floor((n-1)/2).

spec

the scaled values spectral density f(λ) values at the freq values of λ.
f*(lambda) = f(lambda) / theta1 adjusted such \int \log(f^*(λ)) dλ = 0.

theta1

the scale factor θ_1.

H

the self-similarity parameter from input.

method

a character indicating the kind of model used.

B.specFGN() returns a vector of (approximate) values B(λ, H).

Author(s)

Jan Beran originally (using the slow sum); Martin Maechler, based on Vern Paxson (1997)'s code.

References

Jan Beran (1994). Statistics for Long-Memory Processes; Chapman & Hall, NY.

Vern Paxson (1997). Fast, Approximate Synthesis of Fractional Gaussian Noise for Generating Self-Similar Network Traffic; Computer Communications Review 27 5, 5–18.

See Also

The spectral estimate for fractional ARIMA, specARIMA; more generally, spectrum.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
 str(rg.7  <- specFGN(0.7, m = 100))
 str(rg.5  <- specFGN(0.5, m = 100))# { H = 0.5 <--> white noise ! }

 plot(rg.7) ## work around plot.spec() `bug' in R < 1.6.0
 plot(rg.5, add = TRUE, col = "blue")
 text(2, mean(rg.5$spec), "H = 0.5 [white noise]", col = "blue", adj = c(0,-1/4))

## This was the original method in longmemo, upto version 1.0-0 (incl):
 rg.7.o <- specFGN(0.7, m = 100, k.approx=NA, nsum = 200)
 ## quite accurate (but slightly slower):
 rg.7f  <- specFGN(0.7, m = 100, k.approx=NA, nsum = 10000)
 ## comparing old and new default :
 all.equal(rg.7, rg.7.o)# different in about 5th digit
 all.equal(rg.7, rg.7f )# ==> new default is *more* accurate: 1.42 e-6
 ## takes about  7 sec {in 2011}:
 rg.7ff <- specFGN(0.7, m = 100, k.approx=NA, nsum = 500000)
 all.equal(rg.7f, rg.7ff)# ~ 10 ^ -7
 all.equal(rg.7  $spec, rg.7ff$spec)# ~ 1.33e-6 -- Paxson is accurate!
 all.equal(rg.7.o$spec, rg.7ff$spec)# ~ 2.40e-5 -- old default is less so

longmemo documentation built on March 26, 2020, 7:42 p.m.