The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
The goal of permutest is to allow users to run permutation tests and construct associated confidence intervals for any test statistic and any set of permutations.
You can install the development version of permutest from GitHub with:
# install.packages("devtools")
::install_github("akglazer/permutest") devtools
This is a basic example which shows you how to use the permutation test function with a difference in means test statistic:
library(permutest)
<- data.frame(group = c(rep(1, 10), rep(2, 10)),
data outcome = c(rep(1, 10), rep(1, 10)))
<- permutation_test(df = data, group_col = "group", outcome_col = "outcome",
output test_stat = "diff_in_means", perm_func = permute_group,
alternative = "greater", shift = 0, reps = 10,
return_perm_dist = F, return_test_dist = T, seed = 42)
Alternatively, for the two-sample problem with difference in means
test statistic, you can use the function two_sample()
(and
for the one-sample problem you can use one_sample()
):
<- two_sample(x = c(10, 9, 11), y = c(12, 11, 13), alternative = "less", seed = 42) output
The following is an example of how to construct a confidence interval for a shift parameter in the two-sample problem:
<- c(35.3, 35.9, 37.2, 33.0, 31.9, 33.7, 36.0, 35.0,
x 33.3, 33.6, 37.9, 35.6, 29.0, 33.7, 35.7)
<- c(32.5, 34.0, 34.4, 31.8, 35.0, 34.6, 33.5, 33.6,
y 31.5, 33.8, 34.6)
<- data.frame(outcome = c(x, y), group = c(rep(1, length(x)), rep(0, length(y))))
df
<- permutation_test_ci(df, "group", "outcome", strata_col = NULL,
output test_stat = "diff_in_means",
perm_func = permute_group,
upper_bracket = NULL,
lower_bracket = NULL,
cl = 0.95,
e = 0.01,
reps = 100000,
seed = 42)
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.