spectral_correlation: Measure frequency spectral correlation

View source: R/spectral_correlation.R

spectral_correlationR Documentation

Measure frequency spectral correlation

Description

spectral_correlation measures frequency spectrum correlation of signals referenced in an extended selection table.

Usage

spectral_correlation(X, parallel = 1, pb = TRUE, method = 1, 
cor.method = "pearson", output = "est", 
hop.size = 11.6, wl = NULL, ovlp = 70)

Arguments

X

object of class 'extended_selection_table' created by the function selection_table from the warbleR package.

parallel

Numeric vector of length 1. Controls whether parallel computing is applied by specifying the number of cores to be used. Default is 1 (i.e. no parallel computing). If NULL (default) then the current working directory is used.

pb

Logical argument to control if progress bar is shown. Default is TRUE.

method

Numeric vector of length 1 to indicate the 'experimental design' to measure frequency spectrum correlation. Two methods are available:

  • 1: compare all signals with their counterpart that was recorded at the closest distance to source (e.g. compare a signal recorded at 5m, 10m and 15m with its counterpart recorded at 1m). This is the default method.

  • 2: compare all signals with their counterpart recorded at the distance immediately before (e.g. a signal recorded at 10m compared with the same signal recorded at 5m, then signal recorded at 15m compared with same signal recorded at 10m and so on).

cor.method

Character string indicating the correlation coefficient to be applied ("pearson", "spearman", or "kendall", see cor).

output

Character vector of length 1 to determine if an extended selection table ('est', default) or a data frame ('data.frame').

hop.size

A numeric vector of length 1 specifying the time window duration (in ms). Default is 11.6 ms, which is equivalent to 512 wl for a 44.1 kHz sampling rate. Ignored if 'wl' is supplied.

wl

A numeric vector of length 1 specifying the window length of the spectrogram, default is NULL. If supplied, 'hop.size' is ignored.

ovlp

Numeric vector of length 1 specifying the percent overlap between two consecutive windows, as in spectro. Default is 70.

Details

spectral correlation measures the similarity of two signals in the frequency domain. The function measures the spectral correlation coefficients of signals in which a reference playback has been re-recorded at increasing distances. Values range from 1 (identical frequency spectrum, i.e. no degradation) to 0. The 'signal.type' column must be used to indicate the function to only compare signals belonging to the same category (e.g. song-types). The function will then compare each signal type to the corresponding reference signal. Two methods for calculating spectral correlation are provided (see 'method' argument). Use spectral_blur_ratio to get spectra for plotting.

Value

Extended selection table similar to input data, but also includes a new column ('spectrum.correlation') with the calculated frequency spectrum correlation coefficients.

Author(s)

Marcelo Araya-Salas (marcelo.araya@ucr.ac.cr)

References

Araya-Salas, M. (2020). baRulho: baRulho: quantifying habitat-induced degradation of (animal) acoustic signals in R. R package version 1.0.2

Apol, C.A., Sturdy, C.B. & Proppe, D.S. (2017). Seasonal variability in habitat structure may have shaped acoustic signals and repertoires in the black-capped and boreal chickadees. Evol Ecol. 32:57-74.

See Also

envelope_correlation, spectral_blur_ratio

Examples

{
# load example data
data("playback_est")

# remove ambient selections
pe <- playback_est[playback_est$signal.type != "ambient", ]

# method 1
spectral_correlation(X = pe)

# method 2
spectral_correlation(X = pe, method = 2)
}


baRulho documentation built on March 18, 2022, 7 p.m.