Code covered by the BSD License  

Highlights from
nancorrcoef

2.5

2.5 | 2 ratings Rate this file 12 Downloads (last 30 days) File Size: 1.9 KB File ID: #735

nancorrcoef

by Denis Gilbert

 

14 Sep 2001 (Updated 14 Sep 2001)

Pearson's correlation for vectors with NaNs

| Watch this File

File Information
Description

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

MATLAB release MATLAB 6.1 (R12.1)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
27 Nov 2002 kuba wlodarczyk  
31 Jan 2012 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)

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
statistics Denis Gilbert 22 Oct 2008 06:37:38
probability Denis Gilbert 22 Oct 2008 06:37:38
nan Denis Gilbert 22 Oct 2008 06:37:38
pearson Denis Gilbert 22 Oct 2008 06:37:38
corrcoef Denis Gilbert 22 Oct 2008 06:37:38
correlation Denis Gilbert 22 Oct 2008 06:37:38
corrcoef Ian Howat 06 Dec 2009 16:41:52
correlation Ian Howat 06 Dec 2009 16:41:56
corrcoef Haim 20 Sep 2010 14:50:39

Contact us at files@mathworks.com