<?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: Visualizing an interaction between 2 continuous predictors w/confidence bands (Proc Mixed model) in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Visualizing-an-interaction-between-2-continuous-predictors-w/m-p/634638#M30380</link>
    <description>&lt;P&gt;Yes exactly,&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code for the model:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC MIXED COVTEST DATA=Work.EsmDataNew METHOD=reml cl;
 CLASS ID Day;
 MODEL Y=Day_midc
Work_AP_c  
AM_motivation_pc
XT1_pm 
XT1_pc 
MT1_pm
MT1_pc
XT1_pm *MT1_pm
XT1_pc *MT1_pm
XT1_pm *MT1_pc
XT1_pc *MT1_pc/S; 
 RANDOM intercept XT1_pc /SUBJECT=id TYPE=UN GCORR cl;
 REPEATED Day/subject=id type=ar(1);
 store out=MixedModel1;                       /* create item store */
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;[*pc represents the within person component (person centered) and _pm represents between persons components (grand mean centered)].&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;</description>
    <pubDate>Wed, 25 Mar 2020 07:20:06 GMT</pubDate>
    <dc:creator>Poppi21</dc:creator>
    <dc:date>2020-03-25T07:20:06Z</dc:date>
    <item>
      <title>Visualizing an interaction between 2 continuous predictors w/confidence bands (Proc Mixed model)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Visualizing-an-interaction-between-2-continuous-predictors-w/m-p/633816#M30373</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have data from an experience sampling study (daily observations nested in individuals) and have been using proc mixed to analyze this multilevel data. I have an interaction that I want to plot: between a continuous (day level) predictor (X) and a continuous (day level) moderator (M).&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to graph the interaction w/confidence bands in sas (I previously graphed the interaction in excel +/- 1 standard deviation for both X and M (so plotting at :low-low, low-high, high-low, high-high).&lt;/P&gt;&lt;P&gt;I used the "store" statement in my model and then Proc plm w/effectplot but haven't been able to get my intended result.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help with this?&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Sat, 21 Mar 2020 13:06:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Visualizing-an-interaction-between-2-continuous-predictors-w/m-p/633816#M30373</guid>
      <dc:creator>Poppi21</dc:creator>
      <dc:date>2020-03-21T13:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: Visualizing an interaction between 2 continuous predictors w/confidence bands (Proc Mixed model)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Visualizing-an-interaction-between-2-continuous-predictors-w/m-p/633926#M30374</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where is Original Post ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp; has written a blog about this topic .&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2019/12/05/longitudinal-data-mixed-model.html" target="_blank" rel="noopener"&gt;https://blogs.sas.com/content/iml/2019/12/05/longitudinal-data-mixed-model.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2018/12/19/visualize-mixed-model.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2018/12/19/visualize-mixed-model.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2019/05/30/visualize-interaction-effects-regression.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2019/05/30/visualize-interaction-effects-regression.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Mar 2020 10:51:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Visualizing-an-interaction-between-2-continuous-predictors-w/m-p/633926#M30374</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-03-22T10:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: Visualizing an interaction between 2 continuous predictors w/confidence bands (Proc Mixed model)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Visualizing-an-interaction-between-2-continuous-predictors-w/m-p/634363#M30376</link>
      <description>&lt;P&gt;I think you are right by using "store" and proc plm. Can you provide your program?&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 07:54:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Visualizing-an-interaction-between-2-continuous-predictors-w/m-p/634363#M30376</guid>
      <dc:creator>JacobSimonsen</dc:creator>
      <dc:date>2020-03-24T07:54:42Z</dc:date>
    </item>
    <item>
      <title>Re: Visualizing an interaction between 2 continuous predictors w/confidence bands (Proc Mixed model)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Visualizing-an-interaction-between-2-continuous-predictors-w/m-p/634390#M30377</link>
      <description>Hi Thank you,&lt;BR /&gt;I read these pages and actually posted the question there as well Rick suggested I post it on communities:-)</description>
      <pubDate>Tue, 24 Mar 2020 09:48:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Visualizing-an-interaction-between-2-continuous-predictors-w/m-p/634390#M30377</guid>
      <dc:creator>Poppi21</dc:creator>
      <dc:date>2020-03-24T09:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: Visualizing an interaction between 2 continuous predictors w/confidence bands (Proc Mixed model)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Visualizing-an-interaction-between-2-continuous-predictors-w/m-p/634392#M30378</link>
      <description>&lt;P&gt;Hi Thank you!&lt;BR /&gt;After storing the Mixed model used the plm program below:&lt;BR /&gt;* XT1 = continuous predictor and MT1 = continuous moderator.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc plm source=MixedModel1;                 /* or use restore statement */
