Package: phontrast 2.5.1

phontrast: Contrast and Separation Metrics for Phonological Categories

Computes and compares multiple measures of separation and overlap between phonological categories (for example vowels or consonants) in arbitrary multi-dimensional acoustic spaces such as formant values, mel-frequency cepstral coefficients (MFCCs), duration, or learned embeddings. The main entry point, phontrast(), reports several contrast metrics in one call -- Jensen-Shannon divergence and distance (Lin, 1991) <doi:10.1109/18.61115>, the Pillai-Bartlett trace, Bhattacharyya distance and affinity, Mahalanobis distance, and proportional overlap -- globally or by group on a common separation-oriented scale, with bootstrap confidence intervals. rank_contrasts() implements a measurement protocol for ranking speakers' contrasts by Jensen-Shannon distance and checking the ranking against Pillai, with sample-size licensing and a bandwidth-sensitivity check. Also provides utilities for preparing estimates for downstream modelling such as generalized additive models and mixed-effects models. Formerly released as 'phonJSD'.

Authors:Grant M. Berry [aut, cre]

phontrast_2.5.1.tar.gz
phontrast_2.5.1.zip(r-4.7-any)phontrast_2.5.1.zip(r-4.6-any)phontrast_2.5.1.zip(r-4.5-any)
phontrast_2.5.1.tgz(r-4.6-any)phontrast_2.5.1.tgz(r-4.5-any)
phontrast_2.5.1.tar.gz(r-4.7-any)phontrast_2.5.1.tar.gz(r-4.6-any)
phontrast_2.5.1.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
phontrast/json (API)

# Install 'phontrast' in R:
install.packages('phontrast', repos = c('https://berrygrant.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/berrygrant/phontrast/issues

Datasets:

On CRAN:

Conda:

5.65 score 1 stars 9 scripts 366 downloads 37 exports 29 dependencies

Last updated from:300c01682f. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-develOK269
source / vignettesOK181
linux-releaseOK190
macos-releaseOK172
macos-oldrelOK207
windows-develOK213
windows-releaseOK201
windows-oldrelOK185
wasm-releaseOK99

Exports:bhattacharyya_mvnormboot_jsdcompare_overlap_metricsestimate_bhattestimate_jsdestimate_overlapestimate_pillaiextract_mfccglobal_boot_jsdglobal_pillaihier_boot_jsd_modelinspect_contrastjsdjsd_kde_ndjsd_summarykl_divpercent_overlap_kdepercentile_rankphontrastphontrast_palettepillai_overlapplot_category_pcaplot_category_spaceplot_contrastplot_overlap_metricsplot_rank_agreementprepare_jsd_betaprotocol_floorsrank_contrastsrecommended_estimatorscale_color_phontrastscale_colour_phontrastscale_fill_phontrastspeaker_bhattspeaker_jsdspeaker_pillaitheme_phontrast

Dependencies:clidplyrFNNgenericsgluekernlabKernSmoothkslatticelifecyclemagrittrMatrixmclustmgcvmulticoolmvtnormnlmepillarpkgconfigpracmapurrrR6Rcpprlangtibbletidyselectutf8vctrswithr

Ranking speakers by Jensen-Shannon distance and checking Pillai agreement
The example cohort | Steps 1 to 3 in one call | Licensing: when a rank or a flag may be read | The agreement plot | Inspecting a flagged speaker across bandwidths | The estimator behind the numbers | Measures and estimators side by side | What to report

Last update: 2026-10-07
Started: 2026-10-06

Multidimensional workflows
PB52 note

Last update: 2026-07-21
Started: 2026-06-26

Quick start: from vowel table to metrics and plots

Last update: 2026-07-21
Started: 2026-06-26

Readme and manuals

Help Manual

Help pageTopics
Bhattacharyya distance and affinity under multivariate normalitybhattacharyya_mvnorm
Bootstrap JSD for each groupboot_jsd
Estimate Bhattacharyya distance, globally or by groupestimate_bhatt
Estimate Jensen-Shannon divergence or distance between two categoriesestimate_jsd
Estimate proportional overlap globally or by groupestimate_overlap
Estimate Pillai trace, globally or by groupestimate_pillai
Extract MFCCs for vowel segmentsextract_mfcc
Global JSD with bootstrap confidence intervalglobal_boot_jsd
Global Pillai trace (point estimate)global_pillai
Hierarchical bootstrap for JSD-based modelshier_boot_jsd_model
Inspect one speaker's contrast across bandwidthsinspect_contrast
Jensen-Shannon divergence for discrete distributionsjsd
n-dimensional JSD via multivariate kernel density estimationjsd_kde_nd
JSD summary: point estimate and optional bootstrap per groupjsd_summary
Kullback-Leibler divergence for discrete distributionskl_div
Proportional overlap between two distributions via KDEpercent_overlap_kde
Percentile ranks with averaged tiespercentile_rank
Compute and compare phonological contrast metricsphontrast
Okabe-Ito color palette used by phontrast plotsphontrast_palette
Pillai trace for multivariate overlappillai_overlap
Plot a PCA projection of multidimensional category spaceplot_category_pca
Plot phonological categories in acoustic spaceplot_category_space
Distribution-aware contrast plot for two categoriesplot_contrast
Plot overlap metric comparisonsplot_overlap_metrics
Rank-agreement plot for a speaker rankingplot_rank_agreement
Plot a phontrast() result directlyautoplot.phontrast_contrast plot.phontrast_contrast
Plot a rank_contrasts() result directlyautoplot.phontrast_ranking plot.phontrast_ranking
Prepare JSD estimates for beta regression / GAMsprepare_jsd_beta
Sample-size floors of the ranking protocolprotocol_floors
Rank speakers' contrasts by Jensen-Shannon distance and check them against Pillairank_contrasts
Kernel estimator settings by dimensionalityrecommended_estimator
Okabe-Ito discrete color and fill scalesscale_color_phontrast scale_colour_phontrast scale_fill_phontrast
Bhattacharyya distance by groupspeaker_bhatt
Group-level JSD point estimatesspeaker_jsd
Group-level Pillai scoresspeaker_pillai
Publication theme for phontrast plotstheme_phontrast
Simulated twelve-speaker vowel cohortvowel_cohort