speaker_jsd: Group-level JSD point estimates

View source: R/speaker_jsd.R

speaker_jsdR Documentation

Group-level JSD point estimates

Description

Computes JSD for each group (e.g., speaker) comparing two categories (e.g., vowels) in an n-dimensional acoustic space.

Usage

speaker_jsd(
  data,
  group_col,
  category_col,
  features,
  min_tokens = 20,
  bw = c("Hpi", "Hscv", "Hpi.diag", "scott.diag"),
  eval_on = c("pooled", "group1", "group2", "pooled_sample"),
  eval_n = NULL,
  eval_seed = NULL,
  engine = c("ks", "fast_diag", "fast_diagonal"),
  chunk_size = 1000L,
  ...
)

Arguments

data

Data frame containing acoustic measurements.

group_col

Character vector giving one or more grouping columns (e.g., "speaker" or c("Sex", "Style")).

category_col

String: name of column giving the category to compare (e.g., "vowel"). Each group must have exactly two categories.

features

Character vector of column names giving the acoustic space.

min_tokens

Minimum number of tokens per group required to compute JSD. Groups with fewer tokens are dropped.

bw

Bandwidth selection method passed to jsd_kde_nd().

eval_on

KDE evaluation points passed to jsd_kde_nd().

eval_n

Optional maximum number of KDE evaluation points.

eval_seed

Optional integer seed for KDE evaluation-point subsampling.

engine

KDE evaluation engine passed to jsd_kde_nd(). "fast_diagonal" is accepted as an alias for "fast_diag".

chunk_size

Chunk size for engine = "fast_diag".

...

Additional arguments passed to jsd_kde_nd().

Value

A tibble with one row per group and columns: group, n_tokens, and jsd.


phontrast documentation built on Oct. 7, 2026, 5:06 p.m.