main.Rnw 61.3 KB
Newer Older
1 2 3 4 5
\IfFileExists{bioinfo.cls}{%
  \def\mode{0}%
  }{%
  \def\mode{1}%
}
6

7 8 9 10 11 12 13 14 15 16
\if 0\mode
  \documentclass{bioinfo}%
  \copyrightyear{2015} \pubyear{2015}%
  \access{Advance Access Publication Date: Day Month Year}%
  \appnotes{Manuscript Category}%
\else
  \documentclass{article}%
  \newcommand\firstpage[1]{}
  \newcommand\subtitle[1]{}
\fi
17 18

\usepackage{amsmath}
19
\usepackage{multirow}
20

21 22 23


\DeclareMathOperator{\rpearson}{R}
24 25 26 27 28 29 30 31 32 33 34 35
\DeclareMathOperator{\ir}{IR}
\DeclareMathOperator{\covls}{CovLs}
\DeclareMathOperator{\rcovls}{RCovLs}
\DeclareMathOperator{\icovls}{ICovLs}
\DeclareMathOperator{\varls}{VarLs}
\DeclareMathOperator{\ivarls}{IVarLs}
\DeclareMathOperator{\rls}{RLs}
\DeclareMathOperator{\irls}{IRLs}
\DeclareMathOperator{\rv}{RV}
\DeclareMathOperator{\dcor}{dCor}

\DeclareMathOperator{\trace}{Trace}
36
\DeclareMathOperator{\diag}{Diag}
37 38
\DeclareMathOperator{\pvalue}{P_{value}}

39 40 41
\newcommand{\X}{\mathbf{X}}
\newcommand{\Y}{\mathbf{Y}}

42
\begin{document}
43

44 45 46 47
\firstpage{1}

\subtitle{Data and text mining}

48 49 50
\title[A modified $Rls$]{Assessing the shared variation among high-dimensional data matrices: a modified version of the Procrustean correlation coefficient}
\author[E. Coissac \textit{et~al}.]{E. Coissac\,$^{\text{\sfb 1,}*}$, Co-Author\,$^{\text{\sfb 2}}$ and C. Gonindard-Melodelima\,$^{\text{\sfb 1}}$}
\address{$^{\text{\sf 1}}$Université Grenoble Alpes, Université Savoie Mont Blanc, CNRS, LECA, Grenoble, F-38000, France \\
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
$^{\text{\sf 2}}$Department, Institution, City, Post Code,
Country.}

\corresp{$^\ast$To whom correspondence should be addressed.}

\history{Received on XXXXX; revised on XXXXX; accepted on XXXXX}

\editor{Associate Editor: XXXXXXX}

\abstract{\textbf{Motivation:} Text Text Text Text Text Text Text Text Text Text Text Text Text
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text
Text Text Text Text Text Text
Text Text Text Text Text.\\
\textbf{Results:} Text  Text Text Text Text Text Text Text Text Text  Text Text Text Text Text
Text Text Text Text Text Text Text Text Text Text Text Text Text  Text Text Text Text Text Text\\
\textbf{Availability:} Text  Text Text Text Text Text Text Text Text Text  Text Text Text Text
Text Text Text Text Text Text Text Text Text Text Text Text Text Text  Text\\
\textbf{Contact:} \href{eric.coissac@metabarcoding.org}{eric.coissac@metabarcoding.org}\\
\textbf{Supplementary information:} Supplementary data are available at \textit{Bioinformatics}
online.}

\maketitle

<<initialisation, message=FALSE, warning=FALSE, include=FALSE>>=
knitr::opts_chunk$set(cache.extra = R.version)
library(tidyverse)
library(doParallel)

library(ggplot2)
81 82 83
library(grid)
library(ggplotify)

84
library(gridExtra)
85

86 87 88
library(xtable)
library(latex2exp)

89 90
library(VennDiagram)

91 92 93 94 95 96 97 98 99 100 101 102 103
library(goftest)
library(energy)


library(ProcMod)

registerDoParallel(4)

set.seed(1)

@


104 105 106 107 108 109 110
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% INTRODUCTION
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


111 112
\section{Introduction}

113
Multidimensional data and even high-dimensional data, where the number of variables describing each sample is far larger than the sample count, are now regularly produced in functional genomics (\emph{e.g.} transcriptomics, proteomics or metabolomics) and molecular ecology (\emph{e.g.} DNA metabarcoding). Using various techniques, the same sample set can be described by several multidimensional data sets, each of them describing a different facet of the samples. This invites using data analysis methods able to evaluate mutual information shared by these different descriptions. Correlative approaches can be a first and simple way to decipher pairwise relationships of those data sets.
114

Eric Coissac committed
115
Since a long time ago, several coefficients have been proposed to measure correlation between two matrices \citep[for a comprehensive review see][]{Ramsay:84:00}. But when applied to high-dimensional data, they suffer from the over-fitting effect leading them to estimate a high correlation even for unrelated data sets. Modified versions of some of these matrix correlation coefficients have been already proposed to tackle this problem. The $\rv_2$ coefficient \citep{Smilde:09:00} is correcting the original $\rv$ coefficient \citep{Escoufier:73:00} for over-fitting. Similarly, a modified version of the distance correlation coefficient $\dcor$ \citep{Szekely:07:00} has been proposed by \cite{SzeKely:13:00}. $\dcor$ has the advantage over the other correlation factors for not considering only linear relationships. Here we will focus on the Procrustes correlation coefficient $\rls$ proposed by \cite{Lingoes:74:00} and by \cite{Gower:71:00}. Let define $Trace$, a function summing the diagonal elements of a matrix. For a $ \; n \; \times \; p \; $ real matrix $\X$ and a second $ \; n \; \times \; q \; $ real matrix $\Y$ defining respectively two sets of $p$ and $q$ centered variables caracterizing $n$ individuals, we define $\covls(\X,\X)$ an analog of covariance applicable to vectorial data following Equation~(\ref{eq:CovLs})
116 117

\begin{equation}
118
\covls(\X,\Y) = \frac{\trace((\mathbf{XX}'\mathbf{YY}')^{1/2})}{n-1}
119 120 121
\label{eq:CovLs}
\end{equation}

122
and $\varls(\X)$ as $\covls(\X,\X)$. $\rls$ can then be expressed as follow in Equation~(\ref{eq:Rls}).
123 124

\begin{equation}
125 126
\rls(\X,\Y) = \frac{\covls(\X,\Y)}
                                   {\sqrt{\varls(\X)\;\varls(\Y)}}
127 128 129
\label{eq:Rls}
\end{equation}

130
Procrustean analyses have been proposed as a good alternative to Mantel's statistics for analyzing ecological data, and more generally for every high-dimensional data sets \citep{Peres-Neto:01:00}. Among the advantages of $\rls$, its similarity with the Pearson correlation coefficient $\rpearson$ \citep{Bravais:44:00} has to be noticed. Considering $\covls(\X,\Y)$ and $\varls(\X)$ respectively corresponding to the covariance of two matrices and the variance of a matrix,  Equation~(\ref{eq:Rls}) highlight the analogy between both the correlation coefficients. Moreover, when $p=1 \text{ and } q = 1,\; \rls = \lvert \rpearson \rvert$.
131

132 133 134 135 136 137
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% APPROACH
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

138 139 140 141 142
\section{Approach}

$\rls$ is part of the procruste framework that aims to superimpose a set of points with respect to another through three operations: a translation, a rotation and a scaling. The optimal transfert matrix $Rot_{X \rightarrow Y}$ can be estimated from the singular value decomposition (SVD) of the covariance matrix $X'Y$. SVD factorize any matrix as the product of three matrices (Equation~\ref{eq:SVD}).

\begin{equation}
143
\X'\Y=\mathbf{U \Sigma V}'
144 145 146
\label{eq:SVD}
\end{equation}

147
$\mathbf{U}$ and $\mathbf{V}$ are two rotation matrices allowing to compute the transfer matrix to superimpose $\X$ on $\Y$ or reciproquely $\Y$ on $\X$. All the elements of $\Sigma$ except its diagonal are equal to zero. The diagonal elements are the singular values. Singular values are the extention of the eigenvalues to non square matrices. $\covls(\X,\Y)$ can also be computed from singular values (Equation~\ref{eq:CovLsSVD}).
148 149

\begin{equation}
150
\covls(\X,\Y) = \frac{\trace(\mathbf{\Sigma})}{n-1}
151 152 153
\label{eq:CovLsSVD}
\end{equation}

154
This expression illustrates that actually $\covls(\X,\Y)$ is the variance of the projections of $\X$ on $\Y$ or of the reciproque projection. Therefore $\covls(\X,\Y)$ and $\rls(\X,\Y)$ are always positive and rotation independante. Here we propose to partitionate this variance in two components. A fisrt one corresponding to the actual shared information between $\X$ and $\Y$, and a second part that corresponds to what two random matrices of same structure than $\X$ and $\Y$ are sharing. This second part is estimated as $\overline{\rcovls(\X,\Y)}$ the mean of such random correlation. $\icovls(\X,\Y)$, the informative part of $\covls(\X,\Y)$, is computed using Equation~(\ref{eq:ICovLs}).
155 156

