<?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: glm contrast statement with interaction in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/glm-contrast-statement-with-interaction/m-p/47675#M2096</link>
    <description>It is not immediately clear whether you want to have an overall test of any treatment effect within each level of cat or whether you want to test pairwise differences between any two treatments within each level of cat.  My initial assumption when I read your first post was that you wanted to construct an overall test of any treatment effect within each level of cat.&lt;BR /&gt;
&lt;BR /&gt;
Assuming that is the model of interest, then you can use the code:&lt;BR /&gt;
&lt;BR /&gt;
proc glm data=a order=data;&lt;BR /&gt;
 &amp;nbsp; class trt cat;&lt;BR /&gt;
 &amp;nbsp; model param=trt cat trt*cat;&lt;BR /&gt;
 &amp;nbsp; means trt cat trt*cat;&lt;BR /&gt;
 &amp;nbsp; lsmeans trt*cat / slice=cat;&lt;BR /&gt;
run;quit;&lt;BR /&gt;
&lt;BR /&gt;
Now, if you want to test pairwise differences between treatment levels within each level of cat, you have to make some decisions about whether and how you want to adjust for multiple comparisons.  See the documentation of the ADJUST= option of the LSMEANS statement.</description>
    <pubDate>Fri, 10 Dec 2010 00:50:26 GMT</pubDate>
    <dc:creator>Dale</dc:creator>
    <dc:date>2010-12-10T00:50:26Z</dc:date>
    <item>
      <title>glm contrast statement with interaction</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/glm-contrast-statement-with-interaction/m-p/47671#M2092</link>
      <description>Hello,&lt;BR /&gt;
I am running proc glm. I have 2 effects: &lt;BR /&gt;
trt with 3 levels (t1,t2 and t3;1 is the control) and &lt;BR /&gt;
cat with 2 levels (c1, c2).  &lt;BR /&gt;
I am checking whether there is a trt effect and whether there is a cat effect. I am also checking the interaction.&lt;BR /&gt;
To find which trt has an effect I'm using contrast statements. &lt;BR /&gt;
How can I find whether there is a trt effect within one of the cat levels?&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance,&lt;BR /&gt;
natanya</description>
      <pubDate>Thu, 09 Dec 2010 15:00:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/glm-contrast-statement-with-interaction/m-p/47671#M2092</guid>
      <dc:creator>natanya</dc:creator>
      <dc:date>2010-12-09T15:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: glm contrast statement with interaction</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/glm-contrast-statement-with-interaction/m-p/47672#M2093</link>
      <description>This would be easier to respond to if you shared your code.&lt;BR /&gt;
&lt;BR /&gt;
I am concerned that you are missing a fundamental principle of the general linear model.  If there is an interaction, testing of main effects is not warranted, and may be misleading.  ("To find which trt has an effect I'm using contrast statements." ).  You need to test for one variable at specified values of the other.&lt;BR /&gt;
&lt;BR /&gt;
If you have an interaction, the question that you posed is the one that makes sense.  See the documentation for an example&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_glm_sect050.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_glm_sect050.htm&lt;/A&gt;</description>
      <pubDate>Thu, 09 Dec 2010 15:26:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/glm-contrast-statement-with-interaction/m-p/47672#M2093</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2010-12-09T15:26:10Z</dc:date>
    </item>
    <item>
      <title>Re: glm contrast statement with interaction</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/glm-contrast-statement-with-interaction/m-p/47673#M2094</link>
      <description>Thank you for your response.&lt;BR /&gt;
