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.

LearnNonparam logo

License CRAN status Dependencies CRAN RStudio mirror downloads CRAN RStudio mirror downloads

Overview

This R package implements several non-parametric tests in chapters 1-5 of Higgins (2004), including tests for one sample, two samples, k samples, paired comparisons, blocked designs, trends and association. Built with Rcpp for efficiency and R6 for flexible, object-oriented design, it provides a unified framework for performing or creating custom permutation tests.

Installation

Install the stable version from CRAN:

install.packages("LearnNonparam")

Install the development version from Github:

# install.packages("remotes")
remotes::install_github("qddyy/LearnNonparam")

Usage

library(LearnNonparam)
options(LearnNonparam.pmt_progress = TRUE)
See pmts() for tests implemented in this package.
key class test
onesample.quantile Quantile Quantile Test
onesample.cdf CDF Inference on Cumulative Distribution Function
twosample.difference Difference Two-Sample Test Based on Mean or Median
twosample.wilcoxon Wilcoxon Two-Sample Wilcoxon Test
twosample.scoresum ScoreSum Two-Sample Test Based on Sum of Scores
twosample.ansari AnsariBradley Ansari-Bradley Test
twosample.siegel SiegelTukey Siegel-Tukey Test
twosample.rmd RatioMeanDeviance Ratio Mean Deviance Test
twosample.ks KolmogorovSmirnov Two-Sample Kolmogorov-Smirnov Test
ksample.oneway OneWay One-Way Test for Equal Means
ksample.kw KruskalWallis Kruskal-Wallis Test
ksample.jt JonckheereTerpstra Jonckheere-Terpstra Test
multcomp.studentized Studentized Multiple Comparison Based on Studentized Statistic
paired.sign Sign Two-Sample Sign Test
paired.difference PairedDifference Paired Comparison Based on Differences
rcbd.oneway RCBDOneWay One-Way Test for Equal Means in RCBD
rcbd.friedman Friedman Friedman Test
rcbd.page Page Page Test
association.corr Correlation Test for Association Between Paired Samples
table.chisq ChiSquare Chi-Square Test on Contingency Table

define_pmt allows users to define new permutation tests. Take the two-sample Cramér-Von Mises test as an example:

t <- define_pmt(
    # this is a two-sample permutation test
    inherit = "twosample",
    statistic = function(x, y) {
        # (optional) pre-calculate certain constants that remain invariant during permutation
        n_x <- length(x)
        n_y <- length(y)
        F_x <- seq_len(n_x) / n_x
        G_y <- seq_len(n_y) / n_y
        # return a closure to calculate the test statistic
        function(x, y) {
            x <- sort.int(x)
            y <- sort.int(y)
            F <- approxfun(x, F_x, "constant", 0, 1)
            G <- approxfun(y, G_y, "constant", 0, 1)
            sum(c(F_x - G(x), G_y - F(y))^2)
        }
    },
    # reject the null hypothesis when the test statistic is large
    rejection = "r",
    name = "Two-Sample Cramér-Von Mises Test",
    alternative = "samples are from different continuous distributions"
)

t$test(rnorm(10), runif(10))$print()

References

Higgins, J. J. 2004. An Introduction to Modern Nonparametric Statistics. Duxbury Advanced Series. Brooks/Cole.

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.