<?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: The difference between nested and repeated measurement in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/The-difference-between-nested-and-repeated-measurement/m-p/514159#M26251</link>
    <description>&lt;P&gt;Thanks a lot! Your solution is so helpful! Sorry for the late reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wenru&lt;/P&gt;</description>
    <pubDate>Sat, 17 Nov 2018 22:02:57 GMT</pubDate>
    <dc:creator>ZHWR7125</dc:creator>
    <dc:date>2018-11-17T22:02:57Z</dc:date>
    <item>
      <title>The difference between nested and repeated measurement</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/The-difference-between-nested-and-repeated-measurement/m-p/510043#M26144</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have some questions about the difference between repeated measurements and nested models. For repeated measurements, we have different times nested within one id. For usual examples of nested models, we have different subjects nested within one school or states. So do they have any&amp;nbsp;difference?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, if the id is nested within the city, and the city is nested within states. I wrote down the following codes. Are they equivalent? (It seems that they are not equivalent because SAS just stopped because of too many iterations for the first one) I don’t know why they are different.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;mixed&lt;/STRONG&gt; data=hello1217;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;SPAN&gt;class unitid control State city;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; model rate=control/solution;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; random unitid(city) city(state) State;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;mixed&lt;/STRONG&gt; data=hello1217;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class unitid control State city;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; model rate=control/solution;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; random unitid(city) city /subject=state;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, if we have repeated measurements in time, for the following code, are they equivalent?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;mixed&lt;/STRONG&gt; data=test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class time;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; model y=x/solution;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; random time /subject=id;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;mixed&lt;/STRONG&gt; data=test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class time;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; model y=x/solution;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; random time(id) id;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wenru&lt;/P&gt;</description>
      <pubDate>Fri, 02 Nov 2018 19:58:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/The-difference-between-nested-and-repeated-measurement/m-p/510043#M26144</guid>
      <dc:creator>ZHWR7125</dc:creator>
      <dc:date>2018-11-02T19:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: The difference between nested and repeated measurement</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/The-difference-between-nested-and-repeated-measurement/m-p/510903#M26160</link>
      <description>&lt;P&gt;If your observations are measured at the &lt;EM&gt;unitid&lt;/EM&gt; level, then your first model&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc mixed data=hello1217;
      class unitid control State city;
      model rate=control/solution;
      random unitid(city) city(state) State;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;probably fails to run because it is over-specified. Try&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;PRE&gt;&lt;CODE class=" language-sas"&gt;proc mixed data=hello1217;
      class unitid control State city;
      model rate=control/solution;
      random city(state) State;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which leaves &lt;EM&gt;unitid(city)&lt;/EM&gt; to be residual.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your second model&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;      random unitid(city) city /subject=state;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is equivalent to&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;random state*city unitid(city);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To mimic the first model, use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  random intercept city / subject=state;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In your third model, replace&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;      random time /subject=id;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;with&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;      repeated time / subject=id;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I recommend reading&amp;nbsp;&lt;A href="https://www.ncbi.nlm.nih.gov/pubmed/10861779" target="_self"&gt;Modelling covariance structure in the analysis of repeated measures data&lt;/A&gt;&amp;nbsp;and&amp;nbsp;&lt;A href="https://www.sas.com/store/books/categories/usage-and-reference/sas-for-mixed-models-second-edition/prodBK_59882_en.html" target="_self"&gt;SAS® for Mixed Models, Second Edition&lt;/A&gt;&amp;nbsp;for the details you need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&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>Tue, 06 Nov 2018 21:11:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/The-difference-between-nested-and-repeated-measurement/m-p/510903#M26160</guid>
      <dc:creator>sld</dc:creator>
      <dc:date>2018-11-06T21:11:17Z</dc:date>
    </item>
    <item>
      <title>Re: The difference between nested and repeated measurement</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/The-difference-between-nested-and-repeated-measurement/m-p/511219#M26167</link>
      <description>&lt;P&gt;Hi, thank you so much for your reply! I am still confused and would you please&amp;nbsp;help me with the questions below?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. For the first model, you said that it is&amp;nbsp;&lt;SPAN&gt;over-specified. How can we know if the model is overspecified by random terms? (I have around 8000 observations in this dataset, one observation per unitid)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2. For the second model, you said that&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;random unitid(city) city /subject=state;&amp;nbsp;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;is equivalent to&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;random state*city unitid(city);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I think that the city is nested within state, so why can we add an interaction term between them?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;To mimic the first one, you said that&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;random intercept city / subject=state;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is intercept equivalent to unitid? Why don't we let it be nested within the city? Subject= State means that they are nested with in state, right?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you very much for your generous&amp;nbsp;help!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Wenru&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2018 22:36:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/The-difference-between-nested-and-repeated-measurement/m-p/511219#M26167</guid>
      <dc:creator>ZHWR7125</dc:creator>
      <dc:date>2018-11-07T22:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: The difference between nested and repeated measurement</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/The-difference-between-nested-and-repeated-measurement/m-p/511242#M26170</link>
      <description>&lt;P&gt;1. A full understanding of the design structure is your guide. Generally, you do not include a specification for the residual variance in MIXED, because MIXED expects to set residual variance to be equal to&amp;nbsp;some variance source that is "left over". If there is nothing left over, then various problems arise. In your study, the variance among unitid nested within city nested within state is the residual variance and should not be included in a RANDOM statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. In SAS syntax,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;random state&lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt;city unitid&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;city&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;is, in most cases, equivalent to&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;random city(state) unitid&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;city&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3.&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;random intercept city &lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt; subject&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;state&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;is equivalent to&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;random state state*city&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which is equivalent to&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;random state city(state)&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Nov 2018 00:32:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/The-difference-between-nested-and-repeated-measurement/m-p/511242#M26170</guid>
      <dc:creator>sld</dc:creator>
      <dc:date>2018-11-08T00:32:00Z</dc:date>
    </item>
    <item>
      <title>Re: The difference between nested and repeated measurement</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/The-difference-between-nested-and-repeated-measurement/m-p/514159#M26251</link>
      <description>&lt;P&gt;Thanks a lot! Your solution is so helpful! Sorry for the late reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wenru&lt;/P&gt;</description>
      <pubDate>Sat, 17 Nov 2018 22:02:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/The-difference-between-nested-and-repeated-measurement/m-p/514159#M26251</guid>
      <dc:creator>ZHWR7125</dc:creator>
      <dc:date>2018-11-17T22:02:57Z</dc:date>
    </item>
  </channel>
</rss>

