<?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: Slope and intercept in repeated measures linear regression using PROC GLM in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Slope-and-intercept-in-repeated-measures-linear-regression-using/m-p/345106#M18152</link>
    <description>&lt;P&gt;Oh, yes, switch to MIXED or even (my favorite) GLIMMIX!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This example in the MIXED procedure may produce what you are looking for, if what you want is a random coefficients model&lt;/P&gt;
&lt;P&gt;&lt;A title="Example 56.5 Random coefficients" href="https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_mixed_sect034.htm" target="_self"&gt;https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_mixed_sect034.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using that example as a template, and throwing in a plot, your code would look like&lt;/P&gt;
&lt;PRE&gt;proc sgplot data=example;&lt;BR /&gt;  reg x=X y=Y / group=ID;&lt;BR /&gt;  run;&lt;BR /&gt;&lt;BR /&gt;proc mixed data=example;
  class ID;
  model Y = X / solution;
  random Intercept X / type=un sub=ID solution;
  run;&lt;/PRE&gt;
&lt;P&gt;"type=un" specifies random intercepts, random slopes, and covariance between intercepts and slopes. You may find that a simpler structure (e.g., setting covariance to zero, or only random intercepts) might provide a better fit to your data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The estimates of regression parameters (intercept and slope) for the population of IDs is produced by the SOLUTION option on the MODEL statement.&lt;/P&gt;</description>
    <pubDate>Tue, 28 Mar 2017 18:14:54 GMT</pubDate>
    <dc:creator>sld</dc:creator>
    <dc:date>2017-03-28T18:14:54Z</dc:date>
    <item>
      <title>Slope and intercept in repeated measures linear regression using PROC GLM</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Slope-and-intercept-in-repeated-measures-linear-regression-using/m-p/344949#M18135</link>
      <description>&lt;P&gt;I'm running a random effects linear regression model to determine the relationship between two continuous variables (X and Y) within subjects. I'm currently using &lt;CODE&gt;proc glm&lt;/CODE&gt; in SAS 9.4 to accomplish this. Where in my output can I find my global regression equation variables?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc glm data = Example;
class ID; model Y = X ID X*ID / solution;
random ID;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In the results for the solution option, all I can find are the intercept and correlation coefficient for the reference subject, not the whole group.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2017 12:53:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Slope-and-intercept-in-repeated-measures-linear-regression-using/m-p/344949#M18135</guid>
      <dc:creator>kaune</dc:creator>
      <dc:date>2017-03-28T12:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: Slope and intercept in repeated measures linear regression using PROC GLM</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Slope-and-intercept-in-repeated-measures-linear-regression-using/m-p/344970#M18137</link>
      <description>&lt;P&gt;First comment, if you want to model random effects, you should probably use PROC MIXED. Your syntax won't change for this example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The ParameterEstimates table shows the estimates for the model. It does not have a spanning header in PROC GLM, but the column headers are&lt;/P&gt;
&lt;TABLE class="table" rules="all" frame="box" cellspacing="0" cellpadding="5" summary="Procedure GLM: Solution"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="l b header" scope="col"&gt;Parameter&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Estimate&lt;/TH&gt;
&lt;TH class="c headerempty" scope="col"&gt;&amp;nbsp;&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Standard&lt;BR /&gt;Error&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;t&amp;nbsp;Value&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Pr&amp;nbsp;&amp;gt;&amp;nbsp;|t|&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For PROC MIXED, run this code and look for the table that says "Solution for Fixed Effects":&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
call streaminit(1);
set sashelp.class;
clinic = rand("Table", 0.3, 0.3, 0.4);
run;

proc mixed data = class;
class clinic; 
model weight = height | clinic / solution;
random clinic;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Mar 2017 13:49:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Slope-and-intercept-in-repeated-measures-linear-regression-using/m-p/344970#M18137</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-03-28T13:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: Slope and intercept in repeated measures linear regression using PROC GLM</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Slope-and-intercept-in-repeated-measures-linear-regression-using/m-p/345027#M18145</link>
      <description>&lt;P&gt;Thanks for the reply. Your suggestion highlights the issue I have with my original analysis. Using your example code, I get an intercept of -135.67 and a fixed effect estimate for height of 3.77 (suggesting a regression equation of weight = 3.77*height - 135.67). However, when I reorder and re-run the same analysis using the following:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;&lt;BR /&gt;call streaminit(1);&lt;BR /&gt;set sashelp.class;&lt;BR /&gt;clinic = rand("Table", 0.3, 0.3, 0.4);&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data class2; set class;
