sh {seewave} | R Documentation |
Shannon and Renyi spectral entropy
Description
This function computes the Shannon or Renyi entropy of a frequency spectrum
Usage
sh(spec, alpha = "shannon")
Arguments
spec |
a data set resulting of a spectral analysis obtained
with |
alpha |
a character string, by default |
Details
. Shannon spectral entropy is calculated according to:
S = -\frac{\sum_{i = 1}^{N} y_i log_2(y_i)}{log_2(N)}
. Simpson or Gini-Simpson spectral entropy (or index) is computed according to:
GS = 1 - \sum_{i=1}^{N} y_{i}^2
. Renyi spectral entropy of order alpha is calucalted according to:
R = \frac{1}{1-\alpha} \times log_2(\sum_{i = 1}^{N} y_{i}^{\alpha})
with
\alpha \geq 0
\alpha \neq 1
y = relative amplitude of the i frequency,
\sum_{i = 1}^{N} y_i = 1
and N = number of frequencies.
Value
A numeric vector of length 1 is returned. The value has no unit.
Note
The Shannon entropy scaled between 0 and 1 is also known as Pielou's evenness index
Note
The Shannon spectral entropy of a noisy signal will tend towards 1 whereas the Shannon spectral entropy of a pure tone signal will tend towards 0. See Han et al. for details regarding the Renyi entropy.
Author(s)
Jerome Sueur and Laurent Lellouch
References
Han, NC, Muniandy SV, Dayou J (2011) Acoustic classification of
Australian anurans based on hybrid spectral-entropy approach. Applied
Acoustics.
Nunes RR, Almeida de MP, Sleigh JW (2004) -
Spectral entropy: a new method for anesthetic adequacy.
Revista Brasileira de Anestesiologia, 54, 413-422.
Renyi A (1961) - On measures of information and entropy. Proceedings
of the 4th Berkeley Symposium on Mathematics, Statistics and
Probability 1960. pp. 547-561.
Simpson EH (1949) - Measurement of diversity. Nature, 163, 688.
See Also
Examples
a<-synth(f=8000,d=1,cf=2000,plot=FALSE)
speca<-spec(a,f=8000,at=0.5,plot=FALSE)
## Shannon spectral entropy
sh(speca)
# [1] 0.2336412
b<-noisew(d=1,f=8000)
specb<-spec(b,f=8000,at=0.5,plot=FALSE)
sh(specb)
# close to 1
## Renyi spectral entropy
sh(speca, alpha=2)
sh(speca, alpha=3)