symba {seewave}R Documentation

Symbol analysis of a numeric (time) series

Description

This function analyses one or two sequences of symbols from numeric (time) series.

Usage

symba(x, y = NULL, symb = 5, collapse = TRUE, entropy = "abs",
plot = FALSE, type = "l", lty1 = 1, lty2 = 2, col1 = 2, col2 = 4,
cex1 = 0.75, cex2= 0.75, xlab = "index", ylab = "Amplitude", legend=TRUE, ...)

Arguments

x

a first R object.

y

a second R object

symb

the number of symbols used for the discretisation, can be set to 3 or 5 only.

collapse

logical, if TRUE, the symbols are pasted in a character string of length 1.

entropy

either "abs" for an absolute value or "rel" for a relative value, i. e. between 0 and 1.

plot

logical, if TRUE plots the series x (and y) and the respective symbols.

type

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

lty1

line type of the object x if type="l".

lty2

line type of the object y if type="l".

col1

colour of the object x.

col2

colour of the object y.

cex1

character size of x symbols.

cex2

character size of y symbols.

xlab

title of the x axis.

ylab

title of the y axis.

legend

logical, if TRUE and if y is not NULL adds a legend to the plot.

...

other plot graphical parameters.

Details

The analysis consists in transforming the series into a sequence of symbols (see the function discrets) and in computing the absolute frequency of each symbol within the sequence.
The entropy (H) is then calculated using the symbol frequencies. Using the argument entropy, the entropy can be expressed along an absolute scale or as a relative value varying between 0 and 1.
If two numeric (time) series are provided (x and y) the absolute symbol frequencies and entropy of each series is returned. Besides the mutual information (I) is estimated according to:

I = Hx + Hy - Hxy

with Hx the entropy of x symbol series, Hy the entropy of y symbol series, and Hxy$ the joint entropy of x and y symbol series.

Value

If y is NULL a list of three items is returned (s1, freq1, h1).
If y is not NULL, a list of 6 items is returned (s1, freq1, h1, s2, freq2, h2, I):

s1

the sequence of symbols of x,

freq1

the relative frequency of each x symbol,

h1

the entropy of x symbol sequence,

s2

the sequence of symbols of y,

freq2

the relative frequency of each y symbol,

h2

the entropy of y symbol sequence,

I

the mutual information between x and y.

Note

It might be useful to round the values of the input series (see examples).
The mutual information (I) should increase with the similarity between the series to compare (x and y).

Author(s)

Jerome Sueur sueur@mnhn.fr

References

Cazelles, B. 2004 Symbolic dynamics for identifying similarity between rhythms of ecological time series. Ecology Letters, 7: 755-763.

See Also

discrets, SAX

Examples

# analysis of a frequency spectrum
data(tico)
spec1<-spec(tico,f=22050,at=0.2,plot=FALSE)
symba(spec1[,2],plot=TRUE)
# it might be better to round the values
symba(round(spec1[,2],2),plot=TRUE)
# in that case the symbol entropy is close to the spectral entropy
symba(round(spec1[,2],2),entrop="rel")$h1
sh(spec1)
# to compare two frequency spectra
spec2<-spec(tico,f=22050,wl=512,at=1.1,plot=FALSE)
symba(round(spec1[,2],2),round(spec2[,2],2),plot=TRUE)

[Package seewave version 2.1.6 Index]