\def\mode{1}% Class bioinfo if 0; simple article otherwise

\if 0\mode
  \documentclass{bioinfo}\usepackage[]{graphicx}\usepackage[]{color}
% maxwidth is the original width if it is less than linewidth
% otherwise use linewidth (to make sure the graphics do not exceed the margin)
\makeatletter
\def\maxwidth{ %
  \ifdim\Gin@nat@width>\linewidth
    \linewidth
  \else
    \Gin@nat@width
  \fi
}
\makeatother

\definecolor{fgcolor}{rgb}{0.345, 0.345, 0.345}
\newcommand{\hlnum}[1]{\textcolor[rgb]{0.686,0.059,0.569}{#1}}%
\newcommand{\hlstr}[1]{\textcolor[rgb]{0.192,0.494,0.8}{#1}}%
\newcommand{\hlcom}[1]{\textcolor[rgb]{0.678,0.584,0.686}{\textit{#1}}}%
\newcommand{\hlopt}[1]{\textcolor[rgb]{0,0,0}{#1}}%
\newcommand{\hlstd}[1]{\textcolor[rgb]{0.345,0.345,0.345}{#1}}%
\newcommand{\hlkwa}[1]{\textcolor[rgb]{0.161,0.373,0.58}{\textbf{#1}}}%
\newcommand{\hlkwb}[1]{\textcolor[rgb]{0.69,0.353,0.396}{#1}}%
\newcommand{\hlkwc}[1]{\textcolor[rgb]{0.333,0.667,0.333}{#1}}%
\newcommand{\hlkwd}[1]{\textcolor[rgb]{0.737,0.353,0.396}{\textbf{#1}}}%
\let\hlipl\hlkwb

\usepackage{framed}
\makeatletter
\newenvironment{kframe}{%
 \def\at@end@of@kframe{}%
 \ifinner\ifhmode%
  \def\at@end@of@kframe{\end{minipage}}%
  \begin{minipage}{\columnwidth}%
 \fi\fi%
 \def\FrameCommand##1{\hskip\@totalleftmargin \hskip-\fboxsep
 \colorbox{shadecolor}{##1}\hskip-\fboxsep
     % There is no \\@totalrightmargin, so:
     \hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
 \MakeFramed {\advance\hsize-\width
   \@totalleftmargin\z@ \linewidth\hsize
   \@setminipage}}%
 {\par\unskip\endMakeFramed%
 \at@end@of@kframe}
\makeatother

\definecolor{shadecolor}{rgb}{.97, .97, .97}
\definecolor{messagecolor}{rgb}{0, 0, 0}
\definecolor{warningcolor}{rgb}{1, 0, 1}
\definecolor{errorcolor}{rgb}{1, 0, 0}
\newenvironment{knitrout}{}{} % an empty environment to be redefined in TeX

\usepackage{alltt}%
  \copyrightyear{2015} \pubyear{2015}%
  \access{Advance Access Publication Date: Day Month Year}%
  \appnotes{Manuscript Category}%
  \newcommand\authorname[2]{\author[#1]{#2}}
  \newcommand\maintitle[2]{\title[#1]{#2}}
\else
  \documentclass{article}%
  \newcommand\sfb{}
  \newcommand\firstpage[1]{}
  \newcommand\subtitle[1]{}
  \newcommand\history[1]{}
  \newcommand\editor[1]{}
  \newcommand\address[1]{\date{#1}}
  \newcommand\corresp[1]{}
  \newcommand\authorname[2]{\author{#2}}
  \newcommand\maintitle[2]{\title{#2}}
  \newcommand\processtable[3]{\caption{#1}%
                              #2}
  \usepackage{hyperref}
  \usepackage{natbib}
  \usepackage{amssymb}
  \usepackage{xcolor}
  \usepackage{graphicx}
  \usepackage{lineno}
  \newenvironment{methods}{}{}
  \newenvironment{knitrout}{}{}
  \definecolor{fgcolor}{rgb}{0.345, 0.345, 0.345}
  \newcommand\maxwidth{0.8\textwidth}
\fi

\usepackage{amsmath}
\usepackage{lipsum}
\usepackage{multirow}

\DeclareMathOperator{\rpearson}{R}
\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}
\DeclareMathOperator{\diag}{Diag}
\DeclareMathOperator{\pvalue}{P_{value}}

\newcommand{\X}{\mathbf{X}}
\newcommand{\Y}{\mathbf{Y}}
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\begin{document}

\firstpage{1}

\subtitle{Data and text mining}

\maintitle{A modified $Rls$}{Assessing the shared variation among high-dimensional data matrices: a modified version of the Procrustean correlation coefficient}

\authorname{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 \\
$^{\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}

\if 1\mode
\maketitle
\fi

\abstract{\textbf{Motivation:} Molecular biology and ecology are producing many high dimension data.
Estimating correlation and shared variation between such data sets is an important step to distangle relationships among differents elements of a biological system. Unfortunatly when using classical measure, because of the high dimension of the data, high correlation can be falsly infered.   \\
\textbf{Results:} Here we propose a corrected version of the Procrustean correlation coeficient that is not sensible to the high dimension of the data. This allows for a correct estimation of the shared variation between two data sets and of the partial correlation coefficient between a set of matrix data.\\
\textbf{Availability:} The proposed corrected coeficients are implemented in the ProcMod R package available on \url{https://git.metabarcoding.org/lecasofts/ProcMod}\\
\textbf{Contact:} \href{eric.coissac@metabarcoding.org}{eric.coissac@metabarcoding.org}}

\if 0\mode
\maketitle
\else
\linenumbers
\fi




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% INTRODUCTION
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\section{Introduction}

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.

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,\Y)$ an analog of covariance applicable to vectorial data following Equation~(\ref{eq:CovLs})

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

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

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

Among the advantages of $\rls$, its similarity with the Pearson's 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. Besides, when $p=1 \text{ and } q = 1,\; \rls = \lvert \rpearson \rvert$. When squared $\rls$ is an estimate, like the squared Pearson's $\rpearson$, of the amount of variation shared between the two datasets. This property allows for developing variance analyzing of matrix data sets.

Moreover, Procrustean analyses have been proposed as a good alternative to Mantel's statistics for analyzing ecological data summarized by distance matrices \citep{Peres-Neto:01:00}. In such analyze distance matrices are projected into an orthogonal space using metric or non metric multidimensional scaling according to the geometrical properties of the used distances. Correlations are then estimated between these projections.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% APPROACH
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\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}
\X'\Y=\mathbf{U \Sigma V}'
\label{eq:SVD}
\end{equation}

$\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}).

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

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}).

\begin{equation}
\icovls(\X,\Y) = Max \left\{ \begin{aligned}
                       \covls(\X,\Y) - \overline{\rcovls(\X,\Y)} &\\
                       0 &
                      \end{aligned}
              \right.
\label{eq:ICovLs}
\end{equation}

\sloppy 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.

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

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

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)$ 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})

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

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% MATERIAL & METHODS
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{methods}
\section{Methods}

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

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.

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

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$.

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



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=20$ rows and respectively $10, 20, 50, 100$ columns. Values of the four matrices are drawn from a normal or an exponential distribution, and $k \in \{10, 100, 1000\}$ 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$.






\subsection{Simulating data for testing sensibility to overfitting}



To test sensibility to overfitting correlations were mesured between two random matrices of same dimensions. Each matrix is $n \times p$ with $n=20$ and $p \in [2,50]$. 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, $100$ simulations were run. Computation of $\irls$ is estimated with $100$ randomizations.







For $p=1$ random vectors with $n \in [3,25]$ are generated. As above data are drawn from $\mathcal{N}(0,1)$ and $k=100$ 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.







\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}



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 \{10,100\}$ and $n \in \{10,25\}$, and for several levels of shared variations ranging between $0.1$ and $1$ by step of $0.1$. For each combination of parameters, $k = 100$ simulations are run, and both $\rls^2$ and $\irls^2$ are estimated using $100$ randomizations.





\subsubsection*{between two vectors}



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 \{10,25\}$, and for several levels of shared variations ranging between $0.1$ and $1$ by step of $0.1$. For each combination of parameters, $k = 100$ simulations are run, and  $R^2$, $R^2_{adj}$ and $\irls^2$ are estimated using $100$ randomizations.





\subsubsection*{partial determination coefficients}

\begin{figure}[!tpb]%figure1



\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}
\includegraphics[width=\maxwidth]{figure/fig_nested_shared_variation-1} 

\end{knitrout}
\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 = 20 \times 200$ are generated according to the schema: $\mathbf{A}$ shares $80\%$ of variation with $\mathbf{B}$, that shares $40\%$ of variation with $\mathbf{C}$, sharing $20\%$ 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 $100$ times, for every simutation $\irls_{partial}^2$ and $\rls_{partial}^2$ are estimated for each pair of matrices.





\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}.

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}).

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

\subsubsection*{Empirical assessment of $\alpha\text{-risk}$ for the $\covls$ test}



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=1000$ pairs of $n \times p$ random matrices with $n=20$ and
$p \in \{10, 20, 50\}$ 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}.





\subsubsection*{Empirical power assessment for the $CovLs$ test}



To evaluate relative power of the three considered tests, pairs of to random matrices were produced for various $p \in \{10, 20, 50, 100\}$, $n \in \{10, 15, 20, 25\}$ and two levels of shared variations $\rpearson^2 \in \{0.05, 0.1\}$. For each combination of parameters, $k = 1000$ simulations are run. Each test are estimated based on $1000$ randomizations for the $CovLs$ test, or permutations for \texttt{protest} and \texttt{procuste.rtest}.






\vspace*{1pt}
\end{methods}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% RESULTS
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Results}

\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}}{
% latex table generated in R 3.5.2 by xtable 1.8-4 package
% Thu Sep 12 07:14:26 2019
\begin{tabular}{rrrrrrr}
  \hline
  & & \multicolumn{2}{c}{normal} & & \multicolumn{2}{c}{exponential}\\ \cline{3-4}   \cline{6-7}p & k &\multicolumn{1}{c}{mean} & \multicolumn{1}{c}{sd} & \multicolumn{1}{c}{ } &\multicolumn{1}{c}{mean} & \multicolumn{1}{c}{sd}\\\hline\multirow{3}{*}{10} & 10 & 0.5746 & $1.3687 \times 10^{-2}$ &   & 0.5705 & $1.1714 \times 10^{-2}$ \\ 
   & 100 & 0.5824 & $3.6425 \times 10^{-3}$ &   & 0.5794 & $3.6452 \times 10^{-3}$ \\ 
   & 1000 & 0.5806 & $1.1564 \times 10^{-3}$ &   & 0.5801 & $1.1515 \times 10^{-3}$ \\ 
  \hline\multirow{3}{*}{20} & 10 & 0.7682 & $4.5568 \times 10^{-3}$ &   & 0.7729 & $7.4071 \times 10^{-3}$ \\ 
   & 100 & 0.7645 & $2.1681 \times 10^{-3}$ &   & 0.7695 & $2.0006 \times 10^{-3}$ \\ 
   & 1000 & 0.7658 & $6.8923 \times 10^{-4}$ &   & 0.7671 & $6.6033 \times 10^{-4}$ \\ 
  \hline\multirow{3}{*}{50} & 10 & 0.9131 & $3.4659 \times 10^{-3}$ &   & 0.9102 & $2.6647 \times 10^{-3}$ \\ 
   & 100 & 0.9088 & $8.9318 \times 10^{-4}$ &   & 0.9086 & $7.7424 \times 10^{-4}$ \\ 
   & 1000 & 0.9086 & $2.8590 \times 10^{-4}$ &   & 0.9091 & $2.8450 \times 10^{-4}$ \\ 
  \hline\multirow{3}{*}{100} & 10 & 0.9557 & $1.2939 \times 10^{-3}$ &   & 0.9532 & $1.7316 \times 10^{-3}$ \\ 
   & 100 & 0.9542 & $4.7043 \times 10^{-4}$ &   & 0.9547 & $4.6869 \times 10^{-4}$ \\ 
   & 1000 & 0.9544 & $1.4547 \times 10^{-4}$ &   & 0.9546 & $1.4249 \times 10^{-4}$ \\ 
   \hline
\end{tabular}

}{\ } % <- we can add a footnote in the last curly braces
\end{table}

\sloppy 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}).

\subsection{Relative sensibility of $IRLs(X,Y)$ to overfitting}

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

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}
\includegraphics[width=\maxwidth]{figure/fig_h0-1} 

\end{knitrout}

B)

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}
\includegraphics[width=\maxwidth]{figure/fig_h0_11-1} 

\end{knitrout}
\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}


$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).

\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
\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}
\includegraphics[width=\maxwidth]{figure/fig__r2-1} 

\end{knitrout}
\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.}
\label{fig:shared_variation}
\end{figure*}

\subsubsection*{between two vectors}

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]
\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}
\includegraphics[width=\maxwidth]{figure/fig__r2_vec-1} 

\end{knitrout}
\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}

\subsubsection*{partial coefficient of determination}
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}$.

\begin{figure}[!tpb]%figure1
\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}
\includegraphics[width=\maxwidth]{figure/fig_nested_shared-1} 

\end{knitrout}
\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}


\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=0.996$ and $R^2=0.996$ respectively for the correlation with \texttt{vegan::\-protest} and \texttt{ade4::\-procuste.rtest} $P_{values}$). The slopes of the corresponding linear models are respectively $0.998$ and $0.999$.

\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}} {
% latex table generated in R 3.5.2 by xtable 1.8-4 package
% Thu Sep 12 07:14:29 2019
\begin{tabular*}{0.98\linewidth}{@{\extracolsep{\fill}}crrr}
  \hline
  & \multicolumn{3}{c}{Cramer-Von Mises p.value} \\
           \cline{2-4}
           p & CovLs test & \texttt{protest} & \texttt{procuste.rtest} \\  \hline
10 & 0.323 & 0.395 & 0.348 \\ 
  20 & 0.861 & 0.769 & 0.706 \\ 
  50 & 0.628 & 0.783 & 0.680 \\ 
   \hline
\end{tabular*}

}{} % <- we can add a footnote in the last curly praces
\end{table}

