covspectro: Covariance between two spectrograms

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/seewave.r

Description

This function tests the similarity between two spectrograms by returning their maximal covariance and the time shift related to it.

Usage

1
2
3
4
5
covspectro(wave1, wave2, f, channel = c(1,1), wl = 512, wn = "hanning", n,
plot = TRUE, plotval = TRUE,
method = "spearman", col = "black", colval = "red", cexval = 1,
fontval = 1, xlab = "Time (s)",
ylab = "Normalised covariance (cov)", type = "l", pb = FALSE, ...)

Arguments

wave1

a first R object.

wave2

a second R object.

f

sampling frequency of wave (in Hz). Does not need to be specified if embedded in wave.

channel

channel of the R objects, by default left channel (1) for each object.

wl

length of the window for the analysis (even number of points, by default = 512).

wn

window name, see ftwindow (by default "hanning").

n

number of covariances computed between wave1 and wave2 when sliding wave2 along wave1.

plot

logical, if TRUE plots r values against frequency shift (by default TRUE).

plotval

logical, if TRUE adds to the plot maximum R value and frequency offset (by default TRUE).

method

a character string indicating which correlation coefficient is to be computed ("pearson", "spearman", or "kendall") (see cor).

col

colour of r values.

colval

colour of r max and frequency offset values.

cexval

character size of r max and frequency offset values.

fontval

font of r max and frequency offset values.

xlab

title of the frequency axis.

ylab

title of the r axis.

type

if plot is TRUE, type of plot that should be drawn. See plot for details (by default "l" for lines).

pb

if TRUE returns a text progress bar in the console.

...

other plot graphical parameters.

Details

Successive covariances between the spectrogram of wave1 and the spectrogram of wave2 are computed when regularly sliding forward and backward wave2 along wave1.
The maximal covariance is obtained at a particular shift (time offset). This shift may be positive or negative.
n sets in how many steps wave2 will be slided along wave1. Time process can be then decreased by setting low n value.
Inverting wave1 and wave2 may give slight different results.

Value

If plot is FALSE, covspectro returns a list containing three components:

cov

the successive covariance values between wave1 and wave2.

covmax

the maximum covariance between wave1 and wave2.

t

the time offset corresponding to cov.

Author(s)

Jerome Sueur sueur@mnhn.fr

References

Hopp, S. L., Owren, M. J. and Evans, C. S. (Eds) 1998. Animal acoustic communication. Springer, Berlin, Heidelberg.

See Also

corspec, corenv, spectro, cor,

Examples

1
2
3
4
5
6
7
8
# covariance between two notes of a birdsong
## Not run: 
data(tico)
note1<-cutw(tico, f=22050, from=0.5, to=0.9)
note2<-cutw(tico, f=22050, from=0.9, to=1.3)
covspectro(note1,note2,f=22050,n=37)

## End(Not run)

Example output

please wait...

seewave documentation built on July 14, 2021, 5:10 p.m.

Related to covspectro in seewave...