ZLAvian

Introduction

The package ZLAvian tests for patterns consistent with Zipf’s Law of Abbreviation (ZLA) in animal communication following the methods described in Lewis et al. (2023) and Gilman et al. (2023).

library(ZLAvian)

testZLA

This function measures and tests the statistical significance of the concordance between note duration and frequency of use in a sample of animal communication represented in a dataframe that must include columns with the following names and information:

Other columns in the dataframe are ignored in the analysis. Youngblood (2024) observed that the column duration might alternatively include data on any other numerical measure that estimates the effort involved in producing a note type.

testZLA computes the mean concordance (i.e., Kendall’s tau) between note duration and frequency of use within individuals, averages across all individuals in the data set, and compares this to the expectation under the null hypothesis that note duration and frequency of use are unrelated. The null distribution is computed by permutation while constraining for the observed similarity of note repertoires among individuals. This controls for the possibility that individuals in the population learn their repertoires from others. The significance test is one-tailed, so p-values close to 1 suggest evidence for a positive concordances, contrary to ZLA. See Lewis at al. (2023) for the formal computation of the null distribution and Gilman et al. (2023) for discussion.

Users can control the following parameters in testZLA:

data(testdata, package = "ZLAvian")
test.ZLA.output = testZLA(data, minimum = 1, null = 999, est = "mixed", cores = 2)
#>                          tau         p
#> individual level -0.03745038 0.4440000
#> population level -0.15000000 0.2088536

testZLA prints a table that reports concordances (tau) and p-values at the individual and population levels. Results at the individual level are obtained using the method described in Lewis et al (2023) and Gilman et al (2023). Results at the population level report the concordance between note type duration and frequency of use in the full dataset, without considering which individuals produced which notes. Population-level concordances may be problematic when studying ZLA in animal communication (see Gilman et al 2023 for discussion) but have been widely used to study ZLA in human languages.

Further information can be extracted from the function:

plotZLA

plotZLA uses the output of testZLA to create a web plot illustrating the concordance between note class duration and frequency of use within individuals in the population.

Users can control the following parameters in testZLA:

store <- testZLA(data, minimum = 1, null = 999, est = "mixed", cores = 2)
#>                          tau         p
#> individual level -0.03745038 0.4320000
#> population level -0.15000000 0.2088536

plotZLA(store, ylab = "duration (ms)", x.scale = "linear")

In the figure produced by plotZLA, each point represents a note or phrase type in the population repertoire. Note types are joined by a line if at least one individual produces both note types. The weight of the line is proportional to the number of individuals that produce both note types. The color of the lines indicates whether there is a positive (blue) or negative (red) concordance between the duration and frequency of use of the joined note types. Negative concordances are consistent with Zipf’s law of abbreviation. Shades between blue and red indicate that the concordance is positive in some individuals and negative in others. For example, this can happen if some individuals use the note types more frequently than others, such that the rank order of frequency of use varies among individuals. Grey crosses centered on each point show the longest and shortest durations of the note type (vertical) and the highest and lowest frequencies of use (horizontal) in the population.

References

Gilman, R. T., Durrant, C. D., Malpas, L., and Lewis, R. N. (2023) Does Zipf’s law of abbreviation shape birdsong? bioRxiv (doi.org/10.1101/2023.12.06.569773).

Lewis, R. N., Kwong, A., Soma, M., de Kort, S. R., Gilman, R. T. (2023) Java sparrow song conforms to Mezerath’s law but not to Zipf’s law of abbreviation. bioRxiv (doi.org/10.1101/2023.12.13.571437).

Youngblood, M. (2024) Language-like efficiency and structure in house finch song. Proceedings of the Royal Society B - Biological Sciences, 291:20240250 (doi.org/10.1098/rspb.2024.0250).