# Setup -------------------------------------------------------------------
rm(list = ls()) # Clear memory
library(magrittr) # Attach magrittr package (makes code more readable)
source("Demo_Manuscript/zz_merge_helpers.R") # Load code/variables
source("Demo_Manuscript/zz_summary_helpers.R") # Load code
source("Demo_Manuscript/zz_load_d.R") # Load data into object called `d`
source("Demo_Manuscript/zz_equivalence_helpers.R") # Load code
# Equivalence Testing -----------------------------------------------------
paste(d$sex, d$age) %>%
split(d, .) %>%
c(
total = list(d), sex = split(d, d$sex),
age = split(d, d$age), .
) %>%
lapply(eq_wrapper) %>%
do.call(rbind, .) %>%
data.frame(
subset = gsub("\\.[0-9]*$", "", row.names(.)),
.,
stringsAsFactors = FALSE,
row.names = NULL
) %>%
within({p_fdr = p.adjust(tost_p, "fdr")}) %>%
within({sig_fdr = ifelse(p_fdr < 0.05, "*", "")}) %T>%
data.table::fwrite("Demo_Manuscript/output/equivalence.csv") %>%
invisible(.)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.