Description Usage Arguments Details Value References See Also Examples
View source: R/spectral_entropy.R
Estimates spectral entropy from a univariate (or multivariate) normalized spectral density.
1 2 3 4 5 6 7 |
series |
univariate time series of length T. In the rare case
that users want to call this for a multivariate time |
spectrum.control |
list; control settings for spectrum estimation.
See |
entropy.control |
list; control settings for entropy estimation.
See |
mvspectrum.output |
optional; one can directly provide an estimate of
the spectrum of |
... |
additional arguments passed to |
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.
A non-negative real value for the spectral entropy H_s(x_t).
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.
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("mvspec", "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 = "mvspec"))
}
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.