README — Reproducing dependency analyses
Files included

Supplementary_Code.R – R script containing all functions for extracting transition matrices, generating randomised baselines, and computing p-values.

Supplementary_Data_1.csv – Example dataset in required input format.

SM2_methods.xlsx – Spreadsheet listing the parameter combinations used across analyses.

Software

R (v4.0+ recommended)

RStudio (optional)

No additional packages required for the core functions.

Input data format

The CSV must contain three columns:

Individual name

Predator-model condition

N-gram string (underscore-separated call codes)
Example: KS_GR_RC

Allowed call codes:
CC, GR, RC, KS, SH, SI, RO, KH

Running the code (single example)
1. Set file path

Open Supplementary_Code.R and edit this line inside the function:

filename <- "PATH_TO/Supplementary_Data_1.csv"

Replace with your local file path.

2. Source the script
source("Supplementary_Code.R")
3. Run an example analysis
result <- combined_function(
  c("Chris"),      # individual(s)
  c("Pattern"),    # predator model(s)
  c(3,4,5,6),      # n-gram lengths
  c("1_2"),        # x positions
  c("3_4"),        # y positions
  N = 1000         # permutations
)

result$syllable_matrix$TransitionMatrix
result$p_values
How the analysis works

For each parameter set:

Extract observed segment-to-segment transitions from n-grams

Randomise order within each n-gram (N permutations)

Compute expected transition frequencies

Compare observed vs expected using a cell-wise chi-square approximation

Each run corresponds to one parameter combination (see SM2_methods.xlsx).

Reproducing specific analyses

To reproduce any result:

Identify the parameter set in SM2_methods.xlsx

Enter those values into combined_function()

Running the full parameter sweep may take substantial time; any single run can be reproduced independently.

Contact

adriano.lameira@warwick.ac.uk