spectral_entropy: Estimates spectral entropy of a time series

Description Usage Arguments Details Value References See Also Examples

View source: R/spectral_entropy.R

Description

Estimates spectral entropy from a univariate (or multivariate) normalized spectral density.

Usage

1
2
spectral_entropy(series = NULL, spectrum.control = list(),
  entropy.control = list(), mvspectrum.output = NULL, ...)

Arguments

series

univariate time series of length T. In the rare case that users want to call this for a multivariate time series, note that the estimated spectrum is in general not normalized for the computation. Only if the original data is whitened, then it is normalized.

spectrum.control

list; control settings for spectrum estimation. See complete_spectrum_control for details.

entropy.control

list; control settings for entropy estimation. See complete_entropy_control for details.

mvspectrum.output

optional; one can directly provide an estimate of the spectrum of series. Usually the output of mvspectrum.

...

additional arguments passed to mvspectrum.

Details

The spectral entropy equals the Shannon entropy of the spectral density f_x(λ) of a stationary process x_t:

H_s(x_t) = - \int_{-π}^{π} f_x(λ) \log f_x(λ) d λ,

where the density is normalized such that \int_{-π}^{π} f_x(λ) d λ = 1. An estimate of f(λ) can be obtained by the (smoothed) periodogram (see mvspectrum); thus using discrete, and not continuous entropy.

Value

A non-negative real value for the spectral entropy H_s(x_t).

References

Jerry D. Gibson and Jaewoo Jung (2006). “The Interpretation of Spectral Entropy Based Upon Rate Distortion Functions”. IEEE International Symposium on Information Theory, pp. 277-281.

L. L. Campbell, “Minimum coefficient rate for stationary random processes”, Information and Control, vol. 3, no. 4, pp. 360 - 371, 1960.

See Also

Omega, discrete_entropy

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
set.seed(1)
eps <- rnorm(100)
spectral_entropy(eps)

phi.v <- seq(-0.95, 0.95, by = 0.1)
kMethods <- c("wosa", "multitaper", "direct", "pgram")
SE <- matrix(NA, ncol = length(kMethods), nrow = length(phi.v))
for (ii in seq_along(phi.v)) {
  xx.tmp <- arima.sim(n = 200, list(ar = phi.v[ii]))
  for (mm in seq_along(kMethods)) {
    SE[ii, mm] <- spectral_entropy(xx.tmp, spectrum.control = 
                                     list(method = kMethods[mm]))
  }
}

matplot(phi.v, SE, type = "l", col = seq_along(kMethods))
legend("bottom", kMethods, lty = seq_along(kMethods), 
       col = seq_along(kMethods))
       
# AR vs MA
SE.arma <- matrix(NA, ncol = 2, nrow = length(phi.v))
SE.arma[, 1] <- SE[, 2]

for (ii in seq_along(phi.v)){
  yy.temp <- arima.sim(n = 1000, list(ma = phi.v[ii]))
  SE.arma[ii, 2] <- 
    spectral_entropy(yy.temp, spectrum.control = list(method = "multitaper"))
}

matplot(phi.v, SE.arma, type = "l", col = 1:2, xlab = "parameter (phi or theta)",
        ylab = "Spectral entropy")
abline(v = 0, col = "blue", lty = 3)
legend("bottom", c("AR(1)", "MA(1)"), lty = 1:2, col = 1:2)

ForeCA documentation built on May 29, 2017, 9:09 a.m.