Nothing
## ----setup, include = FALSE---------------------------------------------------
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.width = 6.5,
fig.height = 5
)
has_ggplot2 <- requireNamespace("ggplot2", quietly = TRUE)
## ----cohort-------------------------------------------------------------------
library(phontrast)
head(vowel_cohort)
table(vowel_cohort$speaker, vowel_cohort$vowel)
## ----rank---------------------------------------------------------------------
ranking <- rank_contrasts(
data = vowel_cohort,
features = c("f1", "f2"),
category_col = "vowel",
group_col = "speaker"
)
ranking
## ----flagged------------------------------------------------------------------
ranking[ranking$flag %in% TRUE, c("group", "sqrt_jsd", "pillai", "pr_jsd", "pr_pillai", "rank_diff")]
## ----floors-------------------------------------------------------------------
protocol_floors(2)
ranking[, c("group", "n_min", "rank_licensed", "flag_licensed", "rank_basis", "flag")]
## ----agreement-plot, eval = has_ggplot2---------------------------------------
plot(ranking)
## ----bw-check-----------------------------------------------------------------
ranking[, c("group", "sqrt_jsd_half", "sqrt_jsd_double", "bw_shift", "sign_change", "set_aside")]
## ----inspect, eval = has_ggplot2, fig.width = 8, fig.height = 4---------------
inspect_contrast(ranking, "spk09", reverse_x = TRUE, reverse_y = TRUE)
## ----estimator----------------------------------------------------------------
recommended_estimator(2)[c("tier", "bw", "engine", "eval_n", "loo")]
recommended_estimator(8)[c("tier", "bw", "engine", "eval_n", "loo")]
## ----estimator-override, eval = FALSE-----------------------------------------
# rank_contrasts(
# vowel_cohort, c("f1", "f2"), "vowel", "speaker",
# estimator = modifyList(recommended_estimator(2), list(bw = "scott.diag", engine = "fast_diag"))
# )
## ----measures-----------------------------------------------------------------
one_speaker <- vowel_cohort[vowel_cohort$speaker == "spk05", ]
phontrast(
one_speaker, c("f1", "f2"), "vowel",
metrics = c("js_distance", "pillai", "overlap", "tv",
"bhattacharyya", "bhattacharyya_kde", "euclidean")
)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.