\begin{equation}
157
\icovls(\X,\Y) = Max \left\{ \begin{aligned}
158
                       \covls(\X,\Y) - \overline{\rcovls(\X,\Y)} &\\
159
                       0 &
160
                      \end{aligned}
161 162 163 164
              \right.
\label{eq:ICovLs}
\end{equation}

165 166
Similarly the informative counter-part of $\varls(\X)$ is defined as $\ivarls(\X)=\icovls(\X,\X)$,
and $\irls(\X,\Y)$ the informative Procruste correlation coefficient as follow.
167

168 169 170 171
\begin{equation}
\irls(\X,\Y)= \frac{\icovls(\X,\Y)}{\ivarls(\X)\;\ivarls(\Y)}
\label{eq:IRLs}
\end{equation}
172

173
Like $\rls(\X,\Y)$, $\irls(\X,\Y) \in [0;1]$ with the $0$ value corresponding to not correlation and the maximum value $1$ reached for two strictly homothetic data sets.
174

Eric Coissac committed
175
The corollary of $\icovls(\X,\Y)$ and $\ivarls(\X)$ definitions is that $\icovls(\X,\Y) \geqslant 0$ and $\ivarls(\X) > 0$. Therefore for $M=\{\mathbf{M}_1,\mathbf{M}_2,...,\mathbf{M}_k\}$ a set of $k$ matrices  with the same number of row, the informative covariance matrix $\mathbf{C}$ defined as $\mathbf{C}_{i,j} = \icovls(\mathbf{M}_i,\mathbf{M}_j)$ for is definite positive and symmetrical. This allows for defining the precision matrix $\mathbf{P}=\mathbf{C}^{-1}$  and the related partial correlation coefficent matrix $\irls_{partial}$ using Equation~(\ref{eq:IRls.partial})
176 177

\begin{equation}
178
\irls_{partial}(\mathbf{M}_i,\mathbf{M}_j) = \frac{\mathbf{P}_{i,j}}{\sqrt{P_{i,i}P_{j,j}}}
179
\label{eq:IRls.partial}
180 181
\end{equation}

182 183 184 185 186 187
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% MATERIAL & METHODS
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

188 189
\begin{methods}
\section{Methods}
190

191
\subsection{Monte-Carlo estimation of $\overline{\rcovls(\X,\Y)}$}
192

193
For every values of $p$ and $q$ including $1$, $\overline{\rcovls(\X,\Y)}$ can be estimated using a serie of $k$ random matrices $RX=\{\mathbf{RX}_1,\mathbf{RX}_2,...,\mathbf{RX}_k\}$ and $RY=\{\mathbf{RY}_1,\mathbf{RY}_2,...,\mathbf{RY}_k\}$ where each $\mathbf{RX}_i$ and $\mathbf{RY}_i$ have the same structure respectively than $\X$ and $\Y$ in term of number of columns and of covariance matrix of these columns.
194 195

\begin{equation}
196 197
\overline{\rcovls(\X,\Y)} = \frac{\Sigma_{i=1}^k \covls(\mathbf{RX}_i,\mathbf{RY}_i)}{k}
\label{eq:RCovLsMC}
198 199
\end{equation}

Eric Coissac committed
200
Even when $\X=\Y$ to estimate $\ivarls(\X)$, $\overline{\rcovls(\X,\X)}$ is estimated with two independent sets of random matrix $RX$ and $RY$, both having the same structure than $\X$.
201

202
\subsubsection*{Empirical assessment of $\overline{\rcovls(\X,\Y)}$}
203

204 205 206 207 208
<<estimate_nrand_setting, cache=TRUE, message=FALSE, warning=FALSE, include=FALSE>>=
n_indivdual <- 20   # Number of simulated individuals (Row count of the matrices)
p_qs <- c(10,20,50,100) # Number of variable foreach matrices (Column counts of the matrices)
n_rands <- c(10,100,1000)
@
209

Eric Coissac committed
210
For two random vectors $\mathbf{x}$ and $\mathbf{y}$ of length $n$, the average coefficient of determination is $\overline{\rpearson^2}=1/(n-1)$. This value is independent of the distribution of the $\mathbf{x}$ and $\mathbf{y}$ values, but what about the independence of $\overline{\rcovls(\X,\Y)}$ to the distributions of $\X$ and $\Y$. To test this independance and to assess the reasonnable randomization effort needed to estimate $\overline{\rcovls(\X,\Y)}$, this value is estimated for four matrices $\mathbf{K},\,\mathbf{L},\,\mathbf{M},\,\mathbf{N}\,$ of $n=\Sexpr{n_indivdual}$ rows and respectively $\Sexpr{p_qs}$ columns. Values of the four matrices are drawn from a normal or an exponential distribution, and $k \in \{\Sexpr{n_rands}\}$ randomizations are tested to estimate $\overline{\rcovls(\X,\Y)}$ and the respective standard deviation $\sigma(\overline{\rcovls(\X,\Y)})$. The $\varls$ of the generated matrices is equal to $1$ therefore the estimated $\covls$ are equals to $\rls$.
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262

<<estimate_nrand, cache=TRUE, message=FALSE, warning=FALSE, include=FALSE, dependson="estimate_nrand_setting">>=

nrand_sims = array(0,dim = c(length(p_qs),
                             max(n_rands),
                             2))


  for (k in seq_len(max(n_rands))) {
    for (p in seq_along(p_qs)) {
      An = scale(matrix(rnorm(p_qs[p]*n_indivdual,
                        mean = 0,
                        sd = 1),
                        nrow = n_indivdual))
      Bn = scale(matrix(rnorm(p_qs[p]*n_indivdual,
                        mean = 0,
                        sd = 1),
                        nrow = n_indivdual))

      Ae = scale(matrix(rnorm(p_qs[p]*n_indivdual,
                        mean = 0,
                        sd = 1),
                        nrow = n_indivdual))
      Be = scale(matrix(rnorm(p_qs[p]*n_indivdual,
                        mean = 0,
                        sd = 1),
                        nrow = n_indivdual))


      nrand_sims[p,k,1] = corls(An,Bn,nrand = 0)[1,2]
      nrand_sims[p,k,2] = corls(Ae,Be,nrand = 0)[1,2]
    }
  }
@

<<estimate_nrand_complementary, message=FALSE, warning=FALSE, include=FALSE>>=
dimnames(nrand_sims)[c(1,3)] <- list(as.character(p_qs),
                                     c("normal","exponential")
                                    )

nrand_sims_stats = mapply(function(k) apply(nrand_sims[,sample(1:1000,k),],
                                            MARGIN = c(1,3),
                                            function(x) c(mean(x),sd(x)/sqrt(k))),
                          n_rands)

dim(nrand_sims_stats) = c(2,length(p_qs),2,length(n_rands))
dimnames(nrand_sims_stats) = list(c("mean","sd"),
                                  as.character(p_qs),
                                  c("normal","exponential"),
                                  as.character(n_rands))
@

263 264 265 266 267 268 269 270 271 272 273 274

\subsection{Simulating data for testing sensibility to overfitting}

<<Null_hypothesis_setting, cache=TRUE, message=FALSE, warning=FALSE, include=FALSE>>=
## Simulation of random matrix

n_sim <- 100       # Count of simulations for each condition
n_indivdual <- 20  # Number of simulated individuals (Row count of the matrices)
p_qs <- c(2:50)    # Number of variable foreach matrices (Column counts of the matrices)
n_rand <- 100
@

275
To test sensibility to overfitting correlations were mesured between two random matrices of same dimensions. Each matrix is $n \times p$ with $n=\Sexpr{n_indivdual}$ and $p \in [\Sexpr{min(p_qs)},\Sexpr{max(p_qs)}]$. Each $p$ variables are drawn from a centered and reduced normal distribution $\mathcal{N}(0,1)$. Eight correlation coefficients have been tested: $\rls$ the original procruste coefficient , $\irls$ this work, $\rv$ the original R for vector data \citep{Robert:76:00}, $\rv adjMaye$, $\rv 2$ and $\rv adjGhaziri$ three modified versions of $\rv$ \citep{El-Ghaziri:15:00,Mayer:11:00,Smilde:09:00}, $\dcor$ the original distance correlation coefficient \citep{Szekely:07:00} and \emph{dCor\_ttest} a modified version of $\dcor$ not sensible to overfitting \citep{SzeKely:13:00}. For each $p$ value, $\Sexpr{n_sim}$ simulations were run. Computation of $\irls$ is estimated with $\Sexpr{n_rand}$ randomizations.
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340

<<Null_hypothesis, cache=TRUE, message=FALSE, warning=FALSE, include=FALSE, dependson="Null_hypothesis_setting">>=

h0_sims = array(0,dim = c(n_sim,length(p_qs),8))

for (k in seq_len(n_sim))
  for (i in seq_along(p_qs)) {
      X <- simulate_matrix(n_indivdual,p_qs[i],equal.var = TRUE)
      Y <- simulate_matrix(n_indivdual,p_qs[i],equal.var = TRUE)

      h0_sims[k,i,1] <- ProcMod::corls(X,Y,nrand = 0)[1,2]
      h0_sims[k,i,2] <- ProcMod::corls(X,Y,nrand = n_rand)[1,2]

      h0_sims[k,i,3] <- MatrixCorrelation::RV(X,Y)
      h0_sims[k,i,4] <- MatrixCorrelation::RVadjMaye(X,Y)
      h0_sims[k,i,5] <- MatrixCorrelation::RV2(X,Y)
      h0_sims[k,i,6] <- MatrixCorrelation::RVadjGhaziri(X,Y)

      h0_sims[k,i,7] <- energy::dcor(X,Y)
      h0_sims[k,i,8] <- energy::dcor.ttest(X,Y)$estimate
    }
@

<<Null_hypothesis_complementary, message=FALSE, warning=FALSE, include=FALSE>>=
dimnames(h0_sims)[[3]] <- c("Rls","IRls",
                            "RV","RVadjMaye","RV2","RVadjGhaziri",
                            "dCor","dCor_ttest")

dimnames(h0_sims)[[2]] <- as.character(p_qs)

h0_sims_tibble <- as_tibble(h0_sims[, , 1]) %>% gather(p, RLs) %>%
                  bind_cols( as_tibble(h0_sims[, , 2]) %>% gather(p, "IRLs")) %>%
                  bind_cols( as_tibble(h0_sims[, , 3]) %>% gather(p,"RV"))  %>%
                  bind_cols( as_tibble(h0_sims[, , 4]) %>% gather(p,"RVadjMaye")) %>%
                  bind_cols( as_tibble(h0_sims[, , 5]) %>% gather(p,"RV2")) %>%
                  bind_cols( as_tibble(h0_sims[, , 6]) %>% gather(p,"RVadjGhaziri")) %>%
                  bind_cols( as_tibble(h0_sims[, , 7]) %>% gather(p,dCor))  %>%
                  bind_cols( as_tibble(h0_sims[,,8]) %>% gather(p,dCor_ttest))

h0_sims_tibble <- h0_sims_tibble[, c(1, (1:8) * 2)]
h0_sims_tibble$p = factor(as.integer(h0_sims_tibble$p))

h0_sims_RLs  = h0_sims_tibble[,c(1,2:3)] %>% gather(method,correlation,-p)
h0_sims_RV   = h0_sims_tibble[,c(1,4:7)] %>% gather(method,correlation,-p)
h0_sims_dCor = h0_sims_tibble[,c(1,8:9)] %>% gather(method,correlation,-p)

h0_sims_all  = bind_rows(h0_sims_RLs,h0_sims_RV,h0_sims_dCor)

h0_sims_all$method = factor(h0_sims_all$method,
                            levels = c("RLs", "IRLs",
                                       "RV", "RVadjMaye", "RV2", "RVadjGhaziri",
                                       "dCor",  "dCor_ttest"))
h0_sims_all$group = h0_sims_all$method
h0_sims_all$group[h0_sims_all$group == "IRLs"] = "RLs"
h0_sims_all$group[h0_sims_all$group == "RVadjMaye"] = "RV"
h0_sims_all$group[h0_sims_all$group == "RV2"] = "RV"
h0_sims_all$group[h0_sims_all$group == "RVadjGhaziri"] = "RV"
h0_sims_all$group[h0_sims_all$group == "dCor_ttest"] = "dCor"
@

<<Null_hypothesis_11_setting, cache=TRUE, message=FALSE, warning=FALSE, include=FALSE>>=
n_sim <- 100         # Count of simulations for each condition
n_indivduals <- 3:25  # Number of simulated individuals (Row count of the matrices)
@

341
For $p=1$ random vectors with $n \in [\Sexpr{min(n_indivduals)},\Sexpr{max(n_indivduals)}]$ are generated. As above data are drawn from $\mathcal{N}(0,1)$ and $k=\Sexpr{n_sim}$ simulations are run for each $n$. The original Pearson correlation coefficient $R$ and the modified version $\ir$ are used to estimate correlation between both vectors.
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399

<<Null_hypothesis_11, cache=TRUE, message=FALSE, warning=FALSE, include=FALSE, dependson="Null_hypothesis_11_setting">>=
h0_sims11 = array(0,dim = c(n_sim,length(n_indivduals),2))

for (k in seq_len(n_sim))
  for (i in seq_along(n_indivduals)) {
      X <- scale(rnorm(n_indivduals[i]))
      Y <- scale(rnorm(n_indivduals[i]))

      h0_sims11[k,i,1] <- abs(cor(X,Y))
      h0_sims11[k,i,2] <- abs(ProcMod::corls(X,Y)[1,2])
  }
@

<<Null_hypothesis_11_complementary, message=FALSE, warning=FALSE, include=FALSE>>=
dimnames(h0_sims11)[[3]] <- c("R","IR")

dimnames(h0_sims11)[[2]] <- as.character(n_indivduals)

h0_sims11_tibble <- as_tibble(h0_sims11[, , 1]) %>% gather(n, R) %>%
                    bind_cols( as_tibble(h0_sims11[, , 2]) %>% gather(n, "IR"))

h0_sims11_tibble <- h0_sims11_tibble[, c(1, 2,4)]
h0_sims11_tibble$n = factor(as.integer(h0_sims11_tibble$n))

h0_sims11_R <- h0_sims11_tibble %>% gather(method,correlation,-n)

h0_sims11_R$method = factor(h0_sims11_R$method,
                            levels = c("R", "IR"))
@

<<H1_overfit, eval=FALSE, cache=TRUE, message=FALSE, warning=FALSE, include=FALSE>>=
initial_var <- 3
n_indivdual <- 20
supplement_vars <- 0:50

X = simulate_matrix(n = n_indivdual,p = initial_var,equal.var = TRUE)
Y = simulate_correlation(reference = X, p = initial_var, r2 = 0.4)

h1_sims_over = array(0,dim = c(length(supplement_vars),8))

for (i in seq_along(supplement_vars)) {
    h1_sims_over[i,1] <- ProcMod::corls(X,Y,nrand = 0)[1,2]
    h1_sims_over[i,2] <- ProcMod::corls(X,Y,nrand = 100)[1,2]

    h1_sims_over[i,3] <- MatrixCorrelation::RV(X,Y)
    h1_sims_over[i,4] <- MatrixCorrelation::RVadjMaye(X,Y)
    h1_sims_over[i,5] <- MatrixCorrelation::RV2(X,Y)
    h1_sims_over[i,6] <- MatrixCorrelation::RVadjGhaziri(X,Y)

    h1_sims_over[i,7] <- energy::dcor(X,Y)
    h1_sims_over[i,8] <- energy::dcor.ttest(X,Y)$estimate

    X=cbind(X, scale(rnorm(n_indivdual)) * sqrt(1 / initial_var))
    Y=cbind(Y, scale(rnorm(n_indivdual)) * sqrt(1 / initial_var))
}
@

400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415
\subsection{Empirical assessment of the coefficient of determination}
The coefficient of determination ($\rpearson^2$) represente the part of shared variation between two variables. $\rls^2$ keeps the same meaning when applied to two matrices. But because of over-fitting $\rls$ and therefore $\rls^2$ are over-estimated.

\subsubsection*{between two matrices}

<<estimate_r2_setting, cache=TRUE, message=FALSE, warning=FALSE, include=FALSE>>=
n_sim <- 100         # Count of simulations for each condition
n_indivduals <- c(10,15,20,25)   # Number of simulated individuals (Row count of the matrices)
p_qs <- c(10,20,50,100) # Number of variable foreach matrices (Column counts of the matrices)
r2s_min = 0.05
r2s_max = 1.00
r2s_step=0.05
r2s <- seq(from = r2s_min, to = r2s_max, by = r2s_step )
n_rand <- 100
@

416
To test how the $\irls$ version of the coefficient of determination  $\irls^2$ can perform to evaluate the shared variation, pairs of random matrices were produced for two values of $p \in \{\Sexpr{min(p_qs)},\Sexpr{max(p_qs)}\}$ and $n \in \{\Sexpr{min(n_indivduals)},\Sexpr{max(n_indivduals)}\}$, and for several levels of shared variations ranging between $\Sexpr{r2s_min*2}$ and $\Sexpr{r2s_max}$ by step of $\Sexpr{r2s_step*2}$. For each combination of parameters, $k = \Sexpr{n_sim}$ simulations are run, and both $\rls^2$ and $\irls^2$ are estimated using $\Sexpr{n_rand}$ randomizations.
417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515

<<estimate_r2, cache=TRUE, message=FALSE, warning=FALSE, include=FALSE, dependson="estimate_r2_setting">>=

compute <- TRUE

 r2_sims = array(0,dim = c(n_sim,
                           length(n_indivduals),
                           length(p_qs),
                           length(r2s),
                           2))


if (compute) {
  if (!dir.exists("estimate_r2_setting.cache")) {
    dir.create("estimate_r2_setting.cache")
  }

  for (k in seq_len(n_sim)) {
    filename = sprintf("estimate_r2_setting.cache/%d.rdata",k)
    if (file.exists(filename)) {
      r2_sims[k, , , , ] <- get(load(filename))
    } else {
      for (i in seq_along(n_indivduals))
        for (j in seq_along(p_qs))
          for (r in seq_along(r2s)) {
            X <- simulate_matrix(n_indivduals[i],
                                 p_qs[j],
                                 equal.var = TRUE)
            Y <- simulate_correlation(X,
                                      p_qs[j],
                                      r2 = r2s[r],
                                      equal.var = TRUE)

            r2_sims[k,i,j,r,1] <- corls(X,Y,nrand = n_rand)[1,2]
            r2_sims[k,i,j,r,2] <- corls(X,Y,nrand = 0)[1,2]


          }
      res <- r2_sims[k, , , , ]
      save(res,file = filename)
    }

  }

} else {
  read_r2_cache = function() {

   r2_sims = array(0,dim = c(n_sim,
                             length(n_indivduals),
                             length(p_qs),
                             length(r2s),
                             2))
   k_max <- 0
   for (k in seq_len(n_sim)) {
    filename = sprintf("estimate_r2_setting.cache/%d.rdata",k)
     if (file.exists(filename)) {
      r2_sims[k, , , , ] <- get(load(filename))
      k_max <- k
    }
   }

    r2_sims[1:k_max, , , , ]
  }

  r2_sims <- read_r2_cache()
}
@

<<estimate_r2_comp, message=FALSE, warning=FALSE, include=FALSE>>=

method <-  c("irls","rls")

dimnames(r2_sims)[2:5]  <- list(as.character(n_indivduals),
                                as.character(p_qs),
                                sprintf("%3.2f",r2s),
                                method
                               )

f <- function(i,j,k) bind_cols(n=rep(n_indivduals[i],length(r2s)*n_sim),
                               p=rep(p_qs[j],length(r2s)*n_sim),
                               method=rep(method[k],length(r2s)*n_sim),
                               as_tibble(r2_sims[,i,j,,k]) %>% gather(r2_sim,r_obs))

params <- expand.grid(n = seq_along(n_indivduals),
                      p = seq_along(p_qs),
                      m = seq_along(method))

r2_sims_all = do.call(bind_rows,
                      apply(t(mapply(f,
                                     params$n,
                                     params$p,
                                     params$m)),
                            1,as_tibble))


@

\subsubsection*{between two vectors}

516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586
<<estimate_r2_vector_setting, cache=TRUE, message=FALSE, warning=FALSE, include=FALSE>>=
n_sim <- 100         # Count of simulations for each condition
n_indivduals <- c(10,15,20,25)   # Number of simulated individuals (Row count of the matrices)
r2s_min = 0.05
r2s_max = 1.00
r2s_step=0.05
r2s <- seq(from = r2s_min, to = r2s_max, by = r2s_step )
n_rand <- 100
@

Coefficient of determination between two vectors also suffers from over-estimation when $n$ the number of considered points is small. On average for two random vectors of size $n$, $\overline{R^2}=1/(n-1)$. This random part of the shared variation inflates the observed shared variation even for not random vectors. In the context of multiple linear regression, \cite{Theil:58:00} proposed an adjusted version of the coefficient of determination (Equation~\ref{eq:r2adj}) correcting for both the effect of the number of vector considered ($p$) and of the vector size ($n$).

\begin{equation}
R^2_{adj}= 1 - (1 - R^2) \frac{n-1}{n-p-1}
\label{eq:r2adj}
\end{equation}

To evaluate the strength of that over-estimation and the relative effect of the correction proposed by \cite{Theil:58:00} and by $\irls$, pairs of random vectors were produced for  $n \in \{\Sexpr{min(n_indivduals)},\Sexpr{max(n_indivduals)}\}$, and for several levels of shared variations ranging between $\Sexpr{r2s_min*2}$ and $\Sexpr{r2s_max}$ by step of $\Sexpr{r2s_step*2}$. For each combination of parameters, $k = \Sexpr{n_sim}$ simulations are run, and  $R^2$, $R^2_{adj}$ and $\irls^2$ are estimated using $\Sexpr{n_rand}$ randomizations.

<<estimate_r2_vector, cache=TRUE, message=FALSE, warning=FALSE, include=FALSE, dependson="estimate_r2_vector_setting">>=

r2_sims_vec = array(0,dim = c(n_sim,
                         length(n_indivduals),
                         length(r2s),
                         3))


for (k in seq_len(n_sim)) {
    for (i in seq_along(n_indivduals))
        for (r in seq_along(r2s)) {
          X <- simulate_matrix(n_indivduals[i],
                               1,
                               equal.var = TRUE)
          Y <- simulate_correlation(X,
                                    1,
                                    r2 = r2s[r],
                                    equal.var = TRUE)

          r2_sims_vec[k,i,r,1] <- corls(X,Y,nrand = n_rand)[1,2]^2
          r2_sims_vec[k,i,r,2] <- corls(X,Y,nrand = 0)[1,2]^2
          r2_sims_vec[k,i,r,3] <- 1 - (1 - cor(X,Y)^2) * (n_indivduals[i] -1) / (n_indivduals[i] - 2)
        }
  }

@

<<estimate_r2_vector_comp, message=FALSE, warning=FALSE, include=FALSE>>=

method <-  c("irls", "r", "r.adjusted")

dimnames(r2_sims_vec)[2:4]  <- list(as.character(n_indivduals),
                                sprintf("%3.2f",r2s),
                                method
                               )

f <- function(i,k) bind_cols(n=rep(n_indivduals[i],length(r2s)*n_sim),
                               method=rep(method[k],length(r2s)*n_sim),
                               as_tibble(r2_sims_vec[,i,,k]) %>% gather(r2_sim,r_obs))

params <- expand.grid(n = seq_along(n_indivduals),
                      m = seq_along(method))

r2_sims_vec_all = do.call(bind_rows,
                      apply(t(mapply(f,
                                     params$n,
                                     params$m)),
                            1,as_tibble))


@

587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756
\subsubsection*{partial determination coefficients}

\begin{figure}[!tpb]%figure1

<<estimate_partial_r2_setting, cache=TRUE, message=FALSE, warning=FALSE, include=FALSE>>=
n_sim <- 100         # Count of simulations for each condition
n_indivdual <- 20    # Number of simulated individuals (Row count of the matrices)
p_q <- 200 # Number of variable foreach matrices (Column counts of the matrices)
r2_AB = 0.8
r2_BC = 0.4
r2_CD = 0.2
n_rand <- 1000
@

<<fig_nested_shared_variation, echo=FALSE, message=FALSE, warning=FALSE, fig.height=4, fig.width=4>>=
xxx = futile.logger::flog.threshold(futile.logger::ERROR, name = "VennDiagramLogger")

scale = 1000

Af = 1
At = scale
A = Af:At

ABf = Af
ABt = ABf + r2_AB * (At - Af + 1) - 1
Bf  = At + 1
Bt  = Bf + (1 - r2_AB) * scale - 1
B = c(ABf:ABt,Bf:Bt)

ABCf = ABf
ABCt = ABCf + r2_BC * (ABt - ABf + 1) - 1
BCf  = Bf
BCt  = BCf + r2_BC * (Bt - Bf + 1) - 1
Cf   = Bt + 1
Ct   = Cf + (1 - r2_BC) * scale - 1
C    = c(ABCf:ABCt,BCf:BCt,Cf:Ct)

ABCDf = ABCf
ABCDt = ABCDf + r2_CD * (ABCt - ABCf + 1) - 1
BCDf  = BCf
BCDt  = BCDf + r2_CD * (BCt - BCf + 1) - 1
CDf   = Cf
CDt   = CDf + r2_CD * (Ct - Cf + 1) - 1
Df   = Ct + 1
Dt   = Df + (1 - r2_CD) * scale - 1
D    = c(ABCDf:ABCDt,BCDf:BCDt,CDf:CDt,Df:Dt)

grid.newpage()
venn.plot <- venn.diagram(
  x = list(A = A, B = B, C = C, D = D),
  euler.d = TRUE,
  col = "transparent",
  cat.col = c("darkblue", "darkgreen", "orange", "darkorchid4"),
  fill = c("cornflowerblue", "green", "yellow", "darkorchid1"),
	scaled = TRUE,
  filename = NULL
)
grid.draw(venn.plot)
@
\caption{Theoritical distribution of the shared variation between the four matrices $\mathbf{A},\,\mathbf{B},\,\mathbf{C},\,\mathbf{D}$, expressed in permille.}
\label{fig:nested_shared_variation}
\end{figure}

To evaluate capacity of partial determination coefficient $\irls_{partial}^2$ to distangle nested correlations, four matrices $\mathbf{A},\,\mathbf{B},\,\mathbf{C},\,\mathbf{D}$ of size $n \times p = \Sexpr{n_indivdual} \times \Sexpr{p_q}$ are generated according to the schema: $\mathbf{A}$ shares $\Sexpr{round(r2_AB *100)}\%$ of variation with $\mathbf{B}$, that shares $\Sexpr{round(r2_BC *100)}\%$ of variation with $\mathbf{C}$, sharing $\Sexpr{round(r2_CD *100)}\%$ of variation with $\mathbf{D}$. These direct correlations induce indirect ones spreading the total variation among each pair of matricies according to Figure~\ref{fig:nested_shared_variation}. The simulation is repeadted $\Sexpr{n_sim}$ times, for every simutation $\irls_{partial}^2$ and $\rls_{partial}^2$ are estimated for each pair of matrices.

<<estimate_partial_r2, cache=TRUE, message=FALSE, warning=FALSE, include=FALSE, dependson="estimate_partial_r2_setting">>=

compute <- TRUE

 partial_r2_sims = array(0,dim = c(n_sim,
                           4,
                           4,
                           2))

if (compute) {
  if (!dir.exists("estimate_partial_r2.cache")) {
    dir.create("estimate_partial_r2.cache")
  }

  for (k in seq_len(n_sim)) {
    filename = sprintf("estimate_partial_r2.cache/%d.rdata",k)
    if (file.exists(filename)) {
      partial_r2_sims[k, , , ] <- get(load(filename))
    } else {
            A <- simulate_matrix(n_indivdual,
                                 p_q,
                                 equal.var = TRUE)

            B <- simulate_correlation(A,
                                      p_q,
                                      r2 = r2_AB,
                                      equal.var = TRUE)

            C <- simulate_correlation(B,
                                      p_q,
                                      r2 = r2_BC,
                                      equal.var = TRUE)

            D <- simulate_correlation(C,
                                      p_q,
                                      r2 = r2_CD,
                                      equal.var = TRUE)

            partial.data = procmod.frame(A=A,B=B,C=C,D=D)
            partial_r2_sims[k, , ,1] <- corls.partial(partial.data,nrand = n_rand)
            partial_r2_sims[k, , ,2] <- corls.partial(partial.data,nrand = 0)


      res <- partial_r2_sims[k, , , ]
      save(res,file = filename)
    }
  }
} else {
  read_partial_r2_cache = function() {

   partial_r2_sims = array(0,dim = c(n_sim,
                           4,
                           4,
                           2))

   k_max <- 0
   for (k in seq_len(n_sim)) {
    filename = sprintf("estimate_partial_r2.cache/%d.rdata",k)
     if (file.exists(filename)) {
      partial_r2_sims[k, , , ] <- get(load(filename))
      k_max <- k
    }
   }

    partial_r2_sims[1:k_max, , , ]
  }

  partial_r2_sims <- read_partial_r2_cache()
}
@

<<estimate_partial_r2_comp, message=FALSE, warning=FALSE, include=FALSE>>=
dimnames(partial_r2_sims)[2:4]  <- list(c("A","B","C","D"),
                                    c("A","B","C","D"),
                                    c("irls.partial",
                                      "rls.partial")
                                       )

partial_r2_sims.tab = apply(partial_r2_sims,
                            MARGIN = c(1,4),
                            FUN = function(x) as.data.frame(as.table(x)))


partial_r2_sims.irlsp = do.call(rbind,
                                    lapply(1:n_sim,
                                           function(i) partial_r2_sims.tab[i,1]$irls.partial))

partial_r2_sims.irlsp$method = "irls.partial"

partial_r2_sims.rlsp = do.call(rbind,
                                    lapply(1:n_sim,
                                           function(i) partial_r2_sims.tab[i,2]$rls.partial))

partial_r2_sims.rlsp$method = "rls.partial"

rbind(partial_r2_sims.irlsp,
      partial_r2_sims.rlsp) %>%
  filter(as.character(Var1) < as.character(Var2)) -> partial_r2_sims.stats

@

\subsection{Testing significance of $\irls(\X,\Y)$}

Significance of $\irls(\X,\Y)$ can be tested using permutation test as defined in \cite{Jackson:95:00} or \cite{Peres-Neto:01:00} and implemented respectively in the \texttt{protest} method of the vegan R package \citep{Dixon:03:00} or the \texttt{procuste.rtest} method of the ADE4 R package \cite{Dray:07:00}.

757
It is also possible to take advantage of the Monte-Carlo estimation of $\overline{\rcovls(\X,\Y)}$ to test that $\icovls(\X,\Y)$ and therefore $\irls(\X,\Y)$ are greater than expected under random hypothesis. Let counting over the $k$ randomization when $\rcovls(\X,\Y)_k$ greater than $\covls(\X,\Y)$ name this counts $N_{>\covls}$. $\pvalue$ of the test can be estimated following Equation~(\ref{eq:pvalue}).
758 759 760 761 762

\begin{equation}
\pvalue= \frac{N_{>\covls}}{k}
\label{eq:pvalue}
\end{equation}
763

764
\subsubsection*{Empirical assessment of $\alpha\text{-risk}$ for the $\covls$ test}
765 766 767 768 769 770 771 772

<<estimate_alpha_setting, cache=TRUE, message=FALSE, warning=FALSE, include=FALSE>>=
n_sim <- 1000         # Count of simulations for each condition
n_indivdual <- 20   # Number of simulated individuals (Row count of the matrices)
p_qs <- c(10,20,50) # Number of variable foreach matrices (Column counts of the matrices)
n_rand <- 1000
@

Eric Coissac committed
773
To assess empirically the $\alpha\text{-risk}$ of the procruste test based on the randomisations realized during the estimation of $\overline{\rcovls(\X,\Y)}$, distribution of $P_{value}$ under the $H_0$ is compared to a uniform distribution between $0$ and $1$ ($\mathcal{U}(0,1)$). To estimate such empirical distribution,  $k=\Sexpr{n_sim}$ pairs of $n \times p$ random matrices with $n=\Sexpr{n_indivdual}$ and
774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808
$p \in \{\Sexpr{p_qs}\}$ are simulated under the null hypothesis of independancy. Procruste correlation between whose matrices is tested based on three tests. Our proposed test ($CovLs.test$), the \texttt{protest} method of the vegan R package and the \texttt{procuste.rtest} method of the ADE4 R package. Conformance of the distribution of each set of $k$ $P_{value}$ to $\mathcal{U}(0,1)$ is assessed using the Cramer-Von Mises test \citep{CSoRgo:96:00} implemented in the \texttt{cvm.test} function of the R package \texttt{goftest}.

<<estimate_alpha, cache=TRUE, message=FALSE, warning=FALSE, include=FALSE, dependson="estimate_alpha_setting">>=
h0_alpha = array(0,dim = c(n_sim,length(p_qs),3))

for (k in seq_len(n_sim))
  for (i in seq_along(p_qs)) {
      X <- simulate_matrix(n_indivdual,p_qs[i],equal.var = TRUE)
      Y <- simulate_matrix(n_indivdual,p_qs[i],equal.var = TRUE)

      h0_alpha[k,i,1] <- attr(corls(X,Y,nrand = n_rand),"p.value")[1,2]
      h0_alpha[k,i,2] <- vegan::protest(X,Y,permutations = n_rand)$signif
      h0_alpha[k,i,3] <- ade4::procuste.rtest(as.data.frame(X),
                                              as.data.frame(Y),
                                              nrepet = n_rand)$pvalue

    }
@

<<estimate_alpha_complementary, cache=TRUE, message=FALSE, warning=FALSE, include=FALSE>>=
dimnames(h0_alpha)[[3]] <- c("Covls.test","protest",
                            "procuste.rtest")

dimnames(h0_alpha)[[2]] <- as.character(p_qs)

h0_alpha_tibble <- as_tibble(h0_alpha[, , 1]) %>% gather(p, Covls.test) %>%
                    bind_cols( as_tibble(h0_alpha[, , 2]) %>% gather(p, "protest")) %>%
                    bind_cols( as_tibble(h0_alpha[, , 3]) %>% gather(p, "procuste.rtest"))

h0_alpha_tibble <- h0_alpha_tibble[,c(1,2,4,6)]

h0_alpha_all <- h0_alpha_tibble %>% gather(method,p.value,-p)

@

809
\subsubsection*{Empirical power assessment for the $CovLs$ test}
810 811 812 813 814

<<estimate_power_setting, cache=TRUE, message=FALSE, warning=FALSE, include=FALSE>>=
n_sim <- 1000         # Count of simulations for each condition
n_indivduals <- c(10,15,20,25)   # Number of simulated individuals (Row count of the matrices)
p_qs <- c(10,20,50,100) # Number of variable foreach matrices (Column counts of the matrices)
815
r2s <- c(1:2) * 5/100
816 817 818
n_rand <- 1000
@

819
To evaluate relative power of the three considered tests, pairs of to random matrices were produced for various $p \in \{\Sexpr{p_qs}\}$, $n \in \{\Sexpr{n_indivduals}\}$ and two levels of shared variations $\rpearson^2 \in \{\Sexpr{r2s}\}$. For each combination of parameters, $k = \Sexpr{n_sim}$ simulations are run. Each test are estimated based on $\Sexpr{n_rand}$ randomizations for the $CovLs$ test, or permutations for \texttt{protest} and \texttt{procuste.rtest}.
820 821 822

<<estimate_power, cache=TRUE, message=FALSE, warning=FALSE, include=FALSE, dependson="estimate_power_setting">>=

823 824 825 826 827 828 829 830
compute <- TRUE

 h1_sims = array(0,dim = c(n_sim,
                           length(n_indivduals),
                           length(p_qs),
                           length(r2s),
                           3))

831

832 833 834
if (compute) {
  if (!dir.exists("estimate_power_setting.cache")) {
    dir.create("estimate_power_setting.cache")
835 836
  }

837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863
  for (k in seq_len(n_sim)) {
    filename = sprintf("estimate_power_setting.cache/%d.rdata",k)
    if (file.exists(filename)) {
      h1_sims[k, , , , ] <- get(load(filename))
    } else {
      for (i in seq_along(n_indivduals))
        for (j in seq_along(p_qs))
          for (r in seq_along(r2s)) {
            X <- simulate_matrix(n_indivduals[i],
                                 p_qs[j],
                                 equal.var = TRUE)
            Y <- simulate_correlation(X,
                                      p_qs[j],
                                      r2 = r2s[r],
                                      equal.var = TRUE)

            h1_sims[k,i,j,r,1] <- attr(corls(X,Y,nrand = n_rand),"p.value")[1,2]
            h1_sims[k,i,j,r,2] <- suppressWarnings(vegan::protest(X,Y,permutations = n_rand)$signif)
            h1_sims[k,i,j,r,3] <- ade4::procuste.rtest(as.data.frame(X),
                                                    as.data.frame(Y),
                                                    nrepet = n_rand)$pvalue


          }
      res <- h1_sims[k, , , , ]
      save(res,file = filename)
    }
864

865
  }
866

867
} else {
868
  read_h1_cache = function() {
869 870 871 872

   h1_sims = array(0,dim = c(n_sim,
                             length(n_indivduals),
                             length(p_qs),
873 874 875
                             length(r2s),
                             3))
   k_max <- 0
876
   for (k in seq_len(n_sim)) {
877
    filename = sprintf("estimate_power_setting.cache/%d.rdata",k)
878 879
     if (file.exists(filename)) {
      h1_sims[k, , , , ] <- get(load(filename))
880
      k_max <- k
881 882 883
    }
   }

884
    h1_sims[1:k_max, , , , ]
885 886
  }

887
  h1_sims <- read_h1_cache()
888
}
889 890
@

891 892 893 894 895 896 897 898 899
<<estimate_power_comp, message=FALSE, warning=FALSE, include=FALSE>>=
dimnames(h1_sims)[2:5]  <- list(as.character(n_indivduals),
                               as.character(p_qs),
                               as.character(r2s),
                               c("Covls.test",
                                 "protest",
                                 "procuste.rtest")
                              )

900 901
alpha <- 0.05

902 903 904 905 906
power <- apply(h1_sims < alpha,
               MARGIN = 2:5,
               FUN = mean)
@

907 908 909
\vspace*{1pt}
\end{methods}

910 911 912 913 914 915
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% RESULTS
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

916 917
\section{Results}

918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013
\subsection{Empirical assessment of $\overline{\rcovls(\X,\Y)}$}

\begin{table}[!t]
\processtable{Estimation of $\overline{\rcovls(\X,\Y)}$ according to the number of random matrices (k) aligned.\label{tab:mrcovls}}{
<<tab_mrcov, echo=FALSE, results="asis" >>=
p_qs <- dimnames(nrand_sims_stats)[[2]]
n_rands <- dimnames(nrand_sims_stats)[[4]]
stats <- dimnames(nrand_sims_stats)[[1]]
distr <- dimnames(nrand_sims_stats)[[3]]

nrand_cond <- expand.grid(
  stats,
  distr,
  p_qs
)

nrand_tab <- apply(nrand_cond,
  MARGIN = 1,
  function(x) nrand_sims_stats[x[1], x[3], x[2], ]
)


nrand_tab <- as.data.frame(do.call(rbind, lapply(
  (seq_along(p_qs) - 1) * length(p_qs) + 1,
  function(i) nrand_tab[, i:(i + length(p_qs) - 1)]
)))

e = rev(1:length(distr) * length(stats))
e = e[-1]
nrand_tab <- as.data.frame(Reduce(function(a, b) append(
    a, list(` ` = rep(
      " ",
      nrow(nrand_tab)
    )),
    b
  ),
e,
init = nrand_tab
))

nc = ncol(nrand_tab)

p <- rep(p_qs, rep(length(n_rands), length(p_qs)))
p <- mapply(sprintf,"\\hline\\multirow{%d}{*}{%s}",
                    length(n_rands),
                    p)
p[duplicated(p)] <- ""

nrand_tab <- cbind(p = p,
                   nrand = rep(n_rands, length(p_qs)),
                   nrand_tab)

d = c("s", "d","d",rep(c("f", "e", "s"), length(distr)))
d = d[-length(d)]

tab <- xtable(nrand_tab,
  digits = 4,
  align = c("l","r","r",rep("r", nc)),
  display = d
)

print(tab,
  floating = FALSE,
  include.colnames = FALSE,
  include.rownames = FALSE,
  table.placement = "!t",
  tabular.environment = "tabular",
  sanitize.text.function = force,
  hline.after = c(-1,nrow(tab)),
  add.to.row = list(
    pos = list(0),
    command = paste0("& & ",
      paste(mapply(sprintf,"\\multicolumn{2}{c}{%s}",distr),
              collapse = " & & "
              ),
       "\\\\",
      paste(mapply(sprintf," \\cline{%d-%d}",
                           (seq_along(distr) - 1) * (length(stats) + 1) + 3,
                           (seq_along(distr) - 1) * (length(stats) + 1) + 2 + length(stats)),
                  collapse = "  "
      ),
      "p & k &",
      paste(
      rep(paste(mapply(sprintf,"\\multicolumn{1}{c}{%s}",stats),collapse = " & "),
          length(distr)),
      collapse = " & \\multicolumn{1}{c}{\ } &"
      ),
      "\\\\"
    )
  ),
  math.style.exponents = TRUE
)
@
}{\ } % <- we can add a footnote in the last curly braces
\end{table}

Eric Coissac committed
1014
Two main parameters can influence the Monte Carlo estimation of $\overline{\rcovls(\X,\Y)}$ : the distribution used to generate the random matrices and $k$ the number of random matrix pair. Two very different distribution are tested to regenerate the random matrices, the normal and the exponential distributions. The first one is symmetric where the second is not with a high probability for small values and a long tail of large ones. Despite the use of these contrasted distributions, estimates of $\overline{\rcovls(\X,\Y)}$ and of $\sigma(\overline{\rcovls(\X,\Y)})$ are identical if we assume the normal distribution of the  $\overline{\rcovls(\X,\Y)}$ estimator and a $0.95$ confidence interval of $\overline{\rcovls(\X,\Y)} \pm 2 \, \sigma(\overline{\rcovls(\X,\Y)})$ (Table~\ref{tab:mrcovls}).
Eric Coissac committed
1015

1016 1017 1018 1019 1020
\subsection{Relative sensibility of $IRLs(X,Y)$ to overfitting}

\begin{figure}[!tpb]%figure1
A)

