View source: R/ranking_plots.R
| plot_rank_agreement | R Documentation |
Draws step 3 of the ranking protocol behind rank_contrasts(): each
speaker's Pillai percentile rank against its Jensen-Shannon distance
percentile rank, the identity line on which the two measures agree, and the
inspection band of margin either side of it. Speakers outside the
band are flagged; speakers the bandwidth check set aside are crossed;
speakers whose flag may not be read at this sample size and dimensionality
are hollow. Speakers at the \sqrt{JSD} ceiling have no rank and are
listed in the caption instead of drawn.
plot_rank_agreement(
ranking,
label = c("flagged", "all", "none"),
base_size = 12
)
ranking |
A |
label |
Which speakers to name on the plot: |
base_size |
Base font size passed to |
A ggplot2 plot object.
rank_contrasts(), inspect_contrast().
set.seed(2026)
gaps <- c(30, 60, 90, 120, 150, 180, 210, 240)
cohort <- do.call(rbind, lapply(seq_along(gaps), function(i) {
data.frame(
speaker = sprintf("s%02d", i),
vowel = rep(c("ih", "eh"), each = 50),
f1 = c(rnorm(50, 500, 55), rnorm(50, 500 + gaps[i], 55)),
f2 = c(rnorm(50, 1900, 120), rnorm(50, 1900 - gaps[i], 120))
)
}))
ranking <- rank_contrasts(cohort, c("f1", "f2"), "vowel", "speaker",
bw_check = FALSE)
if (requireNamespace("ggplot2", quietly = TRUE)) {
plot_rank_agreement(ranking, label = "all")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.