<?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: nested repeated measures in proc mixed in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/nested-repeated-measures-in-proc-mixed/m-p/916256#M45455</link>
    <description>&lt;P&gt;Calling&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15363"&gt;@SteveDenham&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13758"&gt;@lvm&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13633"&gt;@StatDave&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Feb 2024 05:08:55 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2024-02-15T05:08:55Z</dc:date>
    <item>
      <title>nested repeated measures in proc mixed</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/nested-repeated-measures-in-proc-mixed/m-p/916214#M45454</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to run a repeated measures analysis in proc mixed and am not sure how to handle a repeated aspect of the experiment that generated this data. The experiment investigated the effects of weather on rodent foraging in foraging patches (the response is the amount of grain left after a night a foraging). We measured this in 12 different sites for 19 different sessions. Within each session, we measured grain for 3 nights.&amp;nbsp; Here is an example of the data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;site&amp;nbsp; &amp;nbsp;session&amp;nbsp; &amp;nbsp;night&amp;nbsp; &amp;nbsp;grain_left&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1.66&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1.50&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1.57&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1.52&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1.48&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1.41&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1.10&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.98&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.83&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.66&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.59&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.55&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;I expect the results for each site to be closely correlated for the 3 nights within each session but also expect some (lesser) correlation from session to session.&lt;/P&gt;&lt;P&gt;I have found examples of how to handle data with nesting (e.g., providers nested in hospitals) but I have not seen examples of how to handle nesting of time within time (nesting night within session).&amp;nbsp; Based on what I have read, I think this may be an appropriate way to code this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc mixed data=grain_left method=REML;&lt;BR /&gt;class site night session;&lt;BR /&gt;model grain_left = weather_variables /solution residual ddfm=satterthwaite;&lt;BR /&gt;repeated night(session) /subject=site type=ar(1);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code runs, but I am not certain this is the best way to code this.&amp;nbsp; Could anyone share any thoughts on whether this is appropriate, and if not, a better way to handle this?&amp;nbsp; Or recommend resources that discuss this kind of experimental design?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks very much!&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2024 22:01:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/nested-repeated-measures-in-proc-mixed/m-p/916214#M45454</guid>
      <dc:creator>gmorris</dc:creator>
      <dc:date>2024-02-14T22:01:36Z</dc:date>
    </item>
    <item>
      <title>Re: nested repeated measures in proc mixed</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/nested-repeated-measures-in-proc-mixed/m-p/916256#M45455</link>
      <description>&lt;P&gt;Calling&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15363"&gt;@SteveDenham&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13758"&gt;@lvm&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13633"&gt;@StatDave&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2024 05:08:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/nested-repeated-measures-in-proc-mixed/m-p/916256#M45455</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-02-15T05:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: nested repeated measures in proc mixed</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/nested-repeated-measures-in-proc-mixed/m-p/916356#M45456</link>
      <description>&lt;P&gt;Look at the documentation for the REPEATED statement in PROC MIXED. You should see that there are 3 types of Kronecker product covariance structures to handle doubly repeated measures. In this case, I would suggest type=UN@CS or perhaps &lt;A href="mailto:UN@AR(1)" target="_blank"&gt;UN@AR(1)&lt;/A&gt;. I would align "session" with the unstructured part and "night" with the autoregressive part, as in:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc mixed data=grain_left method=REML;
class site night session;
model grain_left = weather_variables night session /solution residual ddfm=satterthwaite;
repeated session night /subject=site type=un@ar(1) r;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This adds night and session as fixed effects, such that the error structure refers to the residuals from the MODEL statement. Behavior of the algorithm with Kronecker types can be spotty, but so long as you have enough data, it should give what you are looking for. It worked on the example data once I removed weather_variables from the MODEL statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SteveDenham&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2024 19:53:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/nested-repeated-measures-in-proc-mixed/m-p/916356#M45456</guid>
      <dc:creator>SteveDenham</dc:creator>
      <dc:date>2024-02-15T19:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: nested repeated measures in proc mixed</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/nested-repeated-measures-in-proc-mixed/m-p/916587#M45467</link>
      <description>&lt;P&gt;Thank you very much!&amp;nbsp; I had tried something similar before but ran into problems - possibly because I had not included session and night as fixed effects. So far this is working with the full dataset.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2024 21:52:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/nested-repeated-measures-in-proc-mixed/m-p/916587#M45467</guid>
      <dc:creator>gmorris</dc:creator>
      <dc:date>2024-02-16T21:52:04Z</dc:date>
    </item>
  </channel>
</rss>

