<?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 Re: How to calculate the variance of the weighted sum of &amp;gt;10 components in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-calculate-the-variance-of-the-weighted-sum-of-gt-10/m-p/78511#M36435</link>
    <description>&lt;P&gt;Forgot to provide the covariance matrix for these 5 test cases. Updated xls with both correlation and covariance matrix.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BTW, the correlation and covariance matrix were generated based upon the mean power consumption of each test case over multiple measurements on 20 different devices.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 10 Oct 2018 01:50:45 GMT</pubDate>
    <dc:creator>ILoveJMP</dc:creator>
    <dc:date>2018-10-10T01:50:45Z</dc:date>
    <item>
      <title>How to calculate the variance of the weighted sum of &gt;10 components</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-calculate-the-variance-of-the-weighted-sum-of-gt-10/m-p/78389#M36403</link>
      <description>&lt;P&gt;Perl&amp;nbsp;&lt;A href="https://stats.stackexchange.com/questions/5392/variance-of-two-weighted-random-variables" target="_self"&gt;https://stats.stackexchange.com/questions/5392/variance-of-two-weighted-random-variables&lt;/A&gt;; &lt;SPAN&gt;the variance of A+B is:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 253px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/12732i3FFCB61861305433/image-dimensions/253x123?v=v2" width="253" height="123" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thus, one would imagine that the calculation of the weighted sum of &amp;gt;10 components will be very very complicated. Was wondering whether JMP has an easy way to perform the calculation. Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Oct 2018 20:01:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-calculate-the-variance-of-the-weighted-sum-of-gt-10/m-p/78389#M36403</guid>
      <dc:creator>ILoveJMP</dc:creator>
      <dc:date>2018-10-08T20:01:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the variance of the weighted sum of &gt;10 components</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-calculate-the-variance-of-the-weighted-sum-of-gt-10/m-p/78451#M36414</link>
      <description>&lt;P&gt;The formula quoted in your reference is the one used to estimate the variance of a calculated variable. In the classic Box, Hunter and Hunter text "Statistics for Experimenters"&amp;nbsp; and older texts it was referred to as transmission of errors. Note, for the general case, the weights are not required to sum to 1.&lt;/P&gt;&lt;P&gt;The formula can get long for many variables but it can be simplified using matrix algebra.&lt;/P&gt;&lt;P&gt;If you have actual data, it is easy to calculate in JMP.&amp;nbsp; See the script below.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here(1);

dt = Open("$Sample_Data/Iris.jmp"); //a data file with 4 variables and mixed correlation

x = dt &amp;lt;&amp;lt; get as matrix;

w = [0.2 0.2 0.4 0.2];


