<?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: Setting up Complicated Contrasts in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Setting-up-Complicated-Contrasts/m-p/431124#M106590</link>
    <description>&lt;P&gt;The model should be&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;model totalfin = season interval(season) climate season*climate previous_para ... ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you can compute lsmeans for season*climate&lt;/P&gt;</description>
    <pubDate>Thu, 25 Jan 2018 23:09:31 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2018-01-25T23:09:31Z</dc:date>
    <item>
      <title>Setting up Complicated Contrasts</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Setting-up-Complicated-Contrasts/m-p/431084#M106582</link>
      <description>&lt;P&gt;I'm running an experiment where I'm interested in climate, time of year, and parasitism levels on population densities of an insect.&lt;/P&gt;
&lt;P&gt;I sample 3 climate types 26 times over the course of a year. Climate A has 5 sites, and Climates B and C each have 2 sites for 9 sites total.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My code looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;glimmix&lt;/STRONG&gt; data=final ;&lt;/P&gt;
&lt;P&gt;class site climate interval;&lt;/P&gt;
&lt;P&gt;model totalfin = interval climate previous_para / dist=poi link=log solution;&lt;/P&gt;
&lt;P&gt;random interval / subject= site(climate) residual;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Model suggests there is a highly significant effects of sample interval, parasitism, but not climate (p=0.11). Looking at the raw data it appears that climate effects exists, but they vary by season and this is washing out the effects. I want to compare climate effects within each season so I assign each interval to a season. I want to use contrasts rather than grouping 26 intervals into 4 groups to maintain my df. I can look at seasonal differences on densities via these contrasts, but I'm having trouble finding a way to code the contrasts so that I can look at site(climate) differences on densities within these seasons.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;contrast "Spring vs. Summer" interval -1 -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; ;&lt;/P&gt;
&lt;P&gt;contrast "Spring vs. Fall" interval&amp;nbsp; 0 &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; ;&lt;/P&gt;
&lt;P&gt;contrast "Spring vs. Winter" interval 0 &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; ;&lt;/P&gt;
&lt;P&gt;contrast "Summer vs. Fall" interval&amp;nbsp; 1 &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; ;&lt;/P&gt;
&lt;P&gt;contrast "Summer vs. Winter" interval 1 &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;contrast "Fall vs. Winter" interval 0 &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; -&lt;STRONG&gt;1&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt; &lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it comes down to it I can just assign each interval to a categorical season, but I would like to avoid this if possible.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2018 20:42:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Setting-up-Complicated-Contrasts/m-p/431084#M106582</guid>
      <dc:creator>Nebulus</dc:creator>
      <dc:date>2018-01-25T20:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: Setting up Complicated Contrasts</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Setting-up-Complicated-Contrasts/m-p/431100#M106583</link>
      <description>&lt;P&gt;You might want to put season into your model, and have interval nested within season.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you can compute&amp;nbsp;least squares means (LSMEANS) for site and season, instead of writing out all possible contrasts of site and season.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2018 21:04:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Setting-up-Complicated-Contrasts/m-p/431100#M106583</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-01-25T21:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: Setting up Complicated Contrasts</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Setting-up-Complicated-Contrasts/m-p/431103#M106584</link>
      <description>&lt;P&gt;Adding: It seems to me that creating contrasts are useful in the case where the coefficients in the contrast are irregular in the sense that you are not just comparing level X to level Y; for example if you want to test if summer is equal to the average of spring and fall, you'd need a contrast for that. If you're just comparing summer to fall, the LSMEANS ought to do that with minimal effort on your part.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2018 21:09:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Setting-up-Complicated-Contrasts/m-p/431103#M106584</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-01-25T21:09:27Z</dc:date>
    </item>
    <item>
      <title>Re: Setting up Complicated Contrasts</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Setting-up-Complicated-Contrasts/m-p/431111#M106585</link>
      <description>&lt;P&gt;I agree with your point about the use of contrasts.&lt;/P&gt;
&lt;P&gt;Regarding including season in the model,I can do that but all it does again is just compare differences in densities between intervals(season). I need to look at the lsmeans of climate within a specific season (e.g. coastal vs. inland within spring, summer, fall and winter).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc glimmix data=final;&lt;/P&gt;
&lt;P&gt;class site climate interval season;&lt;/P&gt;
&lt;P&gt;model totalfin = interval(season) climate&amp;nbsp; previous_para / dist=poi link=log solution;&lt;/P&gt;
&lt;P&gt;random interval(season) / subject= site(climate) residual;&lt;/P&gt;
&lt;P&gt;lsmeans climate / cl pdiff plot=meanplot;&lt;/P&gt;
&lt;P&gt;lsmeans interval(season) / cl pdiff plot=meanplot;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This model doesn't let me do interval(season)*climate in the model statement. I might have to just end up getting rid of interval after all and do lmeans of season*climate&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2018 21:49:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Setting-up-Complicated-Contrasts/m-p/431111#M106585</guid>
      <dc:creator>Nebulus</dc:creator>
      <dc:date>2018-01-25T21:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: Setting up Complicated Contrasts</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Setting-up-Complicated-Contrasts/m-p/431124#M106590</link>
      <description>&lt;P&gt;The model should be&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;model totalfin = season interval(season) climate season*climate previous_para ... ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you can compute lsmeans for season*climate&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2018 23:09:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Setting-up-Complicated-Contrasts/m-p/431124#M106590</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-01-25T23:09:31Z</dc:date>
    </item>
    <item>
      <title>Re: Setting up Complicated Contrasts</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Setting-up-Complicated-Contrasts/m-p/431156#M106596</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 02:43:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Setting-up-Complicated-Contrasts/m-p/431156#M106596</guid>
      <dc:creator>Nebulus</dc:creator>
      <dc:date>2018-01-26T02:43:57Z</dc:date>
    </item>
  </channel>
</rss>

