<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/253599</link>
    <title>MATLAB Central Newsreader - calculate P value from r</title>
    <description>Feed for thread: calculate P value from r</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>Sat, 13 Jun 2009 04:30:18 -0400</pubDate>
      <title>calculate P value from r</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/253599#656958</link>
      <author>Diego Lass</author>
      <description>Hi &lt;br&gt;
I want to calculate P value from r without using function [r, P]=corrcoef() (because computation complexity issues):&lt;br&gt;
&lt;br&gt;
for example:&lt;br&gt;
v1 = [1 2 3 4];&lt;br&gt;
v2 = [3 4 5 6];&lt;br&gt;
&lt;br&gt;
r = v1 * ( v2' ) / sqrt( ( v1 * v1'  ) * ( v2 * v2' ) ); &lt;br&gt;
&lt;br&gt;
now I want to get P from this r, how can I do it? &lt;br&gt;
&lt;br&gt;
diego </description>
    </item>
    <item>
      <pubDate>Tue, 16 Jun 2009 15:11:54 -0400</pubDate>
      <title>Re: calculate P value from r</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/253599#657792</link>
      <author>Tom Lane</author>
      <description>&amp;gt; I want to calculate P value from r without using function [r, &lt;br&gt;
&amp;gt; P]=corrcoef() (because computation complexity issues):&lt;br&gt;
...&lt;br&gt;
&amp;gt; r = v1 * ( v2' ) / sqrt( ( v1 * v1'  ) * ( v2 * v2' ) );&lt;br&gt;
&lt;br&gt;
Diego, your formula is for a correlation coefficient not corrected for the &lt;br&gt;
mean of each sample (assuming each mean is known to be zero). That's not the &lt;br&gt;
usual thing done in statistics, but perhaps it is appropriate for your case.&lt;br&gt;
&lt;br&gt;
Even if you don't want to use corrcoef, you may want to look inside that &lt;br&gt;
file. There's code to transform the correlation to a t statistic, and &lt;br&gt;
there's code to compute the p-value for that statistic. You'll want to use &lt;br&gt;
N-1 rather than N-2 as your degrees of freedom value if you don't correct &lt;br&gt;
for the mean. Alternatively, if the sample size is large, you could just use &lt;br&gt;
a normal approximation to the p-value, in place of one based on Student's t &lt;br&gt;
distribution.&lt;br&gt;
&lt;br&gt;
Check out a book on regression analysis for more details.&lt;br&gt;
&lt;br&gt;
-- Tom </description>
    </item>
  </channel>
</rss>

