File Exchange

image thumbnail

nancorrcoef

version 1.0.0.0 (1.9 KB) by Denis Gilbert
Pearson's correlation for vectors with NaNs

2 Downloads

Updated 14 Sep 2001

View License

Computes Pearson's product moment correlation for input vectors that contain NaN values.

Cite As

Denis Gilbert (2020). nancorrcoef (https://www.mathworks.com/matlabcentral/fileexchange/735-nancorrcoef), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (3)

Why restrict 20% limit haha~ but also thanks~

Pete

Unfortunately this script appears to be largely redundant given the built-in functionality of corrcoef.m. For example, I believe the following are equivalent:
nancorrcoef(A,B)
corrcoef(A,B,'rows','complete')

Moreover, unlike corrcoef this script only works with 2 variables - a serious limitation. Thus, though nicely written, there appears little reason to use this script. That said, it does have one unique feature in that it provides built-in checks/info on the proportion of NaN data. This is a nice idea, and perhaps the script could be re-written as a wrapper to corrcoef whilst retaining this convenient functionality.

Pros:
- Clearly written and well-documented
- Provides convenient checks on the proportion of NaN data

Cons:
- Only works with 2 variables
- Is largely redundant (can be done directly with corrcoef.m)

kuba wlodarczyk

MATLAB Release Compatibility
Created with R12.1
Compatible with any release
Platform Compatibility
Windows macOS Linux