<?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: test multiple effects in proc glm in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/test-multiple-effects-in-proc-glm/m-p/255857#M13501</link>
    <description>It is unfortunate that proc glm cannot solve this problem. Appreciate your effort of making use of likelihood ratio to approximate the F test. However, I think the most simplest way to solve this is to create dummy variables and use proc reg and mtest statement to conduct the F test.</description>
    <pubDate>Thu, 10 Mar 2016 17:14:02 GMT</pubDate>
    <dc:creator>ltwedgar</dc:creator>
    <dc:date>2016-03-10T17:14:02Z</dc:date>
    <item>
      <title>test multiple effects in proc glm</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/test-multiple-effects-in-proc-glm/m-p/254431#M13426</link>
      <description>&lt;P&gt;In the case for 2-way manova, how can I test whether the two groups are significant or not?&lt;/P&gt;&lt;P&gt;i.e. I want to to something like this,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc glm data=t;&lt;/P&gt;&lt;P&gt;class gp1 gp2;&lt;/P&gt;&lt;P&gt;model y1 y2 y3 = gp1 gp2;&lt;/P&gt;&lt;P&gt;manova h=gp1 gp2;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It happens that SAS will give me two seperate tests, one for testing whether gp1 is significant, the other for testing whether gp2 is significant. But I want to test whether gp1 and gp2 are both significant (i.e. Ho(model 0): y1 y2 y3= , H1(model 1): y1 y2 y3= &amp;nbsp;&lt;SPAN&gt;gp1 gp2).&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2016 10:31:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/test-multiple-effects-in-proc-glm/m-p/254431#M13426</guid>
      <dc:creator>ltwedgar</dc:creator>
      <dc:date>2016-03-04T10:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: test multiple effects in proc glm</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/test-multiple-effects-in-proc-glm/m-p/254474#M13428</link>
      <description>&lt;P&gt;I agree that this test doesn't is not calculated by PROC GLM.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my approach. Since the maksimum of the log-likelihood is just -n*log(determinant(E))/2+constant, where E is the error-matrix, it is just to let proc glm output the error matrix into a dataset. Do this for both model, and then calculate the likelihood ratio value manually.&amp;nbsp;The pvalue is calculated by&amp;nbsp;using that the 2 x difference in&amp;nbsp;log-likelihood&amp;nbsp;is chi-square distributed. I think there is a slightly better approach where it is used that &amp;nbsp;some transformation of the ratio is exact F-distributed, but I cant find this in my notes from univerversity.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here is an example. It is&amp;nbsp;neccessary to take determinant, so I therefor use the matrix-package here (&lt;A href="https://communities.sas.com/t5/SASware-Ballot-Ideas/Matrix-operations-inside-a-datastep/idi-p/219976" target="_blank"&gt;Matrix-Package&lt;/A&gt;). Alternatively it can be done with&amp;nbsp;PROC&amp;nbsp;IML.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of some reason this site will not show my code correct, so I therefore also attach it in a separate file&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data simulation;
  do gp1=1 to 4;
  do gp2=1 to 4;
  do i=1 to 5;
   y1=rannor(-1);
   y2=rannor(-1);
   y3=rannor(-1);
   output;
   end;
  end;
  end;
run;

ods output errorsscp=sscp0;
proc glm data=simulation;
class gp1 gp2;
model y1 y2 y3 = gp1 gp2;
manova h=gp1 gp2/printe ;
run;
quit;

ods output errorsscp=sscp1;
proc glm data=simulation;
model y1 y2 y3 = ;
manova /printe;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _NULL_;&lt;BR /&gt;&amp;nbsp; array sigma0{3,3}&amp;nbsp;_temporary_ ;&lt;BR /&gt;&amp;nbsp; array sigma1{3,3}&amp;nbsp;_temporary ;&lt;BR /&gt;&amp;nbsp; dsid0= open('sscp0');&lt;BR /&gt;&amp;nbsp; dsid1= open('sscp1');&lt;BR /&gt;&amp;nbsp; do i=1 to 3;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rc= fetchobs(dsid0,i);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rc= fetchobs(dsid1,i);&lt;BR /&gt;&amp;nbsp;do j=1 to 3;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; sigma0[i,j]=getvarn(dsid0,2+j);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; sigma1[i,j]=getvarn(dsid1,2+j);&lt;BR /&gt;&amp;nbsp;end;&lt;BR /&gt;&amp;nbsp; end;&lt;BR /&gt;&amp;nbsp; call show(sigma0);&lt;BR /&gt;&amp;nbsp; put;&lt;BR /&gt;&amp;nbsp; call show(sigma1);&lt;BR /&gt;&amp;nbsp; d0=determinant(sigma1);&lt;BR /&gt;&amp;nbsp; d1=determinant(sigma0);&lt;BR /&gt;&amp;nbsp; likelihoodratio=80*(log(d0)-log(d1));/*n=80 in this example*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp; put d0= d1= likelihoodratio=;&lt;BR /&gt;&amp;nbsp; pvalue=sdf('chisquare',likelihoodratio,3*(&amp;nbsp; ((4-1)+(4-1)+1)-1));/*third argument is the difference in parameters*/;&lt;BR /&gt;&amp;nbsp; put pvalue= pvalue6.4;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2016 15:40:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/test-multiple-effects-in-proc-glm/m-p/254474#M13428</guid>
      <dc:creator>JacobSimonsen</dc:creator>
      <dc:date>2016-03-04T15:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: test multiple effects in proc glm</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/test-multiple-effects-in-proc-glm/m-p/255857#M13501</link>
      <description>It is unfortunate that proc glm cannot solve this problem. Appreciate your effort of making use of likelihood ratio to approximate the F test. However, I think the most simplest way to solve this is to create dummy variables and use proc reg and mtest statement to conduct the F test.</description>
      <pubDate>Thu, 10 Mar 2016 17:14:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/test-multiple-effects-in-proc-glm/m-p/255857#M13501</guid>
      <dc:creator>ltwedgar</dc:creator>
      <dc:date>2016-03-10T17:14:02Z</dc:date>
    </item>
  </channel>
</rss>

