<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Computing Sample Covariance in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Computing-Sample-Covariance/m-p/3815#M3815</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have the following matrix: [35 36 40, 38 37 40, 48 41 42, 50 46 54] for which I am trying to compute the sample covariance.&amp;nbsp; When calculating by hand, the sample covariance matrix should be: [40.6875 23.5 28.0, 23.5 15.5 21.5, 28.0 21.5 34.0] however I am unable to recreate this in JMP.&amp;nbsp; I found an option for calculating covariance, but it does not return the same result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help point me in the right direction?&amp;nbsp; I'm extremely new to this software and never used software as an undergraduate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 01 Oct 2011 14:13:14 GMT</pubDate>
    <dc:creator>kotanna</dc:creator>
    <dc:date>2011-10-01T14:13:14Z</dc:date>
    <item>
      <title>Computing Sample Covariance</title>
      <link>https://community.jmp.com/t5/Discussions/Computing-Sample-Covariance/m-p/3815#M3815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have the following matrix: [35 36 40, 38 37 40, 48 41 42, 50 46 54] for which I am trying to compute the sample covariance.&amp;nbsp; When calculating by hand, the sample covariance matrix should be: [40.6875 23.5 28.0, 23.5 15.5 21.5, 28.0 21.5 34.0] however I am unable to recreate this in JMP.&amp;nbsp; I found an option for calculating covariance, but it does not return the same result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help point me in the right direction?&amp;nbsp; I'm extremely new to this software and never used software as an undergraduate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Oct 2011 14:13:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Computing-Sample-Covariance/m-p/3815#M3815</guid>
      <dc:creator>kotanna</dc:creator>
      <dc:date>2011-10-01T14:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: Computing Sample Covariance</title>
      <link>https://community.jmp.com/t5/Discussions/Computing-Sample-Covariance/m-p/3816#M3816</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try the JSL code below (open a script windom and paste and hit run).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier;"&gt;sample_Q &lt;SPAN style="color: #150097;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #2600eb;"&gt;Covariance&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt; &lt;STRONG&gt;[&lt;/STRONG&gt;&lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;35&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;36&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;40&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #150097;"&gt;,&lt;/SPAN&gt; &lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;38&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;37&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;40&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #150097;"&gt;,&lt;/SPAN&gt; &lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;48&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;41&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;42&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #150097;"&gt;,&lt;/SPAN&gt; &lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;50&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;46&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;54&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;]&lt;/STRONG&gt; &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;SPAN style="color: #150097;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier;"&gt;pop_Q &lt;SPAN style="color: #150097;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #2600eb;"&gt;Covariance&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt; &lt;STRONG&gt;[&lt;/STRONG&gt;&lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;35&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;36&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;40&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #150097;"&gt;,&lt;/SPAN&gt; &lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;38&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;37&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;40&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #150097;"&gt;,&lt;/SPAN&gt; &lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;48&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;41&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;42&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #150097;"&gt;,&lt;/SPAN&gt; &lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;50&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;46&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;54&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;]&lt;/STRONG&gt; &lt;STRONG&gt;)&lt;/STRONG&gt; &lt;SPAN style="color: #150097;"&gt;*&lt;/SPAN&gt; &lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #150097;"&gt;/&lt;/SPAN&gt; &lt;SPAN style="color: #009694;"&gt;&lt;STRONG&gt;4&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #150097;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier;"&gt;&lt;SPAN style="color: #2600eb;"&gt;Show&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt; sample_Q&lt;SPAN style="color: #150097;"&gt;,&lt;/SPAN&gt; pop_Q &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;SPAN style="color: #150097;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier; color: #009694;"&gt;&lt;SPAN style="color: #2600eb;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;You should get the results&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier;"&gt;&lt;STRONG&gt;sample_Q = &lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier;"&gt;&lt;STRONG&gt;[&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;54,25 31,33 37,33, &lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;31,33 20,66 28,66, &lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;37,33 28,66 45,33];&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier;"&gt;&lt;STRONG&gt;pop_Q = &lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier;"&gt;&lt;STRONG&gt;[&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;40,6875 23,5 28, &lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;23,5 15,5 21,5, &lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;28 21,5 34];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The latter equals your calculation. The difference between the two is a factor of 3/4 i.e. (N-1)/1. I think the equation you have used is actually not for the (unbiased) sample covariance but rather the population covariance which would be the right choice if the population mean is known. Try to use N-1 as denominator instead of N and you should end up with the same covariance estimate as JMPs formula.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Oct 2011 21:14:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Computing-Sample-Covariance/m-p/3816#M3816</guid>
      <dc:creator>ms</dc:creator>
      <dc:date>2011-10-01T21:14:18Z</dc:date>
    </item>
  </channel>
</rss>