1021
<<fig_h0, echo=FALSE, message=FALSE, warning=FALSE, fig.height=4, fig.width=6>>=
1022 1023 1024
pq <- c(2,5,10,15,20,25,30,35,40,45,50)
h0_plotted <- h0_sims_all[h0_sims_all$p %in% pq,]

1025 1026 1027
h0_plotted %>%
  filter(as.numeric(as.character(p)) %% 2 == 0) %>%
ggplot(aes(x = p,
1028 1029
           y = correlation,
           color = method)) +
1030
  facet_grid(. ~ group) +
1031
  geom_boxplot() +
1032
  scale_color_discrete(name = "Method")
1033 1034 1035 1036
@

B)

1037
<<fig_h0_11, echo=FALSE, message=FALSE, warning=FALSE, fig.height=4, fig.width=6>>=
1038 1039 1040
h0_sims11_R %>%
  filter(as.numeric(as.character(n)) %% 2 == 0) %>%
ggplot(aes(x = n,
1041 1042 1043
           y = correlation,
           color = method)) +
  geom_boxplot() +
1044 1045
  ylab(TeX('$|R|$')) +
  scale_color_discrete(name="Method")
1046 1047 1048 1049 1050 1051
@
\caption{A) Sensibility to overfitting for various correraltion coefficients. (A) Both simulated data sets are matrices of size $(n \times p)$ with $p > 1$. B) Correlated data sets are vectors ($p=1$) with a various number of individuals $n$ (vector length). A \& B) 100 simulations are run for each combination of parameters}
\label{fig:h0_overfit}
\end{figure}