\subsection{Power of the test based on randomisation}

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.

\begin{table}[!t]
\processtable{Power estimation of the procruste tests for two low level of shared variations $5\%$ and $10\%$.\label{tab:power}} {
% latex table generated in R 3.5.2 by xtable 1.8-4 package
% Thu Sep 12 07:14:29 2019
\begin{tabular}{lcrrrrrrrrr}
  \hline
  & $R^2$ & \multicolumn{4}{c}{5\%} & &\multicolumn{4}{c}{10\%} \\
           \cline{3-6} \cline{8-11}
           & p & 10 & 20 & 50 & 100 & & 10 & 20 & 50 & 100 \\
           \cline{3-11}
           & n & \multicolumn{9}{c}{$power = 1 - \beta\text{-risk}$ } \\ \hline\multirow{4}{*}{Covls.test} & 10 & 0.49 & 0.45 & 0.40 & 0.45 &   & 0.76 & 0.68 & 0.70 & 0.68 \\ 
   & 15 & 0.88 & 0.80 & 0.75 & 0.75 &   & 0.99 & 0.98 & 0.96 & 0.95 \\ 
   & 20 & 0.99 & 0.96 & 0.94 & 0.93 &   & 1.00 & 1.00 & 1.00 & 1.00 \\ 
   & 25 & 1.00 & 1.00 & 0.99 & 0.98 &   & 1.00 & 1.00 & 1.00 & 1.00 \\ 
  \hline\multirow{4}{*}{protest} & 10 & 0.50 & 0.45 & 0.40 & 0.45 &   & 0.77 & 0.70 & 0.70 & 0.68 \\ 
   & 15 & 0.88 & 0.80 & 0.75 & 0.75 &   & 0.99 & 0.98 & 0.96 & 0.95 \\ 
   & 20 & 0.99 & 0.96 & 0.94 & 0.93 &   & 1.00 & 1.00 & 1.00 & 1.00 \\ 
   & 25 & 1.00 & 1.00 & 0.99 & 0.99 &   & 1.00 & 1.00 & 1.00 & 1.00 \\ 
  \hline\multirow{4}{*}{procuste.rtest} & 10 & 0.50 & 0.45 & 0.41 & 0.45 &   & 0.76 & 0.69 & 0.70 & 0.68 \\ 
   & 15 & 0.88 & 0.80 & 0.74 & 0.75 &   & 0.99 & 0.98 & 0.96 & 0.96 \\ 
   & 20 & 0.99 & 0.96 & 0.94 & 0.93 &   & 1.00 & 1.00 & 1.00 & 1.00 \\ 
   & 25 & 1.00 & 1.00 & 0.99 & 0.99 &   & 1.00 & 1.00 & 1.00 & 1.00 \\ 
   \hline
\end{tabular}

}{} % <- we can add a footnote in the last curly praces
\end{table}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DISCUSSION
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Discussion}

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}.

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.

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


\section{Conclusion}

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).

\vspace*{-10pt}


\section*{Acknowledgements}

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}

\section*{Funding}

This work has been supported by the... Text Text  Text Text.
\vspace*{-12pt}

\bibliographystyle{natbib}
%\bibliographystyle{achemnat}
%\bibliographystyle{plainnat}
%\bibliographystyle{abbrv}
%\bibliographystyle{bioinformatics}
%
%\bibliographystyle{plain}
%
\bibliography{../inst/REFERENCES}

\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$. \\
$\trace(\X)$           & The trace of $\X$.
\end{tabular}


\end{document}
