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 |
m |
sample size determining Fourier frequencies. |
... |
optional arguments for |
lambd |
numeric vector of frequencies in [0, pi] |
H |
Hurst parameter in |
k.approx |
either integer (the order of the Paxson approximation), or
|
adjust |
logical indicating (only for |
nsum |
if the slow sum is used (e.g. for k.approx = NA), the number of terms. |
Details
Note that
cov(X(t),X(t+k)) = integral[ exp(iuk)f(u)du ]
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 |
spec |
the scaled values spectral density |
theta1 |
the scale factor |
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