1052
$RLs$, like $RV$ and $dCor$, is sensible to overfitting which increase when $n$ decrease, and $p$ or $q$ increase. Because $RV$ is more comparable to $R^2$ when $RLs$ and $dCor$ are more comparable to $R$, $RV$ values increase more slowly than $RLs$ and $dCor$ values with $p$ (Figure~\ref{fig:h0_overfit}A). Because of its definition $IRLs$ values for non-correlated matrices are close to $0$ whatever $p$ (Figure~\ref{fig:h0_overfit}A).
1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070

\subsection{Evaluating the shared variation}

\subsubsection*{between two matrices}

$\rls$ can be considered for matrices as a strict equivalent of Pearson's $\rpearson$ for vectors. Therefore its squared value is an estimator of the shared variation between two matrices. But because of over-fitting the estimation is over-estimated. The proposed corrected vection ($\irls$) of that coefficient is able to provide a good estimate of the shared variation and is perfectly robust to the over-fitting phenomenon (Figure~\ref{fig:shared_variation}). Only a small over evalution is observable for the low values of simulated shared variation.

\begin{figure*}[!tpb]%figure1
<<fig__r2, echo=FALSE, message=FALSE, warning=FALSE, fig.height=4, fig.width=8>>=
label_both_equal <- function(labels, multi_line = TRUE, sep = " = ")
                        label_both(labels = labels,
                                   multi_line = multi_line,
                                   sep = sep)
