Description Usage Arguments Author(s) Examples
This function should only be used for academic purposes or small sample sizes (time grows factorially with number of observations) 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 13 14 | library(dplyr)
data(mpg)
test_data <- mpg %>%
filter(class %in% c('suv', 'compact')) %>%
sample_n(7) # this just for computational feasibility of illustrative example
prm_res <- prm_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.