cvm_stat {twosamples}R Documentation

Cramer-vonMises Test

Description

Cramer-vonMises Test

Usage

cvm_stat(a, b, power = 2)

cvm_test(a, b, nboots = 2000, p = default.p)

Arguments

a

a vector of numbers

b

a vector of numbers

power

power to raise test stat to

nboots

Number of bootstrap iterations

p

power to raise test stat to

Details

The CVM test compares two ECDFs by looking at the sum of the squared differences between them – evaluated at each point in the joint sample. Formally – if E is the ECDF of sample 1 and F is the ECDF of sample 2, then CVM = SUM_(x in k) (E(x)-F(x))^2 where k is the joint sample. The test p-value is calculated by randomly resampling two samples of the same size using the combined sample. Intuitively the CVM test improves on KS by using the full joint sample, rather than just the maximum distance – this gives it greater power against shifts in higher moments, like variance changes.

Value

Output is a length 2 Vector with test stat and p-value in that order. That vector has 3 attributes – the sample sizes of each sample, and the number of bootstraps performed for the pvalue.

Functions

Examples

vec1 = rnorm(20)
vec2 = rnorm(20,4)
cvm_test(vec1,vec2)

[Package twosamples version 1.0.0 Index]