Learn R Programming

seewave (version 1.7.6)

diffcumspec: Difference between two cumulative frequency spectra

Description

This function compares two distributions (e.g. two frequency spectra) by computing the difference between two cumulative frequency spectra

Usage

diffcumspec(spec1, spec2, f = NULL,
plot = FALSE, type = "l", lty = c(1, 2), col = c(2, 4, 8),
flab = "Frequency (kHz)", alab = "Cumulated amplitude",
flim = NULL, alim = NULL,
title = TRUE, legend = TRUE, ...)

Arguments

spec1
any distribution, especially a spectrum obtained with spec or meanspec (not in dB). This can be either a two-column matrix (col1 = frequency, col2 = amplitude)
spec2
any distribution, especially a spectrum obtained with spec or meanspec (not in dB). This can be either a two-column matrix (col1 = frequency, col2 = am
f
sampling frequency of waves used to obtain spec1 and spec2 (in Hz). Not necessary if spec1 and/or spec2 is a two columns matrix obtained with spec
plot
logical, if TRUE plots both cumulative spectra and their distance.
type
if plot is TRUE, type of plot that should be drawn. See plot for details (by default "l" for lines).
col
a vector of length 3 for the colour of spec1, spec2, and the difference between each of them.
lty
a vector of length 2 for the line type of spec1 and spec2 if type="l".
flab
title of the frequency axis.
alab
title of the amplitude axis.
flim
the range of frequency values.
alim
range of amplitude axis.
title
logical, if TRUE, adds a title with D and F values.
legend
logical, if TRUE adds a legend to the plot.
...
other plot graphical parameters.

Value

  • A numeric vector of length 1 returning the difference between the two spectra. No unit.

Details

Both spectra are transformed into cumulative distribution functions (CDF). Spectral difference is then computed according to: $$D_{cf}(x, y) = \frac{\sum_{i=1}^{n}|X_{i} - Y_{i}|}{n}, with with X and Y the spectrum CDFs, and D \in [0,1].$$

References

Lellouch L, Pavoine S, Jiguet F, Glotin H, Sueur J (2014) Monitoring temporal change of bird communities with dissimilarity acoustic indices. Methods in Ecology and Evolution, in press.

See Also

kl.dist, ks.dist, simspec, diffspec, logspec.dist, itakura.dist

Examples

Run this code
data(tico)
tico1 <- spec(tico, at=0.65, plot=FALSE)
tico2 <- spec(tico, at=1.1, plot=FALSE)
diffcumspec(tico1, tico2, plot=TRUE)

Run the code above in your browser using DataLab