Vectorized function for computing Pearson's correlation coefficient (RHO)
between the respective columns in two equal-sized matrices.
-- Function File: RHO = cor (X, Y)
'RHO = cor (X, Y)' computes Pearson's correlation coefficient (RHO)
between the column vectors X and Y. If X and Y are matrices, then
RHO will be a row vector corresponding to column-wise correlation
coefficients. Hence this function is vectorised for rapid computation
of the correlation coefficient in bootstrap resamples. Note that
unlike the native @corr function, the correlation coefficients
returned here are representative of the finite data sample and are
not unbiased estimates of the population parameter.
cor (X, Y) = ...
mean ( (X - mean (X)) .* (Y - mean (Y)) ) ./ (std (X, 1) .* std (Y, 1))
cor (version 2023.05.02)
Author: Andrew Charles Penn
https://www.researchgate.net/profile/Andrew_Penn/
Copyright 2019 Andrew Charles Penn
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/
Package: statistics-resampling