class(label_both_equal) <- class(label_both)

r2_sims_all %>%
  filter(n==10 | n==25) %>%
  filter(p==10 | p==100) %>%
1071 1072 1073 1074
  filter(as.numeric(r2_sim) == round(as.numeric(r2_sim),1)) %>%
  mutate(bias = r_obs^2-as.numeric(r2_sim)) %>%
  mutate(method = factor(as.character(method),levels = c("rls", "irls")))  %>%
  ggplot(aes(x=r2_sim,y=bias, col=method)) +
1075 1076 1077
  facet_grid(n ~ p,
             labeller = labeller(.rows = label_both_equal,
                                 .cols = label_both_equal)) +
1078
  geom_abline(slope = 0,intercept = 0,lty=2,col="black") +
1079
  geom_boxplot(outlier.size = 0.5) +
1080
  ylab(TeX('$bias = estimated \\; R^2 - simulated \\; R^2$')) +
1081 1082
  xlab(TeX('simulated $R^2$')) +
  scale_color_discrete(name="Method",
1083 1084
                      labels = c(unname(TeX("$RLs$")),
                                 unname(TeX("$IRLs$")))) +
1085 1086
  theme(axis.text.x = element_text(angle = 45, size=7, hjust = 1))
@
1087
\caption{Shared variation ($R^2$) between two matrices is mesured using both the corrected ($\irls$) and the original ($\rls$) versions of the procrustean correlation coefficient. A gradiant of $R^2$ is simulated for two population sizes ($n \in \{10,25\}$) and two numbers of descriptive variables ($p \in \{10,100\}$). The distribution of differences between the observed and the simulated shared variation is ploted for each condition. The black dashed line corresponds to a perfect match where measured $R^2$ equals the simulated one.}
1088 1089 1090 1091 1092
\label{fig:shared_variation}
\end{figure*}

