Indepedence test or correlation test?

Hello everyone,

Since I am working with uncorrelated data but quite dependant, I had a look at how UQLAB perform statistical hypothesis test before finding an appropriate copula to the input data. What I have seen is that the “independent tests” that UQLAB uses such as Kendall, Spearman or Pearson, are actually tests for deciding whenever there is or not a significant correlation between variables.

Worse luck, uncorrelation is not the same as independence. There exist several easy counterexamples to illustrate this. For example, let X~U(-1,1) or X~N(0,1) and Y=X^2. Or a classical one could be to take X=cos(U), Y=sin(U), where U~(0,2*pi).

A way to test dependency is the classical chi2 test, which can be done in Matlab using crosstab. This test is designed for categorical data but can be adapted to the continuous case grouping data in blocks.

  • Is maybe UQLAB only performing correlation test, because copulas only remove correlation but not dependency between data?

For the sake of illustration, I let here the code to perform an “independence” test over uncorrelated dependent data with the UQLAB function uq_test_block_independence()

rng(1)
n=1e4;
u=(2*pi*rand(n,1));

x=sin(u);
y=cos(u);

corr(x,y)  % Theoretically uncorelated. Compute E[XY], E[X]=E[Y]=0.
scatter(x,y); % Data has not even 2D support since they are "very" dependant

uqlab
uq_test_block_independence([x y], 0.05)


% -> indep. groups: 1, 2   
% 
% ans =
% 
%   1×2 cell array
% 
%     {[1]}    {[2]}