specFGN {longmemo}R Documentation

Spectral Density of Fractional Gaussian Noise

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(\lambda, H) component of the spectrum f_H(\lambda).

Usage

  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 (\frac 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 \omega_j \in (0,\pi)) at which the spectrum is computed. Note that omega_j = 2\pi j/m for j=1,..., m-1, and m = \left\lfloor\frac{n-1}{2}\right\rfloor.

spec

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

theta1

the scale factor \theta_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(\lambda, 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

 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


[Package longmemo version 1.1-2 Index]