effectplot slicefit(x=XT1 sliceby=MT1=4.9273927 5.398148)/ clm
run; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;However, I'm actually trying to plot it at the following 4 points +/- 1 SD for XT1 and MT1:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Low XT1&lt;/TD&gt;&lt;TD&gt;High XT1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Low MT1&lt;/TD&gt;&lt;TD&gt;4.927392&lt;/TD&gt;&lt;TD&gt;5.95138&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;High MT1&lt;/TD&gt;&lt;TD&gt;5.398148&lt;/TD&gt;&lt;TD&gt;6.886211&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;And to ultimately produce the below graph with confidence bands (this one was created in excel)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Interaction plot.png" style="width: 657px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/37291i3BDC40D6296456E5/image-size/large?v=v2&amp;amp;px=999" role="button" title="Interaction plot.png" alt="Interaction plot.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated!&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 10:07:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Visualizing-an-interaction-between-2-continuous-predictors-w/m-p/634392#M30378</guid>
      <dc:creator>Poppi21</dc:creator>
      <dc:date>2020-03-24T10:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: Visualizing an interaction between 2 continuous predictors w/confidence bands (Proc Mixed model)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Visualizing-an-interaction-between-2-continuous-predictors-w/m-p/634563#M30379</link>
      <description>&lt;P&gt;To clarify, you want the predicted value and prediction intervals for the four points in the table? And XT1 and MT1 are both fixed effects, right?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please provide the SAS code that specifies the model that you fit.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 20:58:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Visualizing-an-interaction-between-2-continuous-predictors-w/m-p/634563#M30379</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-03-24T20:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: Visualizing an interaction between 2 continuous predictors w/confidence bands (Proc Mixed model)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Visualizing-an-interaction-between-2-continuous-predictors-w/m-p/634638#M30380</link>
      <description>&lt;P&gt;Yes exactly,&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code for the model:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC MIXED COVTEST DATA=Work.EsmDataNew METHOD=reml cl;
 CLASS ID Day;
 MODEL Y=Day_midc
Work_AP_c  
AM_motivation_pc
XT1_pm 
XT1_pc 
MT1_pm
MT1_pc
XT1_pm *MT1_pm
XT1_pc *MT1_pm
XT1_pm *MT1_pc
XT1_pc *MT1_pc/S; 
 RANDOM intercept XT1_pc /SUBJECT=id TYPE=UN GCORR cl;
 REPEATED Day/subject=id type=ar(1);
 store out=MixedModel1;                       /* create item store */
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;[*pc represents the within person component (person centered) and _pm represents between persons components (grand mean centered)].&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2020 07:20:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Visualizing-an-interaction-between-2-continuous-predictors-w/m-p/634638#M30380</guid>
      <dc:creator>Poppi21</dc:creator>
      <dc:date>2020-03-25T07:20:06Z</dc:date>
    </item>
    <item>
      <title>Re: Visualizing an interaction between 2 continuous predictors w/confidence bands (Proc Mixed model)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Visualizing-an-interaction-between-2-continuous-predictors-w/m-p/634664#M30381</link>
      <description>&lt;P&gt;Hi again,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With some simpler simulated I was able to plot the effect with the proc plm using the effectplot with slicefit option.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*simulate a dataset with predictors c and x, and outcome y;
data simulation;
  do i=1 to 1000;
    c=int(rand('uniform',0,5));
    x=int(rand('uniform',0,5));
	y=rand('normal',(1/2-c)*x+x*x+2,1);
    output; 
  end;
run; 

