stat_indeptest {robusTest}R Documentation

Compute the test statistic for the robust independence test of Kolmogorov-Smirnov's type

Description

For two continuous variables compute the maximal distance between the joint empirical cumulative distribution function and the product of the marginal empirical cumulative distribution functions.

Usage

stat_indeptest(x, y)

Arguments

x, y

the two continuous variables. Must be of same length.

Details

Let (x1,y1), ..., (x_n,y_n) be a bivariate sample of n continuous variables. Its corresponding bivariate e.c.d.f. (empirical cumulative distribution function) Fn is defined as:

Fn(t1,t2) = #{xi<=t1,yi<=t2}/n = sum_{i=1}^n Indicator(xi<=t1,yi<=t2)/n.

Let Fn(t1) and Fn(t2) be the marginals e.c.d.f. The function returns the value of:

n^(1/2) sup_{t1,t2} |Fn(t1,t2)-Fn(t1)*Fn(t2)|.

Value

Returns the test statistic of the robust independent test.

See Also

indeptest, simulecdf, ecdf2D.

Examples

#Simulated data 1
x<-c(0.2, 0.3, 0.1, 0.4)
y<-c(0.5, 0.4, 0.05, 0.2)
stat_indeptest(x,y)

#Simulated data 2
n<-40
x<-rnorm(n)
y<-x^2+0.3*rnorm(n)
plot(x,y)
stat_indeptest(x,y)

#Application on the Evans dataset
data(Evans)
with(Evans,stat_indeptest(CHL[CDH==1],DBP[CDH==1]))

[Package robusTest version 1.1.0 Index]