<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/242042</link>
    <title>MATLAB Central Newsreader - Old bug in corrcoef not yet fixed</title>
    <description>Feed for thread: Old bug in corrcoef not yet fixed</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Thu, 08 Jan 2009 01:14:02 -0500</pubDate>
      <title>Old bug in corrcoef not yet fixed</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/242042#620386</link>
      <author>Pasco Alquim</author>
      <description>Help info of corrcoef says that&lt;br&gt;
&lt;br&gt;
% 'alpha' A number between 0 and 1 to specify a confidence&lt;br&gt;
% level of 100*(1-ALPHA)%. Default is 0.05 for 95%&lt;br&gt;
% confidence intervals.&lt;br&gt;
&lt;br&gt;
However, the 'alpha' value is simply ignored (as far back as in R13)&lt;br&gt;
e.g&lt;br&gt;
Sorry for the repetition but I forgot one very important thin in the subject - the BUG word&lt;br&gt;
&lt;br&gt;
xy = rand(10,2);&lt;br&gt;
[r,p]=corrcoef(xy)&lt;br&gt;
&lt;br&gt;
r =&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1.0000 0.3724&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0.3724 1.0000&lt;br&gt;
p =&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1.0000 0.2892&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0.2892 1.0000&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
[r,p]=corrcoef(xy,'alpha',0.5);&lt;br&gt;
r =&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1.0000 0.3724&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0.3724 1.0000&lt;br&gt;
p =&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1.0000 0.2892&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0.2892 1.0000</description>
    </item>
    <item>
      <pubDate>Thu, 08 Jan 2009 02:14:02 -0500</pubDate>
      <title>Re: Old bug in corrcoef not yet fixed</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/242042#620391</link>
      <author>Jiro Doke</author>
      <description>&quot;Pasco Alquim&quot; &amp;lt;pasquimm@yahoo.com&amp;gt; wrote in message &amp;lt;gk3k0q$hko$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Help info of corrcoef says that&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; % 'alpha' A number between 0 and 1 to specify a confidence&lt;br&gt;
&amp;gt; % level of 100*(1-ALPHA)%. Default is 0.05 for 95%&lt;br&gt;
&amp;gt; % confidence intervals.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; However, the 'alpha' value is simply ignored (as far back as in R13)&lt;br&gt;
&amp;gt; e.g&lt;br&gt;
&amp;gt; Sorry for the repetition but I forgot one very important thin in the subject - the BUG word&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; xy = rand(10,2);&lt;br&gt;
&amp;gt; [r,p]=corrcoef(xy)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; r =&lt;br&gt;
&amp;gt;     1.0000 0.3724&lt;br&gt;
&amp;gt;     0.3724 1.0000&lt;br&gt;
&amp;gt; p =&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;     1.0000 0.2892&lt;br&gt;
&amp;gt;     0.2892 1.0000&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; [r,p]=corrcoef(xy,'alpha',0.5);&lt;br&gt;
&amp;gt; r =&lt;br&gt;
&amp;gt;     1.0000 0.3724&lt;br&gt;
&amp;gt;     0.3724 1.0000&lt;br&gt;
&amp;gt; p =&lt;br&gt;
&amp;gt;     1.0000 0.2892&lt;br&gt;
&amp;gt;     0.2892 1.0000&lt;br&gt;
&lt;br&gt;
I believe you need to compare the 3rd and 4th output argument:&lt;br&gt;
&lt;br&gt;
[r,p,rlo,rup]=corrcoef(xy)&lt;br&gt;
&lt;br&gt;
[r,p,rlo,rup]=corrcoef(xy,'alpha',0.5)</description>
    </item>
    <item>
      <pubDate>Thu, 08 Jan 2009 02:35:03 -0500</pubDate>
      <title>Re: Old bug in corrcoef not yet fixed</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/242042#620393</link>
      <author>Roger Stafford</author>
      <description>&quot;Pasco Alquim&quot; &amp;lt;pasquimm@yahoo.com&amp;gt; wrote in message &amp;lt;gk3k0q$hko$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Help info of corrcoef says that&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; % 'alpha' A number between 0 and 1 to specify a confidence&lt;br&gt;