*estimate the model and save the model to "mymodel";
proc mixed data=simulation;
  model y= c*x c c*x*x;
  store out=mymodel;
run;

*plot the prediction with confidence limits;
ods graphics;
ods hmtl;
proc plm restore=mymodel;
  effectplot slicefit(x=x sliceby= c=2,3) /clm;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Since you have many more covariates in your model, all the other covariates will be set at some level. I hope you find it usefull.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2020 10:26:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Visualizing-an-interaction-between-2-continuous-predictors-w/m-p/634664#M30381</guid>
      <dc:creator>JacobSimonsen</dc:creator>
      <dc:date>2020-03-25T10:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: Visualizing an interaction between 2 continuous predictors w/confidence bands (Proc Mixed model)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Visualizing-an-interaction-between-2-continuous-predictors-w/m-p/634669#M30382</link>
      <description>&lt;P&gt;I could be wrong, but I don't think the EFFECTPLOT statement supports creating an INTERACTION plot for arbitrary values of a continuous variable (at mean +/- stdDev). You can get a SLICEFIT or CONTOUR plot, which both display more information&amp;nbsp;for continuous variables. Maybe plot BY day?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyway, If you really want the graph that you display, I think you will have to create your own scoring set in which you specify the mean value (or some other reference value)&amp;nbsp; for most of the covariates. I've shown how to do this in two articles:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2018/08/06/score-quantile-regression-sas.html" target="_self"&gt;Use the missing value trick to score and visualize a regression model&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2017/12/20/create-sliced-fit-plot-sas.html" target="_self"&gt;How to create a sliced fit plot in SAS&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Both of those articles assume that you want to see a sliced fit plot. To get the interaction plot that you describe, try something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* sample model with interaction terms */
proc glm data=sashelp.cars;
model mpg_city = weight | horsepower ;
store glmModel;
run;

/* form mean +/- std dev and create the scoring data set */
/* find mean and std dev for continuous covariates */
proc means data=sashelp.cars;
var weight horsepower;
output out=MeanOut mean  =weight_mean horsepower_mean 
                   stddev=weight_std  horsepower_std;
run;

/* form the scoring data set */
data ScoreData;
set MeanOut;
wmin = weight_mean - weight_std;
wmax = weight_mean + weight_std;
hmin = horsepower_mean - horsepower_std;
hmax = horsepower_mean + horsepower_std;
xLabel = "Low XT1 "; cLabel="Low MT1 "; weight=wmin; horsepower = hmin; output;
xLabel = "Low XT1 "; cLabel="High MT1"; weight=wmin; horsepower = hmax; output;
xLabel = "High XT1"; cLabel="Low MT1 "; weight=wmax; horsepower = hmin; output;
xLabel = "High XT1"; cLabel="High MT1"; weight=wmax; horsepower = hmax; output;
run;

/* evaluate model on scoring data set */
proc plm restore=glmModel;
score data=ScoreData out=ScoreOut PREDICTED LCLM UCLM;
run;

proc print data=ScoreOut;run;

proc sgplot data=ScoreOut;
series x=xLabel y=Predicted / group=cLabel;
scatter x=xLabel y=Predicted / group=cLabel yerrorlower=LCLM yerrorupper=UCLM;
xaxis offsetmin=0.2 offsetmax=0.2;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2020 10:17:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Visualizing-an-interaction-between-2-continuous-predictors-w/m-p/634669#M30382</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-03-25T10:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: Visualizing an interaction between 2 continuous predictors w/confidence bands (Proc Mixed model)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Visualizing-an-interaction-between-2-continuous-predictors-w/m-p/634687#M30383</link>
      <description>Jacob, there is interaction plot in EFFECTPLOT like:&lt;BR /&gt;proc plm restore=mymodel;&lt;BR /&gt;  effectplot interaction(x=...........) /clm;&lt;BR /&gt;run;</description>
      <pubDate>Wed, 25 Mar 2020 10:49:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Visualizing-an-interaction-between-2-continuous-predictors-w/m-p/634687#M30383</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-03-25T10:49:32Z</dc:date>
    </item>
  </channel>
</rss>

