<?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: PROC MIXED for ANCOVA: Comparing Slopes for Each Group in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-MIXED-for-ANCOVA-Comparing-Slopes-for-Each-Group/m-p/953128#M47695</link>
    <description>&lt;P&gt;On your ESTIMATE statements, I assume you wish to find marginal values over Type, Treatment and the Type by Treatment interaction, as there are no terms included in the statement for those factors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you considered using LSMESTIMATE statements, with the AT= option for various interesting values for the covariate?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SteveDenham&lt;/P&gt;</description>
    <pubDate>Tue, 10 Dec 2024 18:31:23 GMT</pubDate>
    <dc:creator>SteveDenham</dc:creator>
    <dc:date>2024-12-10T18:31:23Z</dc:date>
    <item>
      <title>PROC MIXED for ANCOVA: Comparing Slopes for Each Group</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-MIXED-for-ANCOVA-Comparing-Slopes-for-Each-Group/m-p/951886#M47621</link>
      <description>&lt;P&gt;Hi, I'm very new to SAS, and I'm trying to get a means separation test done for the slopes of an ANCOVA, but I'm unclear how to do so.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample data is attached as a csv.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My data has the following variables: Height_cm (Continuous quantitative), Diff (Continuous quantitative) Type (a factor variable with 6 levels), Treatment (a factor variable with 2 levels), State (a random effect), blockid (blocking factor), groupid (blocking factor nested in blockid).&lt;/P&gt;&lt;P&gt;For my ANCOVA, I am running a regression of&amp;nbsp; Diff = a + b(Height_cm)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code for extracting estimates at a value of 25 currently looks like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc mixed empirical data=sampledata;
    class Type Treatment blockid groupid State;
    model Diff = Height_cm|Type|Treatment / solution;
    random State blockid groupid(blockid) / subject = groupid;
    lsmeans Type*Treatment / at Height_cm = 25 adjust=tukey;
    store BlockAnalysis / label='PLM: Getting Started';
run;
ods trace on;
proc plm restore=blockanalysis;
   lsmeans Type*Treatment / at Height_cm = 25 adjust=tukey lines;
   ods output LSMLines=LSMLines;
run;
ods trace off&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Ideally I would like code that produces the same tukey lines output, but in comparison of regression slopes for each grouping of Type*Treatment&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For those familiar with R, this would replicate the use of lmer, emmeans, and cld commands&lt;/P&gt;&lt;P&gt;model = lmer(Diff ~ Height_cm * Type * Treatment + (1|State) + (1|blockid) +(1|blockid:groupid), data = sampledata)&lt;BR /&gt;marginal = emtrends(model,pairwise ~ Type * Treatment, var = "Height_cm")&lt;BR /&gt;CLD = cld(marginal, alpha = 0.05, Letters = letters, adjust = "tukey")&lt;BR /&gt;CLD&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2024 02:39:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-MIXED-for-ANCOVA-Comparing-Slopes-for-Each-Group/m-p/951886#M47621</guid>
      <dc:creator>jolich1</dc:creator>
      <dc:date>2024-11-26T02:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: PROC MIXED for ANCOVA: Comparing Slopes for Each Group</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-MIXED-for-ANCOVA-Comparing-Slopes-for-Each-Group/m-p/951891#M47623</link>
      <description>&lt;P&gt;Your MODEL statement did not looks like you are fitting a ANCOVA model.&lt;/P&gt;