&amp;gt; % level of 100*(1-ALPHA)%. Default is 0.05 for 95%&lt;br&gt;
&amp;gt; % confidence intervals.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; However, the 'alpha' value is simply ignored (as far back as in R13)&lt;br&gt;
&amp;gt; e.g&lt;br&gt;
&amp;gt; Sorry for the repetition but I forgot one very important thin in the subject - the BUG word&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; xy = rand(10,2);&lt;br&gt;
&amp;gt; [r,p]=corrcoef(xy)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; r =&lt;br&gt;
&amp;gt;     1.0000 0.3724&lt;br&gt;
&amp;gt;     0.3724 1.0000&lt;br&gt;
&amp;gt; p =&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;     1.0000 0.2892&lt;br&gt;
&amp;gt;     0.2892 1.0000&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; [r,p]=corrcoef(xy,'alpha',0.5);&lt;br&gt;
&amp;gt; r =&lt;br&gt;
&amp;gt;     1.0000 0.3724&lt;br&gt;
&amp;gt;     0.3724 1.0000&lt;br&gt;
&amp;gt; p =&lt;br&gt;
&amp;gt;     1.0000 0.2892&lt;br&gt;
&amp;gt;     0.2892 1.0000&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;As I understand it, the confidence level set with the 'alpha' parameter is used in computing the confidence interval bounds, 'rlo' and 'rup', returned in the third and fourth output values of 'corrcoef':&lt;br&gt;
&lt;br&gt;
&amp;nbsp;[r,p,rlo,rup] = corrcoef(...)&lt;br&gt;
&lt;br&gt;
It has nothing to do with the 'r' and 'p' values returned.  In particular the 'p' values, which are based on a statistical normality assumption about the data, do not involve a confidence level setting.  To quote Mathworks' documentation, &quot;Each p-value is the probability of getting a correlation as large as the observed value by random chance, when the true correlation is zero.&quot;  You don't need a confidence level to make such a probability assessment, just a reference to an assumed probability distribution.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;To show any differences between the default 'alpha' value .05 and the .5 value you entered, you would have to display these confidence interval bounds.  Do you detect any effect there?&lt;br&gt;
&lt;br&gt;
Roger Stafford</description>
    </item>
    <item>
      <pubDate>Thu, 08 Jan 2009 03:43:02 -0500</pubDate>
      <title>Re: Old bug in corrcoef not yet fixed</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/242042#620404</link>
      <author>Pasco Alquim</author>
      <description>&quot;Roger Stafford&quot; &amp;lt;ellieandrogerxyzzy@mindspring.com.invalid&amp;gt; wrote in message &lt;br&gt;
&amp;gt;   As I understand it, the confidence level set with the 'alpha' parameter is used in computing the confidence interval bounds, 'rlo' and 'rup', returned in the third and fourth output values of 'corrcoef':&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  [r,p,rlo,rup] = corrcoef(...)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; It has nothing to do with the 'r' and 'p' values returned.  In particular the 'p' values, which are based on a statistical normality assumption about the data, do not involve a confidence level setting.  To quote Mathworks' documentation, &quot;Each p-value is the probability of getting a correlation as large as the observed value by random chance, when the true correlation is zero.&quot;  You don't need a confidence level to make such a probability assessment, just a reference to an assumed probability distribution.&lt;br&gt;
&lt;br&gt;
-----------------&lt;br&gt;
Sorry, but what I see in the docs is&lt;br&gt;
&lt;br&gt;
[...]=corrcoef(...,'param1',val1,'param2',val2,...) specifies additional parameters and their values. Valid parameters are the following. &lt;br&gt;
&amp;nbsp;&amp;nbsp;'alpha' A number between 0 and 1 to specify a confidence level of 100*(1 - alpha)%. Default is 0.05 for 95% confidence intervals.&lt;br&gt;
&lt;br&gt;
No mention that, when 'alpha' is provided, one must have 4 argouts&lt;br&gt;
&lt;br&gt;
And why should p be the probability for the 95% confidence only? Which is in fact is what it does.&lt;br&gt;
&lt;br&gt;
We can confirm that by hacking the code and changing the value of variable rv before it calls tpvalue. We can than use the values from the table at &lt;br&gt;
&lt;a href=&quot;http://physics.mercer.edu/Younce/pearson.html&quot;&gt;http://physics.mercer.edu/Younce/pearson.html&lt;/a&gt;&lt;br&gt;
to confirm that what is return is the 95% confidence value.&lt;br&gt;
&lt;br&gt;
Why the preference to 95%?&lt;br&gt;
Why not let the user choose the prefered confodence level, as the documentation suggests?</description>
    </item>
    <item>
      <pubDate>Thu, 08 Jan 2009 07:19:49 -0500</pubDate>
      <title>Re: Old bug in corrcoef not yet fixed</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/242042#620417</link>
      <author>Peter Perkins</author>
      <description>Pasco Alquim wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt; Sorry, but what I see in the docs is&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; [...]=corrcoef(...,'param1',val1,'param2',val2,...) specifies additional parameters and their values. Valid parameters are the following. &lt;br&gt;
