<?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: Empirical variances in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Empirical-variances/m-p/859921#M339712</link>
    <description>&lt;P&gt;I don't think you need to use PROC GLIMMIX. You can form the variables x1+x2, x1+x3, and x2+x3 by using the DATA step and then generate the covariance matrix for those new variables. You can then read off the variances from the diagonal cells and the covariances from the off-diagonal cells and verify the identities.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since this sounds like a homework assignment, I will only provide a part of the solution. Use the following calls to generate the variance/covariance matrices. Can you use the output to verify the identities?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Have;
set sashelp.iris(where=(Species="Versicolor"));
x1 = PetalLength;
x2 = PetalWidth;
x3 = SepalLength;
run;

proc corr data=Have COV outp=COV;
var x1 x2 x3;
ods select Cov;
run;

data Want;
set Have;
x1x2 = x1 + x2;
x1x3 = x1 + x3;
x2x3 = x2 + x3;
run;

proc corr data=Want COV outp=COVSum;
var x1x2 x1x3 x2x3;
ods select Cov;
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 21 Feb 2023 14:16:09 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2023-02-21T14:16:09Z</dc:date>
    <item>
      <title>Empirical variances</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Empirical-variances/m-p/859661#M339622</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I created 3 variables x1,x2,x3 with variance =9 from a simulate of 1000 copies. Now I want to:&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;Confirm that the empirical variances of (x1+x2) is consistent with&amp;nbsp;Var x1 +x2 =Var (x1) +Var (x2) + 2Cov (x1, x2)&lt;/P&gt;&lt;P&gt;2.&amp;nbsp;Confirm that the empirical covariance of (x1+x2) and (x1 + x3) is consistent with&amp;nbsp;Cov (x1 +x2, x1 +x3 ) = Cov (x1, x1) +Cov (x1, x3) +Cov (x2, x1) +Cov (x2,x3).&lt;/P&gt;&lt;P&gt;It seems I can use&amp;nbsp;PROC GLIMMIX but am not sure how to use the procedure.&lt;/P&gt;&lt;P&gt;How do I achieve this in sas. Thanks&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2023 23:51:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Empirical-variances/m-p/859661#M339622</guid>
      <dc:creator>CathyVI</dc:creator>
      <dc:date>2023-02-19T23:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: Empirical variances</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Empirical-variances/m-p/859690#M339629</link>
      <description>&lt;P&gt;PROC CORR will compute variances and covariances&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc corr data=have cov outp=covariance_matrix;
    var x1 x2 x3;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The output data set contains covariances off the diagonal and variances on the diagonal in the rows where _TYPE_='COV'&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2023 11:48:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Empirical-variances/m-p/859690#M339629</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-02-20T11:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: Empirical variances</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Empirical-variances/m-p/859921#M339712</link>
      <description>&lt;P&gt;I don't think you need to use PROC GLIMMIX. You can form the variables x1+x2, x1+x3, and x2+x3 by using the DATA step and then generate the covariance matrix for those new variables. You can then read off the variances from the diagonal cells and the covariances from the off-diagonal cells and verify the identities.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since this sounds like a homework assignment, I will only provide a part of the solution. Use the following calls to generate the variance/covariance matrices. Can you use the output to verify the identities?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Have;
set sashelp.iris(where=(Species="Versicolor"));
x1 = PetalLength;
x2 = PetalWidth;
x3 = SepalLength;
run;

proc corr data=Have COV outp=COV;
var x1 x2 x3;
ods select Cov;
run;

data Want;
set Have;
x1x2 = x1 + x2;
x1x3 = x1 + x3;
x2x3 = x2 + x3;
run;

proc corr data=Want COV outp=COVSum;
var x1x2 x1x3 x2x3;
ods select Cov;
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Feb 2023 14:16:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Empirical-variances/m-p/859921#M339712</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2023-02-21T14:16:09Z</dc:date>
    </item>
  </channel>
</rss>

