| test | R Documentation |
Useful after fitting to test "synchronic" differences between groups. Within a temporal unit :
test_globally(df, x = x_pred, y = y_pred, by = group, test_fun = kruskal_p) test_pairwise(df, x = x_pred, y = y_pred, by = group, test_fun = wilcox_p)
df |
|
x, y, group |
colnames to use. Default to |
by |
colname for the group to use. Default to |
test_fun |
function to pick among comparison_testers(comparison testers).
By default |
test_globally will test if at least one group differs from the others
test_pairwise will test all pairwise differences between
groups present at that time.
test_globally: test for global differences
test_pairwise: test for pairwise differences
# for the sake of speed
x <- animals %>%
quake(5, min=tpq, max=taq) %>%
fit_gam(y=value, by=taxa, x_pred=seq(-100, 100, 50))
x %>% spaghetti(by=taxa)
# global testing
x %>% test_globally(by=taxa)
# pairwise testing
x %>% test_pairwise(by=taxa)
# you can filter "significant" ones
alpha=0.01
x %>%
test_pairwise(by=taxa) %>%
dplyr::mutate(signif=p<alpha)
# you can continue the pipe with
# dplyr::filter(!signif) to only get not different
# or
# dplyr::filter(signif) to only the different ones
# yet before, you probably need to adjust your alpha
# by the number of tests, ie do some Bonferroni correction
# the number of tests is simply dplyr::n()
x %>%
test_pairwise(by=taxa) %>%
dplyr::mutate(alpha_adj=alpha/dplyr::n(),
signif=p<alpha_adj)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.