&lt;P&gt;And your RANDOM statement is messy and unreadable.Should like:&lt;/P&gt;
&lt;PRE&gt;random int State blockid/ subject = groupid;
&lt;/PRE&gt;
&lt;P&gt;And check this to compare the slope between groups:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/kb/38/384.html" target="_blank"&gt;https://support.sas.com/kb/38/384.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/kb/24/177.html" target="_blank"&gt;https://support.sas.com/kb/24/177.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/kb/70/756.html" target="_blank"&gt;https://support.sas.com/kb/70/756.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1732601731544.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/102517i735242F8623A93E5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1732601731544.png" alt="Ksharp_0-1732601731544.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2024 06:16:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-MIXED-for-ANCOVA-Comparing-Slopes-for-Each-Group/m-p/951891#M47623</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-11-26T06:16:27Z</dc:date>
    </item>
    <item>
      <title>Re: PROC MIXED for ANCOVA: Comparing Slopes for Each Group</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-MIXED-for-ANCOVA-Comparing-Slopes-for-Each-Group/m-p/952133#M47642</link>
      <description>&lt;P&gt;Huge thanks to Ksharp for the direction. Posting as a reply to help anyone else that stumbles on this post.&lt;/P&gt;&lt;P&gt;A helpful link I found for understanding linear combinations of model parameters that is used in the estimate statement:&amp;nbsp;&lt;A href="https://stats.oarc.ucla.edu/sas/faq/how-do-i-write-an-estimate-statement-in-proc-glm/" target="_blank" rel="noopener"&gt;https://stats.oarc.ucla.edu/sas/faq/how-do-i-write-an-estimate-statement-in-proc-glm/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Instead of proc mixed, I've used proc glimmix, which allows me to provide an adjustment for multiple tests.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc glimmix empirical data=iheight;
    class Type Treatment blockid groupid State;
    model Diff = Height_cm|Type|Treatment / solution;
    random State blockid groupid(blockid) / subject = groupid;
    lsmeans Type*Treatment / at Height_cm = 25 adjust=tukey;
    estimate 'a open' Height_cm 1 Height_cm*Treatment 1 0 Height_cm*Type 1 0 0 0 0 0 Height_cm*Type*Treatment 1 0 0 0 0 0 0 0 0 0 0 0,
    'b open' Height_cm 1 Height_cm*Treatment 1 0 Height_cm*Type 0 1 0 0 0 0 Height_cm*Type*Treatment 0 0 1 0 0 0 0 0 0 0 0 0,
    'c open'Height_cm 1 Height_cm*Treatment 1 0 Height_cm*Type 0 0 1 0 0 0 Height_cm*Type*Treatment 0 0 0 0 1 0 0 0 0 0 0 0,
    'd open'Height_cm 1 Height_cm*Treatment 1 0 Height_cm*Type 0 0 0 1 0 0 Height_cm*Type*Treatment 0 0 0 0 0 0 1 0 0 0 0 0,
    'e open'Height_cm 1 Height_cm*Treatment 1 0 Height_cm*Type 0 0 0 0 1 0 Height_cm*Type*Treatment 0 0 0 0 0 0 0 0 1 0 0 0,
    'f open'Height_cm 1 Height_cm*Treatment 1 0 Height_cm*Type 0 0 0 0 0 1 Height_cm*Type*Treatment 0 0 0 0 0 0 0 0 0 0 1 0,
    'a closed' Height_cm 1 Height_cm*Treatment 0 1 Height_cm*Type 1 0 0 0 0 0 Height_cm*Type*Treatment 0 1 0 0 0 0 0 0 0 0 0 0,
    'b closed' Height_cm 1 Height_cm*Treatment 0 1 Height_cm*Type 0 1 0 0 0 0 Height_cm*Type*Treatment 0 0 0 1 0 0 0 0 0 0 0 0,
    'c closed'Height_cm 1 Height_cm*Treatment 0 1 Height_cm*Type 0 0 1 0 0 0 Height_cm*Type*Treatment 0 0 0 0 0 1 0 0 0 0 0 0,
    'd closed'Height_cm 1 Height_cm*Treatment 0 1 Height_cm*Type 0 0 0 1 0 0 Height_cm*Type*Treatment 0 0 0 0 0 0 0 1 0 0 0 0,
    'e closed'Height_cm 1 Height_cm*Treatment 0 1 Height_cm*Type 0 0 0 0 1 0 Height_cm*Type*Treatment 0 0 0 0 0 0 0 0 0 1 0 0,
    'f closed'Height_cm 1 Height_cm*Treatment 0 1 Height_cm*Type 0 0 0 0 0 1 Height_cm*Type*Treatment 0 0 0 0 0 0 0 0 0 0 0 1 / adjust = BON;
    store BlockAnalysis / label='PLM: Getting Started';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I can then plot the estimates and standard errors to compare means separations (similar to a lines command)&lt;/P&gt;&lt;P&gt;As for if my model is correct, still unsure. My model statement (I hope) is testing a three-way interaction (Factorial ANCOVA, creating a regression of Diff by Height_cm, then comparing intercepts and slopes of subsequent combinations of Type and Treatment.)&lt;/P&gt;</description>
      <pubDate>Thu, 28 Nov 2024 13:02:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-MIXED-for-ANCOVA-Comparing-Slopes-for-Each-Group/m-p/952133#M47642</guid>
      <dc:creator>jolich1</dc:creator>
      <dc:date>2024-11-28T13:02:36Z</dc:date>
    </item>
    <item>
      <title>Re: PROC MIXED for ANCOVA: Comparing Slopes for Each Group</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-MIXED-for-ANCOVA-Comparing-Slopes-for-Each-Group/m-p/953128#M47695</link>
      <description>&lt;P&gt;On your ESTIMATE statements, I assume you wish to find marginal values over Type, Treatment and the Type by Treatment interaction, as there are no terms included in the statement for those factors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you considered using LSMESTIMATE statements, with the AT= option for various interesting values for the covariate?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SteveDenham&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2024 18:31:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-MIXED-for-ANCOVA-Comparing-Slopes-for-Each-Group/m-p/953128#M47695</guid>
      <dc:creator>SteveDenham</dc:creator>
      <dc:date>2024-12-10T18:31:23Z</dc:date>
    </item>
  </channel>
</rss>