\subsubsection*{between two vectors}

1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126
Vectors can be considered as a single column matrix, and the efficiency of $\irls^2$ to estimate shared variation between matrices can also be used to estimate shared variation between two vectors. Other formulas have been already proposed to better estimate shared variation between vectors in the context of linear models. Among them the one presented in Equation~\ref{eq:r2adj}, is the most often used and is the one implemented in R linear model summary function. On simulated data, $\irls^2$ performs better than the simple $R^2$ and its modified version $R^2_{adj}$ commonly used (Figure~\ref{fig:shared_variation_vector}). Whatever the estimator the bias decrease with the simulated shared variation. Nevertheless for every tested cases the median of the bias observed is smaller than with both other estimators, even if classical estimators well perfom for large values of shared variation.

\begin{figure}[!tpb]
<<fig__r2_vec, echo=FALSE, message=FALSE, warning=FALSE, fig.height=4, fig.width=6>>=
label_both_equal <- function(labels, multi_line = TRUE, sep = " = ")
                        label_both(labels = labels,
                                   multi_line = multi_line,
                                   sep = sep)
class(label_both_equal) <- class(label_both)

r2_sims_vec_all %>%
  filter(n==10 | n==25) %>%
  filter(as.numeric(r2_sim) == round(as.numeric(r2_sim),1)) %>%
  mutate(bias = r_obs-as.numeric(r2_sim)) %>%
  mutate(method = factor(as.character(method),levels = c("r", "r.adjusted", "irls")))  %>%
  ggplot(aes(x=r2_sim, y=bias, col=method)) +
  facet_grid(n ~ .,
             labeller = labeller(.rows = label_both_equal,
                                 .cols = label_both_equal)) +
  geom_abline(slope = 0,intercept = 0,lty=2,col="black") +
  geom_boxplot(outlier.size = 0.5) +
  ylab(TeX('$bias = estimated \\; R^2 - simulated \\; R^2$')) +
  xlab(TeX('simulated $R^2$')) +
  scale_color_discrete(name="Method",
                      labels = c(unname(TeX("$R$")),
                                 unname(TeX("$R_{adj.}$")),
                                 unname(TeX("$IRLs$"))
                                 )) +
  theme(axis.text.x = element_text(angle = 45, size=7, hjust = 1))
