Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Why p-value is NaN or 0 using corrcoef ?
Date: Mon, 13 Apr 2009 23:01:03 +0000 (UTC)
Organization: The MathWorks Inc
Lines: 49
Message-ID: <gs0g7f$jla$1@fred.mathworks.com>
References: <gs0631$am3$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1239663663 20138 172.30.248.38 (13 Apr 2009 23:01:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 13 Apr 2009 23:01:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1597503
Xref: news.mathworks.com comp.soft-sys.matlab:532477


Also Kuo-Hsien, I'm surprised that corrcoef works with NaNs. If you supply the 'rows','complete' input, corrcoef() only works on rows without NaNs.

a= [1 2 4 NaN 5 6]';
b= [1 2 4 NaN 5 6]';
[R,sig] = corrcoef(a,b,'rows','complete')

R =

     1     1
     1     1


sig =

     1     0
     0     1

Hope that helps,
wayne

"Kuo-Hsien" <mchangks@hotmail.com> wrote in message <gs0631$am3$1@fred.mathworks.com>...
> I play around with [R,sig] = corrcoef(a,b)
> 
> Are there any pros can explain why I got "NaN" and "0" in P-value?
> 
> Thanks,
> Michael
> 
> >> a = [1 2 3 4 5 6]';
> >> b= [3 4 5 6 7 8]';
> >> [R,sig] = corrcoef(a,b)
> R =
>     1.0000
> sig =
>    NaN
> >> a = [1 2 3 4 5 6]';
> >> b= [1 2 3 NaN 5 6]';
> >> [R,sig] = corrcoef(a,b)
> R =
>     1.0000
> sig =
>    NaN
> >> a= [1 2 4 NaN 5 6]';
> >> b= [1 2 4 NaN 5 6]';
> >> [R,sig] = corrcoef(a,b)
> R =
>     1.0000
> sig =
>      0