&amp;gt;   'alpha' A number between 0 and 1 to specify a confidence level of 100*(1 - alpha)%. Default is 0.05 for 95% confidence intervals.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; No mention that, when 'alpha' is provided, one must have 4 argouts&lt;br&gt;
&lt;br&gt;
What exactly would you expect the confidence level argument to _do_ if you do not compute the confidence bounds?&lt;br&gt;
&lt;br&gt;
&amp;gt; And why should p be the probability for the 95% confidence only? Which is in fact is what it does.&lt;br&gt;
&lt;br&gt;
You seem to have a fundamental misunderstanding of what a p-value is.  Choosing a confidence level _in advance_ for a confidence interval has absolutely nothing to do with a p-value, which is the probability of an observed event given an assumed null model.  At best, you could describe the p-value as the smallest significance level at which the null hypothesis &quot;H0: correlation = 0&quot; would have been accepted.&lt;br&gt;
&lt;br&gt;
The second output argument from corrcoef is exactly what the help describes it to be:&lt;br&gt;
&lt;br&gt;
&quot;Each p-value is the probability of getting a correlation as large as the observed value by random chance, when the true correlation is zero.&quot;</description>
    </item>
    <item>
      <pubDate>Thu, 08 Jan 2009 07:28:06 -0500</pubDate>
      <title>Re: Old bug in corrcoef not yet fixed</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/242042#620420</link>
      <author>Roger Stafford</author>
      <description>&quot;Pasco Alquim&quot; &amp;lt;pasquimm@yahoo.com&amp;gt; wrote in message &amp;lt;gk3so5$h1e$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Sorry, but what I see in the docs is&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; [...]=corrcoef(...,'param1',val1,'param2',val2,...) specifies additional parameters and their values. Valid parameters are the following. &lt;br&gt;
&amp;gt;   'alpha' A number between 0 and 1 to specify a confidence level of 100*(1 - alpha)%. Default is 0.05 for 95% confidence intervals.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; No mention that, when 'alpha' is provided, one must have 4 argouts&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; And why should p be the probability for the 95% confidence only? Which is in fact is what it does.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; We can confirm that by hacking the code and changing the value of variable rv before it calls tpvalue. We can than use the values from the table at &lt;br&gt;
&amp;gt; &lt;a href=&quot;http://physics.mercer.edu/Younce/pearson.html&quot;&gt;http://physics.mercer.edu/Younce/pearson.html&lt;/a&gt;&lt;br&gt;
&amp;gt; to confirm that what is return is the 95% confidence value.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Why the preference to 95%?&lt;br&gt;
&amp;gt; Why not let the user choose the prefered confodence level, as the documentation suggests?&lt;br&gt;
--------------&lt;br&gt;
&amp;nbsp;&amp;nbsp;I strongly disagree with what you are saying about the documentation, Pasco.  Where it describes the 'p' output, there is no mention of any confidence level except the indirect reference, &quot;If P(i,j) is small, say less than 0.05, then the correlation R(i,j) is significant,&quot; and this is simply a conclusion that is left for the user to draw and not a statement that p depends upon a confidence level input.  They state further that &quot;The p-value is computed by transforming the correlation to create a t statistic having n-2 degrees of freedom, where n is the number of rows of X.&quot;  There is nothing in such a computation that involves any notion of a confidence level.  Your statement &quot;why should p be the probability for the 95% confidence only?&quot; is just plain wrong; 'p' has nothing to do with a confidence level, 95% or otherwise.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;It is only when the specific confidence bounds outputs 'rlo' and 'rup' are called for that a confidence level is needed.  If you don't specify 'alpha', they assume it is .05 for 95% confidence as default.  I refer you to a couple of websites below for an explanation of the procedure involved in deducing these confidence bounds from each correlation value and, given the 'alpha' level, the appropriate values for 'rlo' and 'rup'.  This is the only place the 'alpha' quantity input is used.  The 'p' quantities are not affected by its setting.  You can do your own independent calculation using the Fisher transform and its inverse to see if Mathworks does it right.  The web sites are located at:&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://en.wikipedia.org/wiki/Fisher_transformation&quot;&gt;http://en.wikipedia.org/wiki/Fisher_transformation&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://www.stat.psu.edu/online/development/stat505/06_propmean/06_propmean_print.html&quot;&gt;http://www.stat.psu.edu/online/development/stat505/06_propmean/06_propmean_print.html&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
I am sure there are a great many more sites that give a good explanation of this procedure.  Use a Google search for something like &quot;Fisher Transform&quot; and &quot;confidence levels&quot;.&lt;br&gt;
&lt;br&gt;
Roger Stafford</description>
    </item>
    <item>
      <pubDate>Thu, 08 Jan 2009 19:16:03 -0500</pubDate>
      <title>Re: Old bug in corrcoef not yet fixed</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/242042#620539</link>
      <author>Pasco Alquim</author>
      <description>Peter Perkins &amp;lt;Peter.PerkinsRemoveThis@mathworks.com&amp;gt; wrote in message &amp;lt;gk49el$784$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&lt;br&gt;
&amp;gt; You seem to have a fundamental misunderstanding of what a p-value is.  &lt;br&gt;
&lt;br&gt;
Saddly (for me) that was an important part of the problem.&lt;br&gt;
Thanks (not fogetting Roger) for the help.</description>
    </item>
  </channel>
</rss>

