image thumbnail


version 1.0.0 (1.68 KB) by Oleksandr Frei
Calculates Pearson correlation allowing for nan values.


Updated 20 Jun 2019

View License

nancorr(A, B) is equivalent to matlab's corr(A, B, 'Rows', 'pairwise'), except nancorr routine is orders of magnitude faster on large matrices.

nancorr also returns t-statistics:
[coef, t] = nancorr(A, B); zmat = t;

These can be converted to p-values as follows:
[coef, t, n] = NANCORR(A, B);
pval = tcdf(-abs(t), n - 2)

Cite As

Oleksandr Frei (2021). nancorr (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2019a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!