<?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: Mixed models for nested data in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Mixed-models-for-nested-data/m-p/820219#M40566</link>
    <description>&lt;P&gt;Looks good - you should probably add the SOLUTION option to your RANDOM statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SteveDenham&lt;/P&gt;</description>
    <pubDate>Fri, 24 Jun 2022 11:54:22 GMT</pubDate>
    <dc:creator>SteveDenham</dc:creator>
    <dc:date>2022-06-24T11:54:22Z</dc:date>
    <item>
      <title>Mixed models for nested data</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Mixed-models-for-nested-data/m-p/820178#M40565</link>
      <description>&lt;P&gt;This is a sample dataset: Each patient has multiple glucose levels that are categorized into episodes based on the time that glucose test date. Eg: Patient 2 has 3 glucose readings, the first two (80,85) carried out on the same day - therefore it is one episode. The third reading (160) carried out another day - hence its the second episode.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ID Glucose episode
1    140         1
1    145         2
2    80          1 
2    85          1
2    160         2

&lt;/PRE&gt;
&lt;P&gt;1) I would like to fit a variance component mode to identify variability within &amp;amp; across episodes, and across patients.&amp;nbsp; I have tried the below code, and also using 'subject=episode(ID)' since the episodes are nested within each ID.&amp;nbsp;Could you please explain what would be the best way to fit this model / if this is the right direction?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc mixed data=test;
class ID episode;
model glucose = ;
random int episode/subject=ID;
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Jun 2022 02:11:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Mixed-models-for-nested-data/m-p/820178#M40565</guid>
      <dc:creator>Abishekaa</dc:creator>
      <dc:date>2022-06-24T02:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: Mixed models for nested data</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Mixed-models-for-nested-data/m-p/820219#M40566</link>
      <description>&lt;P&gt;Looks good - you should probably add the SOLUTION option to your RANDOM statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SteveDenham&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 11:54:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Mixed-models-for-nested-data/m-p/820219#M40566</guid>
      <dc:creator>SteveDenham</dc:creator>
      <dc:date>2022-06-24T11:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: Mixed models for nested data</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Mixed-models-for-nested-data/m-p/820224#M40567</link>
      <description>&lt;P&gt;Hi Steve, Thank you! Could you please explain how the above code takes nesting into account? And, how would the model differ from using the below code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc mixed data=test;
class ID episode;
model glucose = ;
random int /subject=episode(ID);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Jun 2022 12:10:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Mixed-models-for-nested-data/m-p/820224#M40567</guid>
      <dc:creator>Abishekaa</dc:creator>
      <dc:date>2022-06-24T12:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: Mixed models for nested data</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Mixed-models-for-nested-data/m-p/820513#M40582</link>
      <description>&lt;P&gt;This code fits two variance components:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;random int  episode/subject=ID&lt;/PRE&gt;
&lt;P&gt;and is equivalent to:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;random ID episode*ID;&lt;/PRE&gt;
&lt;P&gt;While this code fits one variance component&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;random int /subject=episode(ID)&lt;/PRE&gt;
&lt;P&gt;and is equivalent to&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;random episode*ID;&lt;/LI-CODE&gt;
&lt;P&gt;The key here is that the matrix representation of nested effects is identical to the matrix representation of crossed effects (see the documentation of the RANDOM statement).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It comes down to partitioning the variability between ID and episode*ID, with the remainder, if any, in the residual.&amp;nbsp; All of this is going to be very data dependent.&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2022 12:18:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Mixed-models-for-nested-data/m-p/820513#M40582</guid>
      <dc:creator>SteveDenham</dc:creator>
      <dc:date>2022-06-27T12:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: Mixed models for nested data</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Mixed-models-for-nested-data/m-p/821711#M40656</link>
      <description>Thanks so much for the clear explanation, Steve. This is extremely helpful!</description>
      <pubDate>Tue, 05 Jul 2022 20:48:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Mixed-models-for-nested-data/m-p/821711#M40656</guid>
      <dc:creator>Abishekaa</dc:creator>
      <dc:date>2022-07-05T20:48:28Z</dc:date>
    </item>
  </channel>
</rss>

