Learn R Programming

CramTest (version 1.5)

Cram.test: Two sample Univariate Cramer Test

Description

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

Usage

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.

Value

Statistic

the value of Cramer test statistic.

p.value

the p-value for the test.

Details

Consider data \(latex\) and \(latex\) as two samples, assumed to have come from probability density functions \(latex\) and \(latex\), respectively. Let \(latex\) and \(latex\) be the cumulative density functions, respectively. We are interested to test the null hypothesis \(latex\). The main function is Cram.test() which will calculate the test statistic

$$latex$$

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

References

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

Examples

Run this code
# NOT RUN {
	sample1 = rnorm(100)
	sample2 = rnorm(100)
	Cram.test(sample1, sample2, P.Value = TRUE, 50)
# }

Run the code above in your browser using DataLab