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 22:57:01 +0000 (UTC)
Organization: The MathWorks Inc
Lines: 50
Message-ID: <gs0fvt$3u0$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 1239663421 4032 172.30.248.38 (13 Apr 2009 22:57:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 13 Apr 2009 22:57:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1597503
Xref: news.mathworks.com comp.soft-sys.matlab:532476


Hi Kuo, what version of Matlab are you using? I'm using R2009a and I don't get that behavior. For your example:

a = [1 2 3 4 5 6]';
b= [3 4 5 6 7 8]';
[R,sig] = corrcoef(a,b)

R =

     1     1
     1     1


sig =

     1     0
     0     1

which is expected.

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