I do not have a significant interaction effect (p=0.08).  I do have a significant trt effect (p=0.02).  I do not have a significant cat effect.  If I want to examine the effect within cat=1 and cat=2 should I just do the glm by cat or is there a way of checking this by using contrasts?&lt;BR /&gt;
The code is strait forward (meanwhile):&lt;BR /&gt;
proc glm data=a order=data;&lt;BR /&gt;
class trt cat;&lt;BR /&gt;
model param=trt cat trt*cat;&lt;BR /&gt;
means trt cat trt*cat;&lt;BR /&gt;
contrast "control vs t2" trt 1 -1 0;&lt;BR /&gt;
contrast "control vs t3" trt 1 0 -1;&lt;BR /&gt;
run;quit;&lt;BR /&gt;
&lt;BR /&gt;
Thanks.</description>
      <pubDate>Thu, 09 Dec 2010 15:51:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/glm-contrast-statement-with-interaction/m-p/47673#M2094</guid>
      <dc:creator>natanya</dc:creator>
      <dc:date>2010-12-09T15:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: glm contrast statement with interaction</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/glm-contrast-statement-with-interaction/m-p/47674#M2095</link>
      <description>Hi Natanya&lt;BR /&gt;
&lt;BR /&gt;
I've had the same problem before, and basically what you have to do is include the interaction in your contrast, and the factor you're comparing i.e. trt.&lt;BR /&gt;
&lt;BR /&gt;
It sounds like you have 3 treatment levels and 2 categories levels is this correct?&lt;BR /&gt;
&lt;BR /&gt;
If it is I would use something like this.&lt;BR /&gt;
&lt;BR /&gt;
proc glm data=a order = data;&lt;BR /&gt;
class cat trt ;&lt;BR /&gt;
model results=trt cat trt*cat;&lt;BR /&gt;
means trt cat trt*cat;&lt;BR /&gt;
estimate "Cat1 - control vs t2" trt 1 -1 0 trt*cat 1 -1 0 0 0 0 / e;&lt;BR /&gt;
estimate "Cat1 - control vs t3" trt 1 0 -1 trt*cat 1 0 -1 0 0 0 / e;&lt;BR /&gt;
estimate "Cat2 - control vs t2" trt 1 -1 0 trt*cat 0 0 0 1 -1 0 / e;&lt;BR /&gt;
estimate "Cat2 - control vs t3" trt 1 0 -1 trt*cat 0 0 0 1 0 -1 / e;&lt;BR /&gt;
run;quit;&lt;BR /&gt;
&lt;BR /&gt;
I have changed the variables in the clas statement to make the contrasts easier to understand, and I have used estimate instead of contrast just because I prefer it. The e option makes you understand if the coefficients you are using are correct.&lt;BR /&gt;
&lt;BR /&gt;
Basically to go through first contrast we are saying that we want to compare treatment 1 against 2, and we are also saying that we want this comparison to be at Category 1. &lt;BR /&gt;
&lt;BR /&gt;
An alternative way to get out the differences quickly and associated p-values is just to use the lsmeans statement Proc Mixed with the diffs option, but the default option does give you every possible interaction comparison.&lt;BR /&gt;
&lt;BR /&gt;
proc mixed data=a order = data;&lt;BR /&gt;
class cat trt ;&lt;BR /&gt;
model results=trt cat trt*cat;&lt;BR /&gt;
lsmeans trt*cat / diffs;&lt;BR /&gt;
run;quit;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
If you have any questions, please ask.&lt;BR /&gt;
&lt;BR /&gt;
Thanks!</description>
      <pubDate>Thu, 09 Dec 2010 17:21:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/glm-contrast-statement-with-interaction/m-p/47674#M2095</guid>
      <dc:creator>Risks</dc:creator>
      <dc:date>2010-12-09T17:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: glm contrast statement with interaction</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/glm-contrast-statement-with-interaction/m-p/47675#M2096</link>
      <description>It is not immediately clear whether you want to have an overall test of any treatment effect within each level of cat or whether you want to test pairwise differences between any two treatments within each level of cat.  My initial assumption when I read your first post was that you wanted to construct an overall test of any treatment effect within each level of cat.&lt;BR /&gt;