@
\caption{Shared variation between two vectors is mesured using the classical $\rpearson^2$, its ajusted version $R^2_{adj}$ and ($\irls^2$). A gradiant of shared variation is simulated for two vector sizes ($n \in \{10,25\}$). The black dashed line corresponds to a perfect match where measured $R^2$ equals the simulated one.}
\label{fig:shared_variation_vector}
\end{figure}

1127
\subsubsection*{partial coefficient of determination}
Eric Coissac committed
1128
The simulated correlation network between the four matrices $\mathbf{A},\,\mathbf{B},\,\mathbf{C},\,\mathbf{D}$ induced moreover the direct simulated correlation a network of indirect correlation and therefore shared variances (Figure~\ref{fig:nested_shared_variation}). In such system, the interest of partial correlation coefficients and their associated partial determination coefficients is to measure correlation between a pair of variable without accounting for the part of that correlation which is explained by other variables, hence extracting the pure correlation between these two matrices. From Figure~\ref{fig:nested_shared_variation}, the expected partial shared variation between $\mathbf{A}$ and $\mathbf{B}$ is $480/(200+480)=0.706$; between $\mathbf{B}$ and $\mathbf{C}$, $64/(480+120)=0.107$; and between $\mathbf{C}$ and $\mathbf{D}$ $120/800=0.150$. All other partial coefficient are expected to be equal to $0$. The effect of the correction introduced in $\irls$ is clearly weaker and on the partial coefficient of determination (Figure~\ref{fig:nested_shared}) than on the full coefficient of determination (Figure~\ref{fig:shared_variation}). The spurious random correlations, constituting the over-fitting effect, is distributed over all the pair of matrices $\mathbf{A},\,\mathbf{B},\,\mathbf{C},\,\mathbf{D}$.
1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143

\begin{figure}[!tpb]%figure1
<<fig_nested_shared, echo=FALSE, message=FALSE, warning=FALSE, fig.height=4, fig.width=6>>=
partial_r2_sims.stats$pairs = factor(as.character(interaction(partial_r2_sims.stats$Var1,
                                          partial_r2_sims.stats$Var2,
                                          drop = TRUE)),
                                     levels=c("A.B","B.C","C.D","A.C","A.D","B.D")
)

partial_r2_sims.stats$expected = 0
partial_r2_sims.stats$expected[partial_r2_sims.stats$pairs=="A.B"] = 0.706
partial_r2_sims.stats$expected[partial_r2_sims.stats$pairs=="B.C"] = 0.107
partial_r2_sims.stats$expected[partial_r2_sims.stats$pairs=="C.D"] = 0.150

ggplot(data = partial_r2_sims.stats,
1144
       aes(x=pairs,y=expected-Freq^2,col=method)) +
1145 1146
  geom_boxplot() +
  xlab("Pair of matrices") +
1147 1148
  ylab(TeX("$bias = estimated \\; R^2 - expected \\; R^2$")) +
  geom_abline(slope = 0,intercept = 0,lty=2,col="black") +
1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159
  scale_color_discrete(name="Method",
                      labels = c(unname(TeX("$IRLs_{partial}$")),
                                 unname(TeX("$RLs_{partial}$")))) +
  theme(legend.text.align = 0)

@
\caption{Estimation error on the partial determination coefficient. Error is defined as the absolute value of the difference between the expected and the estimated partial $R^2$ using the corrected $\irls_{partial}$ and not corrected $\rls_{partial}$ procruste correlation coefficient.}
\label{fig:nested_shared}
\end{figure}


1160 1161 1162 1163 1164 1165 1166 1167 1168 1169
\subsection{$p_{value}$ distribution under null hyothesis}

