Last data update: 2014.03.03

R: JLMn statistic, to test independence
JLMnR Documentation

JLMn statistic, to test independence

Description

It compute the JLMn-statistic, from a bivariate sample of continuous random variables X and Y.

Usage

JLMn(x, y)

Arguments

x, y

numeric vectors of data values. x and y must have the same length.

Details

See subsection 3.3-Main reference. For sample sizes less than 20, the correction introduced in subsection 3.2 from main reference, with c = 0.4 was avoided.

Value

The value of the JLMn-statistic.

Author(s)

J. E. Garcia, V. A. Gonzalez-Lopez

References

J. E. Garcia, V. A. Gonzalez-Lopez, Independence tests for continuous random variables based on the longest increasing subsequence, Journal of Multivariate Analysis (2014), http://dx.doi.org/10.1016/j.jmva.2014.02.010

Examples

# mixture of two bivariate normal, one with correlation 0.9 and
# the other with correlation -0.9 
#
N <-100
ro<- 0.90
Z1<-rnorm(N)
Z2<-rnorm(N)
X2<-X1<-Z1
I<-(1:floor(N*0.5))
I2<-((floor(N*0.5)+1):N)
X1[I]<-Z1[I]
X2[I]<-(Z1[I]*ro+Z2[I]*sqrt(1-ro*ro))
X1[I2]<-Z1[I2]
X2[I2]<-(Z1[I2]*(-ro)+Z2[I2]*sqrt(1-ro*ro))
plot(X1,X2)

#calculate the statistic
a<-JLMn(X1,X2)
a

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(LIStest)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/LIStest/JLMn.Rd_%03d_medium.png", width=480, height=480)
> ### Name: JLMn
> ### Title: JLMn statistic, to test independence
> ### Aliases: JLMn
> ### Keywords: ~longest increasing subsequence ~copula
> 
> ### ** Examples
> 
> # mixture of two bivariate normal, one with correlation 0.9 and
> # the other with correlation -0.9 
> #
> N <-100
> ro<- 0.90
> Z1<-rnorm(N)
> Z2<-rnorm(N)
> X2<-X1<-Z1
> I<-(1:floor(N*0.5))
> I2<-((floor(N*0.5)+1):N)
> X1[I]<-Z1[I]
> X2[I]<-(Z1[I]*ro+Z2[I]*sqrt(1-ro*ro))
> X1[I2]<-Z1[I2]
> X2[I2]<-(Z1[I2]*(-ro)+Z2[I2]*sqrt(1-ro*ro))
> plot(X1,X2)
> 
> #calculate the statistic
> a<-JLMn(X1,X2)
> a
[1] 27.61404
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>