Learn R Programming

⚠️There's a newer version (5.1.0) of this package.Take me there.

R2sample (version 5.0.0)

Various Methods for the Two Sample Problem

Description

The routine twosample_test() in this package runs the two sample test using various test statistic. The p values are found via permutation or large sample theory. The routine twosample_power() allows the calculation of the power in various cases, and plot_power() draws the corresponding power graphs. The routine run.studies allows a user to quickly study the power of a new method and how it compares to some of the standard ones.

Copy Link

Version

Install

install.packages('R2sample')

Monthly Downloads

840

Version

5.0.0

License

GPL (>= 2)

Maintainer

Wolfgang Rolke

Last Published

September 6th, 2026

Functions in R2sample (5.0.0)

TSw_cont

find test statistics for continuous data with weights
twosample_test

Tests for the univariate two-sample problem
TSw_disc

Find test statistics for weighted discrete data
run.studies

Power Comparisons
powerR

Find the power of two sample tests using Rcpp and parallel computing.
funs_list

funs_list
gen_cont_noweights

simulate continuous data without weights
testC

run test using either simulation or permutation.
repC

cpp version of R routine rep
test_methods

This function checks whether the correct methods have been requested
bincounter

find counts in bins. Useful for power calculations. Replaces hist command from R.
powerC

Find the power of various continuous tests via simutation or permutation.
signif_digits

This function does some rounding to nice numbers
run_shiny

Runs the shiny app associated with R2sample package
wbincounter

Find counts and/or sum of weights in bins. Useful for power calculations. Replaces hist command from R.
use_parallel

Determine whether parallel processing should be used
weights

find weights for several statistics for discrete data
twosample_test_adjusted_pvalue

Adjusted p values for simultaneous testing in the two-sample problem.
power_newtest

Power for tests with p values
power_cont_LS

Find the power of various discrete tests via permutation.
timecheck

test function
twosample_power

Power estimation for two-sample methods
calcTS

This function calculates the test statistics for continuous data
case_studies

Create case studies
asymptotic_pvalues

This function finds the p values of several tests based on large sample theory
myTS_disc

This function runs a test for discrete data
chi_power

This function runs the chi-square test for continuous or discrete data
myTS_cont

New test for continuous data
myTS2

a local function needed for the vignette
plot_power

This function draws the power graph, with curves sorted by the mean power and smoothed for easier reading.
param

param
TS_disc

find test statistics for discrete data
TS_cont

find test statistics for continuous data
Cpporder

sort vector y by values in vector x
gen_cont_weights

simulate continuous data with weights
gen_disc

simulate new discrete data
chi_test

This function runs the chi-square test for continuous or discrete data
R2sample-package

R2sample: Various Methods for the Two Sample Problem
power_study

power_study
pvaluecdf

pvaluecdf
gen_sim_data

simulate continuous data without weights