<?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: How to plot curves for a multilevel logistic regression with proc glimmix in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/How-to-plot-curves-for-a-multilevel-logistic-regression-with/m-p/891757#M24063</link>
    <description>&lt;P&gt;Create spaghetti plots in SAS &lt;BR /&gt;By Rick Wicklin on The DO Loop June 2, 2016&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2016/06/02/create-spaghetti-plots-in-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2016/06/02/create-spaghetti-plots-in-sas.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lasagna plots in SAS: When spaghetti plots don't suffice &lt;BR /&gt;By Rick Wicklin on The DO Loop June 8, 2016&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2016/06/08/lasagna-plot-in-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2016/06/08/lasagna-plot-in-sas.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
    <pubDate>Wed, 30 Aug 2023 17:36:17 GMT</pubDate>
    <dc:creator>sbxkoenk</dc:creator>
    <dc:date>2023-08-30T17:36:17Z</dc:date>
    <item>
      <title>How to plot curves for a multilevel logistic regression with proc glimmix</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-plot-curves-for-a-multilevel-logistic-regression-with/m-p/891214#M24048</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dear community,&lt;/P&gt;&lt;P&gt;Unfortunately, we don't work with SAS very often at the university. Therefore, I have been attempting to code a multilevel logistic regression using &lt;CODE&gt;proc glimmix&lt;/CODE&gt; over the past few days. I successfully defined the model, but I am now facing challenges in visualizing the plot.&lt;/P&gt;&lt;P&gt;The model is as follows:&lt;/P&gt;&lt;PRE&gt;/*Random Intercept, fixed slope model*/
proc glimmix data=muslim method=LAPLACE empirical;
class country_1 sex (ref="0") believe_god (ref="0");
model anti_muslim(ref="0") = age sex edu rlscale2 believe_god attend_rel  
   /link = logit distribution=binary solution alpha=0.05; 
random intercept / subject = country_1 type = un;
output out = predict pred = logitpred;
run;&lt;/PRE&gt;&lt;P&gt;I am grouping the data by countries (N=34), and my outcome variable is dichotomous (responding to the question: "Would you like to have a Muslim as your neighbor?" where 0=no). Additionally, I have a few Level 1 predictors (age, sex, etc.). My goal is to create a spaghetti plot with the predicted outcome on the y-axis and the predictor on the x-axis. I believe that by doing this, I should obtain a graph with 34 lines representing each country's development over the predictor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My attempted approach is as follows:&lt;/P&gt;&lt;PRE&gt;proc sort data = muslim;
by age sex edu rlscale2 believe_god attend_rel;
run;

data predict;
set predict;
pred = logistic(logitpred);
run;

title "Plot";
proc sgplot;
series y = pred x = age / group = country_1;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, the resulting visualized plot is quite confusing. My suspicion is that SAS created a line for every individual (Level 1 unit).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am unsure of what might be causing this issue and would greatly appreciate any assistance.&lt;/P&gt;&lt;P&gt;One more piece of information: There are missing values in the predictors. As a result, when I save the predicted values as shown above, there are numerous missing values in that variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance for any help you can provide and if you need any information please ask!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Aug 2023 04:46:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-plot-curves-for-a-multilevel-logistic-regression-with/m-p/891214#M24048</guid>
      <dc:creator>rerere</dc:creator>
      <dc:date>2023-08-27T04:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot curves for a multilevel logistic regression with proc glimmix</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-plot-curves-for-a-multilevel-logistic-regression-with/m-p/891757#M24063</link>
      <description>&lt;P&gt;Create spaghetti plots in SAS &lt;BR /&gt;By Rick Wicklin on The DO Loop June 2, 2016&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2016/06/02/create-spaghetti-plots-in-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2016/06/02/create-spaghetti-plots-in-sas.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lasagna plots in SAS: When spaghetti plots don't suffice &lt;BR /&gt;By Rick Wicklin on The DO Loop June 8, 2016&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2016/06/08/lasagna-plot-in-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2016/06/08/lasagna-plot-in-sas.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 17:36:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-plot-curves-for-a-multilevel-logistic-regression-with/m-p/891757#M24063</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2023-08-30T17:36:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot curves for a multilevel logistic regression with proc glimmix</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-plot-curves-for-a-multilevel-logistic-regression-with/m-p/892058#M24073</link>
      <description>&lt;P&gt;Could you post a picture of what your graph looks like?&lt;/P&gt;
&lt;P&gt;And could you perhaps sketch out by hand an example of what you would like your graph to look like?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 19:49:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-plot-curves-for-a-multilevel-logistic-regression-with/m-p/892058#M24073</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2023-08-31T19:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot curves for a multilevel logistic regression with proc glimmix</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-plot-curves-for-a-multilevel-logistic-regression-with/m-p/892233#M24074</link>
      <description>&lt;P&gt;Hey Koen,&lt;/P&gt;&lt;P&gt;Thanks for your reply! I've read the text, and it provided me with some useful insights. I believe I now understand why my code isn't working, but I have no idea how to fix it. It seems I need to take the other predictors into account in my plot!&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2023 10:03:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-plot-curves-for-a-multilevel-logistic-regression-with/m-p/892233#M24074</guid>
      <dc:creator>rerere</dc:creator>
      <dc:date>2023-09-01T10:03:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot curves for a multilevel logistic regression with proc glimmix</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-plot-curves-for-a-multilevel-logistic-regression-with/m-p/892238#M24075</link>
      <description>&lt;P&gt;What I get:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-09-01 115858.jpg" style="width: 550px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/87497i787863F22E97C119/image-dimensions/550x422?v=v2" width="550" height="422" role="button" title="Screenshot 2023-09-01 115858.jpg" alt="Screenshot 2023-09-01 115858.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I would like to get:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="right.jpg" style="width: 532px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/87498iA93324EEAE7DE4A9/image-dimensions/532x396?v=v2" width="532" height="396" role="button" title="right.jpg" alt="right.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I think my problem is that I didn't consider the other predictors in this plot, but I have no clue how to take them into account &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2023 10:09:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-plot-curves-for-a-multilevel-logistic-regression-with/m-p/892238#M24075</guid>
      <dc:creator>rerere</dc:creator>
      <dc:date>2023-09-01T10:09:15Z</dc:date>
    </item>
  </channel>
</rss>

