stat_indeptest: Compute the test statistic for the robust independence test...

Description Usage Arguments Details Value See Also Examples

View source: R/stat_indeptest.R

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

1

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#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]))

obouaziz/robusTest0 documentation built on Dec. 22, 2021, 4:13 a.m.