Learn R Programming

seewave (version 1.6.4)

ks.dist: Kolmogorov-Smirnov distance

Description

Compare two distributions (e.g. two frequency spectra) by computing the Kolmogorov-Smirnov distance

Usage

ks.dist(spec1, spec2, f = NULL, plot = FALSE, type = "l",
col = c("blue", "red"),
lty = c(2, 4), flab = "Frequency (kHz)",
alab = "Cumulated amplitude", flim = c(0, f/2000),
alim = c(0, 1), title = TRUE, legend = TRUE, ...)

Arguments

Value

  • The function returns a list of two items
  • Dthe Kolomogorv-Smirnov distance
  • Fthe frequency (in KHz) where the Kolmogorov-Smirnov distance was found

Details

The Kolmogorov distance is the maximal distance between the cumulated spectra. The function returns this distance and the corresponding frequency. This is an adaptation of the statistic computed by the non-parametric Kolmogorov-Smirnov test (see ks.test).

See Also

kl.dist, simspec, diffspec

Examples

Run this code
# Comparison of two spectra and plot of the cumulated spectra with the K-S distance
data(tico)
tico1 <- spec(tico, at=0.65, plot=FALSE)
tico2 <- spec(tico, at=1.1, plot=FALSE)
ks.dist(tico1, tico2, plot=TRUE)

Run the code above in your browser using DataLab