cov =  Covariance(x, &amp;lt;&amp;lt;"Pairwise");
wcov = Emult(w`*w, cov); //element wise multiplication

show(cov,wcov,sum(wcov));       /* log: Sum(wcov) = 0.943490362416108;  */

//note the diagonal of wcov will be added once and each off diagonal twice, sum(wcov) will be the weighted variance

//now compute the weighted sum and find its variance, that is the std dev squared

dt &amp;lt;&amp;lt; New Column("WSum", numeric, Continuous, &amp;lt;&amp;lt;set Each Value(0.2 * :Sepal length + 0.2 * :Sepal width + 0.4 * :Petal length + 0.2 * :Petal width ));

show( (Col Std Dev(:WSum))^2 ); /* log: Col Std Dev(:WSum) ^ 2 = 0.943490362416108; */&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Oct 2018 09:30:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-calculate-the-variance-of-the-weighted-sum-of-gt-10/m-p/78451#M36414</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2018-10-09T09:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the variance of the weighted sum of &gt;10 components</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-calculate-the-variance-of-the-weighted-sum-of-gt-10/m-p/78509#M36433</link>
      <description>&lt;P&gt;Thanks much for the reply and solution! Given that the provided example doesn't quite match the situation I am dealing with,&amp;nbsp;I have&amp;nbsp;are two additional questions with simplified data set in the attachment.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As shown by the attached xls, there are 5 different components (test cases) with different weights. Each test case has different number of measurements for its corresponding power consumption (in mA) .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Questions:&lt;/P&gt;&lt;P&gt;1. How would you calculate the power consumption of the weighted sum?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My approach is to use the mean (or median) power consumption of multiple measurements of each test case and then sum them up according to the weights.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. How would you calculate the variance of the weighted sum?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance for your help!!&lt;/P&gt;</description>
      <pubDate>Wed, 10 Oct 2018 00:08:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-calculate-the-variance-of-the-weighted-sum-of-gt-10/m-p/78509#M36433</guid>
      <dc:creator>ILoveJMP</dc:creator>
      <dc:date>2018-10-10T00:08:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the variance of the weighted sum of &gt;10 components</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-calculate-the-variance-of-the-weighted-sum-of-gt-10/m-p/78511#M36435</link>
      <description>&lt;P&gt;Forgot to provide the covariance matrix for these 5 test cases. Updated xls with both correlation and covariance matrix.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BTW, the correlation and covariance matrix were generated based upon the mean power consumption of each test case over multiple measurements on 20 different devices.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Oct 2018 01:50:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-calculate-the-variance-of-the-weighted-sum-of-gt-10/m-p/78511#M36435</guid>
      <dc:creator>ILoveJMP</dc:creator>
      <dc:date>2018-10-10T01:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the variance of the weighted sum of &gt;10 components</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-calculate-the-variance-of-the-weighted-sum-of-gt-10/m-p/78530#M36438</link>
      <description>&lt;P&gt;How was the covariance matrix reported in Excel computed?&amp;nbsp; It should be&amp;nbsp; (X-mu)`*X-mu)/ (n-1).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This covariance in Excel looks strange to me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I still do not understand your data:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The 5 values for CR and BD are identical??&lt;/LI&gt;&lt;LI&gt;What does measurement ID represent? Why do some have 5 and others 23? Does this represent multiple measurements within a component on a single device?&lt;/LI&gt;&lt;LI&gt;Can you provide the 20 x 5 table of your calculated results used to calculate the Covariance matrix?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Note:&amp;nbsp; The 20 device results used to compute the covariance should represent random variation. From past experience, I have seen attempts to use 20 components that represent spatial variation and not representative of the target population of devices. Since this is getting out of the realm of JMP capability, a private message might be more appropriate to continue discussion.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is an example of matrix manipulation to compute pairwise covariance using JMP matrix functions.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here(1);

dt = Open("$Sample_Data/Iris.jmp"); //a data file with 4 variables and mixed correlation

x = dt &amp;lt;&amp;lt; get as matrix;

xb = emult( J(nrow(dt), ncol(x), 1) , V Mean(x) );
xc = x-xb;
cov =  Covariance(x);
show( (xc`*xc)/(nrow(dt)-1) , cov);
/*: Log Output

(xc` * xc) / (N Row(dt) - 1) = 
[	0.685693512304251 -0.0424340044742729 1.27431543624161 0.516270693512304, 
	-0.0424340044742729 0.189979418344519 -0.329656375838926 -0.12163937360179, 
	1.27431543624161 -0.329656375838926 3.11627785234899 1.29560939597315, 
	0.516270693512304 -0.12163937360179 1.29560939597315 0.581006263982103];
cov = 
[	0.685693512304251 -0.0424340044742729 1.27431543624161 0.516270693512304, 
	-0.0424340044742729 0.189979418344519 -0.329656375838926 -0.12163937360179, 
	1.27431543624161 -0.329656375838926 3.11627785234899 1.29560939597315, 
	0.516270693512304 -0.12163937360179 1.29560939597315 0.581006263982103];
*/&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Oct 2018 06:43:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-calculate-the-variance-of-the-weighted-sum-of-gt-10/m-p/78530#M36438</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2018-10-10T06:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the variance of the weighted sum of &gt;10 components</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-calculate-the-variance-of-the-weighted-sum-of-gt-10/m-p/78583#M36473</link>
      <description>&lt;P&gt;Thanks and agreed that&amp;nbsp;&lt;SPAN&gt;a private message might be more appropriate to continue discussion! Will send you a private message shortly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Oct 2018 16:55:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-calculate-the-variance-of-the-weighted-sum-of-gt-10/m-p/78583#M36473</guid>
      <dc:creator>ILoveJMP</dc:creator>
      <dc:date>2018-10-10T16:55:41Z</dc:date>
    </item>
  </channel>
</rss>