&lt;BR /&gt;
Assuming that is the model of interest, then you can use the code:&lt;BR /&gt;
&lt;BR /&gt;
proc glm data=a order=data;&lt;BR /&gt;
 &amp;nbsp; class trt cat;&lt;BR /&gt;
 &amp;nbsp; model param=trt cat trt*cat;&lt;BR /&gt;
 &amp;nbsp; means trt cat trt*cat;&lt;BR /&gt;
 &amp;nbsp; lsmeans trt*cat / slice=cat;&lt;BR /&gt;
run;quit;&lt;BR /&gt;
&lt;BR /&gt;
Now, if you want to test pairwise differences between treatment levels within each level of cat, you have to make some decisions about whether and how you want to adjust for multiple comparisons.  See the documentation of the ADJUST= option of the LSMEANS statement.</description>
      <pubDate>Fri, 10 Dec 2010 00:50:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/glm-contrast-statement-with-interaction/m-p/47675#M2096</guid>
      <dc:creator>Dale</dc:creator>
      <dc:date>2010-12-10T00:50:26Z</dc:date>
    </item>
    <item>
      <title>Re: glm contrast statement with interaction</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/glm-contrast-statement-with-interaction/m-p/47676#M2097</link>
      <description>Hi Risk.&lt;BR /&gt;
I have the sas code below. The &lt;B&gt;goal&lt;/B&gt; is to find those treatment combinations&lt;BR /&gt;
are responsible for the interaction in the data, and write a report that summarizes  all of the information in the data.&lt;BR /&gt;
My attempts;&lt;BR /&gt;
There is interaction between polymers and additives,also days significant.&lt;BR /&gt;
My problem is to find those treatment combinations responsible for interaction.&lt;BR /&gt;
Can I use polynomial contrasts or assume c1 to be the control and use equal spacing to calculate t-statistic and use fisher's or Bon LSD? But the problem is that the additives are on the same level. I looked confused um!&lt;BR /&gt;
&lt;BR /&gt;
    B  	A      DAY 	 TS 	    B	A      DAY 	  TS	  B	A     DAY 	  TS               &lt;BR /&gt;