As expected, $P_{values}$ of the $CovLs$ test based on the estimation of $\overline{RCovLs(X,Y)}$ are uniformely distributed under $H_0$.
whatever the $p$ tested (Table~\ref{tab:alpha_pvalue}). This ensure that the probability of a $P_{value} \leqslant \alpha\text{-risk}$ is equal to $\alpha\text{-risk}$. Moreover $P_{values}$ of the $CovLs$ test are strongly linerarly correlated with those of both the other tests ($R^2=\Sexpr{round(cor(h0_alpha_tibble$Covls.test,h0_alpha_tibble$protest)^2,3)}$ and $R^2=\Sexpr{round(cor(h0_alpha_tibble$Covls.test,h0_alpha_tibble$procuste.rtest)^2,3)}$ respectively for the correlation with \texttt{vegan::protest} and \texttt{ade4::procuste.rtest} $P_{values}$). The slopes of the corresponding linear models are respectively $\Sexpr{round(lm(h0_alpha_tibble$Covls.test~h0_alpha_tibble$protest)$coefficients[2],3)}$ and $\Sexpr{round(lm(h0_alpha_tibble$Covls.test~h0_alpha_tibble$procuste.rtest)$coefficients[2],3)}$.

\begin{table}[!t]
\processtable{$P_{values}$ of the Cramer-Von Mises test of conformity
                        of the distribution of $P_{values}$ correlation test to $\mathcal{U}(0,1)$
                        under the null hypothesis.\label{tab:alpha_pvalue}} {
<<pvalue_alpha_h0, echo=FALSE, results="asis" >>=
1170 1171 1172 1173 1174 1175 1176 1177 1178
tab <- xtable(apply(h0_alpha,
                    c(2, 3),
                    function(x) cvm.test(x,
                                         punif,
                                         0,
                                         1)$p.value),
              align = c("@{\\extracolsep{\\fill}}c",
                        rep("r",3)),
              digit = 3
1179 1180 1181 1182 1183 1184
)

print(tab,
  floating = FALSE,
  include.colnames = FALSE,
  table.placement = "!t",
1185 1186
  tabular.environment = "tabular*",
  width="0.98\\linewidth",
1187 1188 1189 1190 1191
  add.to.row = list(
    pos = list(0),
    command = c(
      "& \\multicolumn{3}{c}{Cramer-Von Mises p.value} \\\\
           \\cline{2-4}
1192
           p & CovLs test & \\texttt{protest} & \\texttt{procuste.rtest} \\\\ "
1193 1194 1195 1196 1197 1198 1199 1200 1201
    )
  )
)
@
}{} % <- we can add a footnote in the last curly praces
\end{table}

\subsection{Power of the test based on randomisation}

Eric Coissac committed
1202
Power of the $CovLs$ test based on the estimation of $\overline{RCovLs(X,Y)}$ is equivalent of the power estimated for both \texttt{vegan::protest} and \texttt{ade4::procuste.rtest} tests (Table \ref{tab:power}). As for the two other tests, power decreases when the number of variable ($p$ or $q$) increases, and increase with the number of individuals and the shared variation. The advantage of the test based on the Monte-Carlo estimation of $\overline{RCovLs(X,Y)}$ is to remove the need of running a supplementary set of permutations when $\irls$ is computed.
1203

1204
\begin{table}[!t]
1205
\processtable{Power estimation of the procruste tests for two low level of shared variations $5\%$ and $10\%$.\label{tab:power}} {
1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257
<<power_table, echo=FALSE, results="asis" >>=
n_indivduals <- dimnames(power)[[1]]
p_qs <- dimnames(power)[[2]]
r2s <- dimnames(power)[[3]]
tests <- dimnames(power)[[4]]
p05 <- power[,,1,]
p10 <- power[,,2,]

tab <- round(rbind(cbind(p05[,,1],p10[,,1]),
                   cbind(p05[,,2],p10[,,2]),
                   cbind(p05[,,3],p10[,,3])),2)
dtab=dim(tab)
tab <- sprintf("%3.2f",tab)
dim(tab)=dtab
tab <- cbind(test = rep(paste0(paste0("\\hline\\multirow{",
                                      length(n_indivduals),
                                      "}{*}{"),tests,"}"),
                        rep(length(n_indivduals),
                            length(tests))),
             n    = rep(n_indivduals,length(tests)),
             tab[, seq_along(p_qs)],
             ` `  = " ",
             tab[, length(p_qs) + seq_along(p_qs)])

tab[duplicated(tab[,1]),1] <- ""

tab <- xtable(tab,
              digits = 2,
              align = c("l", "l", "c", rep("r", length(p_qs) * 2 + 1)),
              display = c('s', rep("f",6),"s",rep("f",4)))
print(tab,
  floating = FALSE,
  include.colnames = FALSE,
  include.rownames = FALSE,
  table.placement = "!t",
  tabular.environment = "tabular",
  sanitize.text.function = force,
  hline.after = c(-1,nrow(tab)),
  add.to.row = list(
    pos = list(0),
    command = paste0(
          "& $R^2$ & \\multicolumn{4}{c}{5\\%} & &\\multicolumn{4}{c}{10\\%} \\\\
           \\cline{3-6} \\cline{8-11}
           & p & ",paste(p_qs,collapse = " & ")," & & ",paste(p_qs,collapse = " & ")," \\\\
           \\cline{3-11}
           & n & \\multicolumn{9}{c}{$power = 1 - \\beta\\text{-risk}$ } \\\\ "
    )
  )
)
@
}{} % <- we can add a footnote in the last curly praces
\end{table}
1258

1259 1260 1261 1262 1263 1264
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DISCUSSION
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

1265 1266
\section{Discussion}

1267
Correcting the over-adjustment effect on metrics assessing the relationship between high dimension datasets is a constant effort over the past decade. Therefore, $\irls$ can be considered as a continuation of the extension of the toolbox available to biologists for analyzing their omics data. The effect of the proposed correction on the classical $\rls$ coefficient is as strong as the other ones previously proposed for other correlation coefficients measuring relationship between vector data \citep[see Figure~\ref{fig:shared_variation}, e.g.][]{Smilde:09:00,SzeKely:13:00}. When applied to univariate data, $\rls$ is equal to the absolute value of the Pearson correlation coefficient, hence, and despite it is not the initial aim of that coefficient, $\irls$ can also be used to evaluate correlation between two univariate datasets. Using $\irls$ for such data sets is correcting for spurious correlations when the number of individual is small more efficiently than classical correction \citep[see Figure~\ref{fig:shared_variation_vector},][]{Theil:58:00}.
1268

1269 1270 1271
The main advantage of $\irls$ over other matrix correlation coefficients is that it allows for estimating shared variation between two matrices according to the classical definition of variance partitioning used with linear models. This opens the opportunity to develop linear models to explain the variation of a high dimension dataset by a set of other high dimension data matrices.

The second advantage of $\irls$ is that its definition  implies that the variance/co-variance matrix of a set of matrices is positive-definite. That allows for estimating partial correlation coefficients matrix by inverting the variance/co-variance matrix. The effect of the correction is less strong on such partial coefficients  than on full correlation, but the partial coefficients that should theoretically be estimated to zero seem to be better identified after the correction.
1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%     please remove the " % " symbol from \centerline{\includegraphics{fig01.eps}}
%     as it may ignore the figures.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\section{Conclusion}
1284 1285

A common approach to estimate strengh of the relationship between two variables is to estimate the part of shared variation. This single value ranging from zero to one is easy to interpret. Such value can also be computed between two sets of variable, but the estimation is more than for simple vector data subject to over estimation because the over-fitting phenomena which is amplified for high dimensional data. With $\irls$ and its squared value, we propose an easy to compute correlation and determination coefficient far less biased than the original Procrustean correlation coefficient. Every needed function to estimate the proposed modified version of these coefficients are included in a R package ProcMod available for download from the Comprehensive R Archive Network (CRAN).
1286

1287
\vspace*{-10pt}
1288 1289 1290 1291


\section*{Acknowledgements}

1292 1293 1294 1295
Text Text Text Text Text Text  Text Text.
Text Text Text Text Text Text  Text Text.
Text Text Text Text Text Text  Text Text.
\vspace*{-12pt}
1296 1297 1298

\section*{Funding}

1299 1300
This work has been supported by the... Text Text  Text Text.
\vspace*{-12pt}
1301 1302 1303 1304 1305 1306 1307 1308 1309

\bibliographystyle{natbib}
%\bibliographystyle{achemnat}
%\bibliographystyle{plainnat}
%\bibliographystyle{abbrv}
%\bibliographystyle{bioinformatics}
%
%\bibliographystyle{plain}
%
1310
\bibliography{../inst/REFERENCES}
1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326

\renewcommand\thesubsection{\Alph{subsection}}

\section*{Appendix}
\subsection{Notations}

\begin{tabular}{p{2cm}p{5cm}}
$\mathbf{x}$ (vector)         & bold lowercase. \\
$\X$ (matrix)         & bold uppercase. \\
$i = 1,..., n$                & object index. \\
$j = 1,..., p$                & variable index. \\
$k$                           & iteration index. \\
$\X'$                 & The transpose of $\X$. \\
$\X \Y$       & Matrix multiplication of $\X$ and $\Y$. \\
$\diag(\X)$           & A column matrix composed of the diagonal
                                elements of $\X$. \\
Eric Coissac committed
1327
$\trace(\X)$           & The trace of $\X$.
1328 1329 1330
\end{tabular}


1331
\end{document}