if clinic = 1 then clinic2 = 'one';
else if clinic = 2 then clinic2 = 'two'; 
else if clinic = 3 then clinic2 = 'three';

proc mixed data = class2;
class clinic2; 
model weight = height | clinic2 / solution;
random clinic2;
run;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I get an intercept of -144.54 and a slope estimate of 3.91 (weight = 3.91*height - 144.54). The fixed effect estimates in the solution option (in PROC MIXED or PROC GLM) provides estimates for the reference subject only (which is the last one calculated), so simply re-ordering the data can vastly change the result. In this example, how do I determine the global effect of weight on height?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2017 15:45:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Slope-and-intercept-in-repeated-measures-linear-regression-using/m-p/345027#M18145</guid>
      <dc:creator>kaune</dc:creator>
      <dc:date>2017-03-28T15:45:38Z</dc:date>
    </item>
    <item>
      <title>Re: Slope and intercept in repeated measures linear regression using PROC GLM</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Slope-and-intercept-in-repeated-measures-linear-regression-using/m-p/345106#M18152</link>
      <description>&lt;P&gt;Oh, yes, switch to MIXED or even (my favorite) GLIMMIX!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This example in the MIXED procedure may produce what you are looking for, if what you want is a random coefficients model&lt;/P&gt;
&lt;P&gt;&lt;A title="Example 56.5 Random coefficients" href="https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_mixed_sect034.htm" target="_self"&gt;https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_mixed_sect034.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using that example as a template, and throwing in a plot, your code would look like&lt;/P&gt;
&lt;PRE&gt;proc sgplot data=example;&lt;BR /&gt;  reg x=X y=Y / group=ID;&lt;BR /&gt;  run;&lt;BR /&gt;&lt;BR /&gt;proc mixed data=example;
  class ID;
  model Y = X / solution;
  random Intercept X / type=un sub=ID solution;
  run;&lt;/PRE&gt;
&lt;P&gt;"type=un" specifies random intercepts, random slopes, and covariance between intercepts and slopes. You may find that a simpler structure (e.g., setting covariance to zero, or only random intercepts) might provide a better fit to your data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The estimates of regression parameters (intercept and slope) for the population of IDs is produced by the SOLUTION option on the MODEL statement.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2017 18:14:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Slope-and-intercept-in-repeated-measures-linear-regression-using/m-p/345106#M18152</guid>
      <dc:creator>sld</dc:creator>
      <dc:date>2017-03-28T18:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: Slope and intercept in repeated measures linear regression using PROC GLM</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Slope-and-intercept-in-repeated-measures-linear-regression-using/m-p/345110#M18153</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/136216"&gt;@kaune&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I get an intercept of -144.54 and a slope estimate of 3.91 (weight = 3.91*height - 144.54). The fixed effect estimates in the solution option (in PROC MIXED or PROC GLM) provides estimates for the reference subject only (which is the last one calculated), so simply re-ordering the data can vastly change the result. In this example, how do I determine the global effect of weight on height?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The&amp;nbsp;slope for height on&amp;nbsp;weight for the various different clinics is indeed constant.&amp;nbsp;The coefficients do change depending on which level is considered the reference. However, the sum of the global slope and effect due to the specific clinic is unique and doesn't change if you change the reference subject.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So to use Rick's example from SASUSER.CLASS data set:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;                                       Standard
Effect           clinic    Estimate       Error      DF    t Value    Pr &amp;gt; |t|

Intercept                   -135.67     42.9456       0      -3.16       .
Height                       3.7701      0.6818      13       5.53      &amp;lt;.0001
clinic           1           873.56      638.75       0       1.37       .
clinic           2          -8.8650     77.9700       0      -0.11       .
clinic           3                0           .       .        .         .
Height*clinic    1         -13.1818      9.7306      13      -1.35      0.1986
Height*clinic    2           0.1359      1.2906      13       0.11      0.9177
Height*clinic    3                0           .       .        .         .
&lt;/PRE&gt;
&lt;P&gt;the slope of height for clinic1 is 3.7701 - 13.1818 = -9.4117, and this is unique and unchanging, even when you change the reference level.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2017 18:27:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Slope-and-intercept-in-repeated-measures-linear-regression-using/m-p/345110#M18153</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-03-28T18:27:00Z</dc:date>
    </item>
  </channel>
</rss>