Mylar	c1	1	  9.2 	Nylon 	c1 	1	  8.2 	Peth 	c1 	1	  9.2&lt;BR /&gt;
Mylar 	c2 	1	  8.7 	Nylon 	c2 	1	  7.7 	Peth 	c2 	1	13.4&lt;BR /&gt;
Mylar 	c3 	1	  9.1 	Nylon 	c3 	1	11.4 	Peth 	c3 	1 	  9.7&lt;BR /&gt;
Mylar 	c4 	1 	12.4 	Nylon 	c4 	1 	  8.1 	Peth 	c4 	1 	  9.1&lt;BR /&gt;
Mylar 	c5 	1 	10.5 	Nylon 	c5 	1 	  9.5 	Peth 	c5 	1 	  8.5&lt;BR /&gt;
Mylar 	c1 	2 	  8.2 	Nylon 	c1 	2 	  7.2 	Peth 	c1 	2 	  8.4&lt;BR /&gt;
Mylar 	c2 	2 	  8.7 	Nylon 	c2 	2 	  7.7 	Peth 	c2 	2 	12.5&lt;BR /&gt;
Mylar 	c3 	2 	  8.8 	Nylon 	c3 	2 	10.5	Peth 	c3 	2 	  9.1&lt;BR /&gt;
Mylar 	c4 	2 	11.5 	Nylon 	c4 	2 	  7.8 	Peth 	c4 	2 	  9.1&lt;BR /&gt;
Mylar 	c5 	2 	10.6 	Nylon 	c5 	2 	  9.6 	Peth 	c5 	2 	  8.9&lt;BR /&gt;
Mylar 	c1 	3 	  8.4 	Nylon 	c1 	3 	  7.4 	Peth 	c1 	3 	  8.2&lt;BR /&gt;
Mylar 	c2 	3 	  8.3 	Nylon 	c2 	3 	  7.8 	Peth 	c2 	3 	  8.5&lt;BR /&gt;
Mylar 	c3 	3 	  8.7	Nylon 	c3 	3 	  7.3 	Peth 	c3 	3 	  8.8&lt;BR /&gt;
Mylar 	c4 	3 	  8.5 	Nylon 	c4 	3 	  7.7 	Peth 	c4 	3 	  8.1&lt;BR /&gt;
Mylar 	c5	3 	  8.8 	Nylon 	c5 	3 	  7.1 	Peth 	c5 	3 	  8.3&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Obtain a complete analysis of the data that includes finding those treatment combinations are responsible for the interaction in the data, and write a report that summarizes what you believe to be all of the information in the data.  &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data ribbon;&lt;BR /&gt;
input days  polymers $ additives $ TS;&lt;BR /&gt;
cards;&lt;BR /&gt;
1 mylar c1 9.2&lt;BR /&gt;
1 mylar c2 8.7&lt;BR /&gt;
1 mylar c3 9.1&lt;BR /&gt;
1 mylar c4 12.4&lt;BR /&gt;
1 mylar c5 10.5&lt;BR /&gt;
1 peth  c1 9.2&lt;BR /&gt;
1 peth  c2 13.4&lt;BR /&gt;
1 peth  c3 9.7&lt;BR /&gt;
1 peth  c4 9.1&lt;BR /&gt;
1 peth  c5 8.5&lt;BR /&gt;
1 nylon c1 8.2&lt;BR /&gt;
1 nylon c2 7.7&lt;BR /&gt;
1 nylon c3 11.4&lt;BR /&gt;
1 nylon c4 8.1&lt;BR /&gt;
1 nylon c5 9.5&lt;BR /&gt;
2 mylar c1 8.2&lt;BR /&gt;
2 mylar c2 8.7&lt;BR /&gt;
2 mylar c3 8.8&lt;BR /&gt;
2 mylar c4 11.5&lt;BR /&gt;
2 mylar c5 10.6&lt;BR /&gt;
2 peth  c1 8.4&lt;BR /&gt;
2 peth  c2 12.5&lt;BR /&gt;
2 peth  c3 9.1&lt;BR /&gt;
2 peth  c4 9.1&lt;BR /&gt;
2 peth  c5 8.9&lt;BR /&gt;
2 nylon c1 7.2&lt;BR /&gt;
2 nylon c2 7.7&lt;BR /&gt;
2 nylon c3 10.5&lt;BR /&gt;
2 nylon c4 7.8&lt;BR /&gt;
2 nylon c5 9.6&lt;BR /&gt;
3 mylar c1 8.4&lt;BR /&gt;
3 mylar c2 8.3&lt;BR /&gt;
3 mylar c3 8.7&lt;BR /&gt;
3 mylar c4 8.5&lt;BR /&gt;
3 mylar c5 8.8&lt;BR /&gt;
3 peth  c1 8.2&lt;BR /&gt;
3 peth  c2 8.5&lt;BR /&gt;
3 peth  c3 8.8&lt;BR /&gt;
3 peth  c4 8.1&lt;BR /&gt;
3 peth  c5 8.3&lt;BR /&gt;
3 nylon c1 7.4&lt;BR /&gt;
3 nylon c2 7.8&lt;BR /&gt;
3 nylon c3 7.3&lt;BR /&gt;
3 nylon c4 7.7&lt;BR /&gt;
3 nylon c5 7.1&lt;BR /&gt;
;&lt;BR /&gt;
&lt;BR /&gt;
proc GLM data =ribbon;&lt;BR /&gt;
Class days polymers additives;&lt;BR /&gt;
model TS= days  polymers| additives;&lt;BR /&gt;
Lsmeans days   polymers | additives/pdiff stderr;&lt;BR /&gt;
run;&lt;BR /&gt;
quit;</description>
      <pubDate>Fri, 10 Dec 2010 01:28:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/glm-contrast-statement-with-interaction/m-p/47676#M2097</guid>
      <dc:creator>Saszealot</dc:creator>
      <dc:date>2010-12-10T01:28:43Z</dc:date>
    </item>
  </channel>
</rss>

