<?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: Multiple random intercepts for nested data proc glimmix in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Multiple-random-intercepts-for-nested-data-proc-glimmix/m-p/656457#M31470</link>
    <description>&lt;P&gt;&amp;#1;&amp;#1;The first one worked. Thank you!&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jun 2020 15:38:43 GMT</pubDate>
    <dc:creator>Caetreviop543</dc:creator>
    <dc:date>2020-06-10T15:38:43Z</dc:date>
    <item>
      <title>Multiple random intercepts for nested data proc glimmix</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Multiple-random-intercepts-for-nested-data-proc-glimmix/m-p/655645#M31460</link>
      <description>&lt;P&gt;I am trying to run a mixed effect logistic model using proc glimmix with two random intercepts. Some background on the data, doctors &lt;EM&gt;and &lt;/EM&gt;clinics were randomized to receive an intervention, so both doctors, clinics and patients have multiple visits. The goal is to determine whether doctors prescribing decreases over time, rather than patient level effects.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This original model execution by a different analyst in R derived two random intercepts for doctor and clinic, but I can’t find a straightforward way to do this in SAS. I am having trouble distinguishing between ‘random’, ‘repeat’ and ‘subject’ in proc glimmix. I’ve tried a few things, but the only model that worked was:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc glimmix data=mydata method=quad;
class doctor clinic intervention (ref=‘0’) control (ref=‘0’);
model prescription (event =‘1’)=intervention time control intervention*time control*time intervention*control/solution link=logit dist=binary;
random intercept/subject=doctor(clinic) type=un;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This gives me only one intercept for doctor(clinic), whereas the same model in R provides a random intercept for both doctor and clinic. The coefficients are also different. Both model variables have the exact same counts and structure. Below is the code in R:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Model &amp;lt;- glmer(prescription ~ intervention + time + control + intervention:time + control:time + intervention:control + (1|doctor) + (1|provid), data=mydata, family=binomial(link=logit), nAGQ=1, control=glmerControl(calc.derivs=FALSE))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to get the random intercepts for both doctor and clinic in SAS? &lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Is there a reason why the results between SAS and R are inconsistent? I also tried the code below, but received an error that ‘Estimation by quadrature is available only if the data can be processed by subjects’:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc glimmix data=mydata method=quad;
class doctor clinic intervention (ref=‘0’) control (ref=‘0’);
model prescription (event =‘1’)=intervention time control intervention*time control*time intervention*control/solution link=logit dist=binary;
random intercept/subject=doctor type=un;
random intercept/subject=clinic type=un;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Jun 2020 21:37:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Multiple-random-intercepts-for-nested-data-proc-glimmix/m-p/655645#M31460</guid>
      <dc:creator>Caetreviop543</dc:creator>
      <dc:date>2020-06-09T21:37:41Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple random intercepts for nested data proc glimmix</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Multiple-random-intercepts-for-nested-data-proc-glimmix/m-p/656371#M31466</link>
      <description>&lt;P&gt;Try this RANDOM statement (just one statement)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;random intercept doctor/subject=clinic type=un;&lt;/LI-CODE&gt;
&lt;P&gt;The only caveat I have here is that there are going to be a lot of covariance parameters to estimate with type=un.&amp;nbsp; You may have to discard the type= option, and just get the variance components for clinic and clinic*doctor (which is the same as doctor within clinic).&amp;nbsp; This will be the only way to keep method=quad.&amp;nbsp; If you are willing to use pseudo-likelihoods you might consider:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;random doctor clinic/solution:&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;SteveDenham&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 11:58:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Multiple-random-intercepts-for-nested-data-proc-glimmix/m-p/656371#M31466</guid>
      <dc:creator>SteveDenham</dc:creator>
      <dc:date>2020-06-10T11:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple random intercepts for nested data proc glimmix</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Multiple-random-intercepts-for-nested-data-proc-glimmix/m-p/656457#M31470</link>
      <description>&lt;P&gt;&amp;#1;&amp;#1;The first one worked. Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 15:38:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Multiple-random-intercepts-for-nested-data-proc-glimmix/m-p/656457#M31470</guid>
      <dc:creator>Caetreviop543</dc:creator>
      <dc:date>2020-06-10T15:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple random intercepts for nested data proc glimmix</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Multiple-random-intercepts-for-nested-data-proc-glimmix/m-p/662823#M31595</link>
      <description>&lt;P&gt;I post here the same response as to your other posting: we would benefit from knowing more about your study design. Actually, we &lt;EM&gt;need&lt;/EM&gt; to know more about your study design. Channeling Sherlock Holmes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;&lt;EM&gt;“Data!data!data!" he cried impatiently. "I can't make bricks without clay.”&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;&lt;EM&gt;― &lt;SPAN class="authorOrTitle"&gt; Arthur Conan Doyle, &lt;/SPAN&gt; &lt;A class="authorOrTitle" href="https://www.goodreads.com/work/quotes/2763134" target="_blank"&gt;The Adventure of the Copper Beeches&lt;/A&gt; &lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One aspect, in particular: are doctors &lt;EM&gt;nested&lt;/EM&gt; within each clinic (i.e., a given doctor belongs to only one clinic), or are doctors &lt;EM&gt;crossed&lt;/EM&gt; with clinics (i.e., a given doctor practices at multiple clinics)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The R code specifies doctors &lt;EM&gt;crossed&lt;/EM&gt; with clinics and thus produces a variance among doctors and a variance among clinic (i.e., two "random intercepts"). This is fine &lt;EM&gt;IF&lt;/EM&gt; it is consistent with the design--which we do not yet know. You certainly can do the equivalent in SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your SAS code specifies doctors as being nesting within clinics.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Two different design concepts, so two different models, so different results. The actual study design determines the statistical model and that should be our guide.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps move you forward. But I will note that you are in some rather deep waters, beyond what can be adequately addressed in this forum; is there a statistician at your institution that you can consult with? If so, seek their help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2020 06:05:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Multiple-random-intercepts-for-nested-data-proc-glimmix/m-p/662823#M31595</guid>
      <dc:creator>sld</dc:creator>
      <dc:date>2020-06-18T06:05:27Z</dc:date>
    </item>
  </channel>
</rss>

