View source: R/AB_permutation_test.R
AB_permutation_test | R Documentation |
Performs a regular permutations test for two conditions or phases (A and B).
AB_permutation_test( x, y, test_statistic = "*", test_statistic_function = "mean", reps_max = 2000, no_duplicates = FALSE, show_plot = FALSE, show_plot_header = "" )
x |
factor vector to indicate conditions or phases (e.g., "A" and "B") |
y |
numerical vector with the observed y-values |
test_statistic |
character how to compute the test statistic c("A-B", "B-A", "*") *=two-sided |
test_statistic_function |
character compute and compare "mean" or "median" for A and B |
reps_max |
numerical maximum number of permutation replications (the theoretical number= n!) |
no_duplicates |
boolean do a permutation test without duplicates (makes it much slower) |
show_plot |
boolean show test plot of statistical test |
show_plot_header |
character header of test plot |
List with the permutation test results: observed_test_statistic = computed test statistic, effect_size = computed effect size (similar to Cohen's d), random_assignments, p_randomization_AB = p value randomization AB test, one_sided_p = one-sided p-value in case of B-A or A-B.
pdt::AB_permutation_test( as.factor(c(rep("A",20), rep("B",20))), c(rnorm(20), rnorm(20)+2), test_statistic="B-A", test_statistic_function="mean", reps_max=1000, no_duplicates=FALSE, show_plot=FALSE, show_plot_header="")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.