Cram.test: Two sample Univariate Cramer Test

Description Usage Arguments Details Value Author(s) References Examples

View source: R/Cram.test.R

Description

Performs the two sample Cramer Test on two vectors of data.

Usage

1
Cram.test(Data1, Data2, P.Value = T, GridPoints=50)

Arguments

Data1

a (non-empty) numeric vector of data values.

Data2

a (non-empty) numeric vector of data values.

P.Value

logical, if true will return the p-value of the test as well as the statistic.

GridPoints

an integer indicating the number of grid points to be used for the integration when calculating the moments of the test statistics.

Details

Consider data x_1, x_2, ..., x_n and y_1, y_2, ..., y_m as two samples, assumed to have come from probability density functions f and g, respectively. Let F and G be the cumulative density functions, respectively. We are interested to test the null hypothesis H_0: F=G. The main function is Cram.test() which will calculate the test statistic

T_{n,m}=\int_{-∞}^{∞}(F(t)-G(t))^2 dt

and its corresponding p-value based on the approximation of the generalized Pareto distribution to the test statistic.

Value

Statistic

the value of Cramer test statistic.

p.value

the p-value for the test.

Author(s)

Alison Telford <mm11ajt@leeds.ac.uk>

References

For further information, refer to "Properties, Advantages and a Faster p-value Calculation of the Cramer test" (submitted for review).

Examples

1
2
3
	sample1 = rnorm(100)
	sample2 = rnorm(100)
	Cram.test(sample1, sample2, P.Value = TRUE, 50)

CramTest documentation built on May 2, 2019, 5:08 a.m.