<?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: random statement in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/random-statement/m-p/830599#M41127</link>
    <description>&lt;P&gt;I don't think most people would classify Eye=('Left' 'Right') as a random effect. It seems like a fixed effect because there are only two possibilities and we want to make predictions and comparisons between these levels.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A random effect would be something like a hospital or a doctor. A random effect indicates that there are many possible levels that are not present in the sample. We try to make inferences based on the levels that we have observed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you think that Eye should be a random effect, please describe the experiment that produced the data.&lt;/P&gt;</description>
    <pubDate>Fri, 26 Aug 2022 14:09:28 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2022-08-26T14:09:28Z</dc:date>
    <item>
      <title>random statement</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/random-statement/m-p/830329#M41123</link>
      <description>&lt;P&gt;/*I'm creating this model and I have a question about the random statemnt if I'm comparing left eye to rigt ey is this random statement should be &lt;BR /&gt;good or should I create differnt random statemnt in differnt model to serve that porpuse */&lt;BR /&gt;*ex: random visit/ residual subject=usubjid type=cs;&lt;/P&gt;
&lt;P&gt;proc glimmix data=analysisplots=studentpanel;&lt;BR /&gt;class sex usubjid eye visit ; &lt;BR /&gt;model aval= visit|eye age sex / ddfm=kr s; &lt;BR /&gt;random intercept / subject=usubjid ;&lt;BR /&gt;random eye/ residual subject=usubjid (visit ) type=cs;&lt;BR /&gt;lsmeans eye*visit / alpha=0.05 cl ;&lt;BR /&gt;/*comapre visit to their baseline */ &lt;BR /&gt;LSMeans eye*visit/ slicediff=eye slicedifftype=control( 'Left' 'Baseline') alpha=0.05 cl ;&lt;BR /&gt;/*compare right eye and left eye at diffrent visits */&lt;BR /&gt;LSMeans eye*visit/ slicediff=visit slicedifftype=control( 'Left' 'Baseline') alpha=0.05 cl ;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2022 14:26:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/random-statement/m-p/830329#M41123</guid>
      <dc:creator>mona4u</dc:creator>
      <dc:date>2022-08-25T14:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: random statement</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/random-statement/m-p/830599#M41127</link>
      <description>&lt;P&gt;I don't think most people would classify Eye=('Left' 'Right') as a random effect. It seems like a fixed effect because there are only two possibilities and we want to make predictions and comparisons between these levels.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A random effect would be something like a hospital or a doctor. A random effect indicates that there are many possible levels that are not present in the sample. We try to make inferences based on the levels that we have observed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you think that Eye should be a random effect, please describe the experiment that produced the data.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 14:09:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/random-statement/m-p/830599#M41127</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-08-26T14:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: random statement</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/random-statement/m-p/830621#M41128</link>
      <description>&lt;P&gt;Your RANDOM statements in your GLIMMIX code make your subject variable a random effect. That is probably what you want.&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;is correct - eye would not usually be a random effect since it has 2 levels of interest and you have not taken a random sample of levels of eye. You supposedly have a random sample of subjects, though.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your first RANDOM statement:&lt;/P&gt;
&lt;PRE&gt;random intercept / subject=usubjid;&lt;/PRE&gt;
&lt;P&gt;correlates all the measurements taken from the same level of USUBJID.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The second RANDOM statement might need some tweaking. Are you attempting to further correlate the observations from each eye within a subject over time? If so, try:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;random visit / residual subject=eye(usubjid) type=ar(1);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That RANDOM statement will correlate the observations from the same eye within a subject using an AR(1) structure. You can try TYPE=CS, but you may have trouble fitting that compound symmetry structure on top of the CS structure you have implied with the first RANDOM statement (the default G-side structure gives you a common correlation among the observations from the same subject).&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 15:24:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/random-statement/m-p/830621#M41128</guid>
      <dc:creator>StatsMan</dc:creator>
      <dc:date>2022-08-26T15:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: random statement</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/random-statement/m-p/831929#M41178</link>
      <description>&lt;P&gt;Given all that has been presented by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/92458"&gt;@StatsMan&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;, I believe that you can model Left Eye and Right Eye as repeated measures on the individual. In this case 'eye' is a fixed effect just as 'visit' is, but you have a chance to capture within subject variation for both of these. Here is the code you propose:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc glimmix data=analysis plots=studentpanel;
class sex usubjid eye visit ;
model aval= visit|eye age sex / ddfm=kr s;
random intercept / subject=usubjid ;
random eye/ residual subject=usubjid (visit ) type=cs;
lsmeans eye*visit / alpha=0.05 cl ;
/*comapre visit to their baseline */
LSMeans eye*visit/ slicediff=eye slicedifftype=control( 'Left' 'Baseline') alpha=0.05 cl ;
/*compare right eye and left eye at diffrent visits */
LSMeans eye*visit/ slicediff=visit slicedifftype=control( 'Left' 'Baseline') alpha=0.05 cl ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Adding one more RANDOM residual statement would accomplish what I think you want:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc glimmix data=analysisplots=studentpanel;
class sex usubjid eye visit ;
model aval= visit|eye age sex / ddfm=kr s;
random intercept / subject=usubjid ;
RANDOM VISIT/RESIDUAL SUBJECT=USUBJID TYPE=AR(1);
random eye/ residual subject=usubjid (visit ) type=cs;
lsmeans eye*visit / alpha=0.05 cl ;
/*comapre visit to their baseline */
LSMeans eye*visit/ slicediff=eye slicedifftype=control( 'Left' 'Baseline') alpha=0.05 cl ;
/*compare right eye and left eye at diffrent visits */
LSMeans eye*visit/ slicediff=visit slicedifftype=control( 'Left' 'Baseline') alpha=0.05 cl ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I will say this though. We have had more success treating eye as a fixed effect (as pointed out by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/92458"&gt;@StatsMan&lt;/a&gt;&amp;nbsp;and &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;), which avoids a LOT of failure to converge and G matrix non-positive definite issues. Something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc glimmix data=ansdata_&amp;amp;n.  ;     
            nloptions  maxiter = 5000 ;
            class &amp;amp;grp_no. &amp;amp;time. &amp;amp;animal. eyen;
            model &amp;amp;value. = &amp;amp;grp_no.|&amp;amp;time.|eyen / ddfm=BW;
            random &amp;amp;time. / type = &amp;amp;cov. subject=eyen(&amp;amp;animal.);
            %if "&amp;amp;cov." = "SP(POW)(T)" %then %do;
                random intercept / subject=eyen(&amp;amp;animal.);
            %end;   &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that the macro variable &amp;amp;grp_no. may include sex as in your code, but that there is an opportunity to include interactions that may not be apparent in your model.&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;</description>
      <pubDate>Tue, 06 Sep 2022 13:15:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/random-statement/m-p/831929#M41178</guid>
      <dc:creator>SteveDenham</dc:creator>
      <dc:date>2022-09-06T13:15:34Z</dc:date>
    </item>
    <item>
      <title>Re: random statement</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/random-statement/m-p/832103#M41193</link>
      <description>Kudos! &lt;BR /&gt;Thumbs Up!</description>
      <pubDate>Wed, 07 Sep 2022 12:20:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/random-statement/m-p/832103#M41193</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-09-07T12:20:18Z</dc:date>
    </item>
  </channel>
</rss>

