Description Usage Arguments Author(s) Examples
Simulate a permutation test of arbitrary statistics using a simple randomization (i.e. non-clustered) scheme
Note that mcrd_test
and mcr_anova
convenience functions cover common use cases and should be preferred for interactive, non-programmatic use
If the "parallel" pacakge is installed, use the global mc.cores option to control level of parallelism
1 2 |
data |
a data frame to draw statistics from |
statistics |
a function or vector of functions accepting a data frame, returning a scalar statistic |
group_var |
a character, singular column name in the data representing groups. |
statistic_names |
the names of statistics that are computed. must be specified if the supplied statistics do not have names |
trials |
the number of Monte Carlo trials to perform |
kholub
1 2 3 4 5 6 7 8 9 10 11 12 | library(dplyr)
data(mpg)
test_data <- mpg %>% filter(class %in% c('suv', 'compact'))
mcr_res <- mcr_test(test_data, c(median_difference = function(df) {
group_medians <- df %>%
group_by(class) %>%
summarize(
median = median(hwy))
as.numeric(group_medians[group_medians$class == 'suv', 'median']) -
as.numeric(group_medians[group_medians$class == 'compact', 'median'])
}),
'class')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.