<?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 predicted values by groups? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/554910#M154415</link>
    <description>&lt;P&gt;Thanks a lot for the suggestion Chris, below is my code for the plot, please let me know how can I use this statement for plot another serie with the effect by level of "Tratamiento", I do have two levels.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sgplot data=Out;&lt;BR /&gt;scatter y=PL x=DIM/group=Tratamiento;&lt;BR /&gt;series y=Pred x=DIM/group=Vaca;&lt;BR /&gt;title "Milk Yield Modelation usin cubic splines";&lt;BR /&gt;title2 "Dairy Module";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 30 Apr 2019 03:18:36 GMT</pubDate>
    <dc:creator>JorgeHidalgo</dc:creator>
    <dc:date>2019-04-30T03:18:36Z</dc:date>
    <item>
      <title>How to plot predicted values by groups?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/554897#M154406</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am running an example with splines and some additional factors, I want to plot the predicted values by groups for a determined effect, my model looks like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc glimmix data=one outdesign(x)=Xmatrix;&lt;BR /&gt;class Tratamiento Tparto;&lt;BR /&gt;effect sp_DIM = spline(DIM/basis=bspline details);&lt;BR /&gt;model PL = sp_DIM Edad1L Tratamiento Dreto Tparto MS RS CS DS/solution;&lt;BR /&gt;output out=Out pred=Pred;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get the predicted values, but, then I want to get prediction by levels of "Tratamiento", how can I do that?&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 01:57:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/554897#M154406</guid>
      <dc:creator>JorgeHidalgo</dc:creator>
      <dc:date>2019-04-30T01:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot predicted values by groups?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/554906#M154412</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt; I want to get prediction by levels of "Tratamiento", how can I do that?&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Would using the BY statement do that?&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 03:09:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/554906#M154412</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-04-30T03:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot predicted values by groups?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/554910#M154415</link>
      <description>&lt;P&gt;Thanks a lot for the suggestion Chris, below is my code for the plot, please let me know how can I use this statement for plot another serie with the effect by level of "Tratamiento", I do have two levels.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sgplot data=Out;&lt;BR /&gt;scatter y=PL x=DIM/group=Tratamiento;&lt;BR /&gt;series y=Pred x=DIM/group=Vaca;&lt;BR /&gt;title "Milk Yield Modelation usin cubic splines";&lt;BR /&gt;title2 "Dairy Module";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 03:18:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/554910#M154415</guid>
      <dc:creator>JorgeHidalgo</dc:creator>
      <dc:date>2019-04-30T03:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot predicted values by groups?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/554914#M154418</link>
      <description>&lt;P&gt;Try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgpanel data=Out;
panelby tratamiento / onepanel novarname;
scatter y=PL x=DIM;
series y=Pred x=DIM/group=Vaca;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;make sure your data is sorted by DIM.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 03:48:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/554914#M154418</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-04-30T03:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot predicted values by groups?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/554984#M154435</link>
      <description>&lt;P&gt;Thank PG, that was helpful, I will use this plot as well. However, I am trying to do something like the plot below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;I have the lactation curve per cow, but I want I lactation per group with predicted values per group also. In the below plot, the wider curves are the average curves by group. I did try my same code used but I got different results, my plot does not look good.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sgplot data=Out;&lt;BR /&gt;scatter y=PL x=DIM / group=Tratamiento;&lt;BR /&gt;series y=Pred x=DIM / group=Vaca;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;*series y=Pred x=DIM/group=RS lineattrs=(Color="blue" Pattern=solid Thickness=5);&lt;/FONT&gt;&lt;BR /&gt;run;&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="Screenshot 2019-04-30 07.50.18.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29117i091BB1D3D769932C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2019-04-30 07.50.18.png" alt="Screenshot 2019-04-30 07.50.18.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 11:50:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/554984#M154435</guid>
      <dc:creator>JorgeHidalgo</dc:creator>
      <dc:date>2019-04-30T11:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot predicted values by groups?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/555250#M154504</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;but I got different results, my plot does not look good.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Can you detail what's wrong?&lt;/P&gt;
&lt;P&gt;Also provide some dummy data (in the form of a short data step) if you want us to replicate the issue and correct it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 23:38:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/555250#M154504</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-04-30T23:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot predicted values by groups?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/555262#M154510</link>
      <description>&lt;P&gt;Thank Chris, this is my code for the model:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc glimmix data=one outdesign(x)=Xmatrix;&lt;BR /&gt;class Tratamiento Tparto;&lt;BR /&gt;effect sp_DIM = spline(DIM/basis=bspline details);&lt;BR /&gt;model PL = sp_DIM DIM Edad1L Tratamiento Dreto Tparto MS RS CS DS/solution noint;&lt;BR /&gt;random Vaca;&lt;BR /&gt;output out=Out pred=Pred;&lt;BR /&gt;lsmeans Tratamiento;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got the prediction and I did plot in this way without problem&lt;/P&gt;&lt;P&gt;proc sgpanel data=Out;&lt;BR /&gt;panelby Tratamiento / columns=2;&lt;BR /&gt;series x=DIM y=Pred/group=Vaca;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2019-04-30 20.46.36.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29142iE448B2B56B4FE257/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2019-04-30 20.46.36.png" alt="Screenshot 2019-04-30 20.46.36.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But, then I did use the next, I was expecting just one line, because I have just two "Tratamientos", just two leves in the group&lt;/P&gt;&lt;P&gt;What am I doin wrong?&lt;/P&gt;&lt;P&gt;Even when I did sort the output by "Tratamiento" it does not work&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sgpanel data=Out;&lt;BR /&gt;panelby Tratamiento / columns=2;&lt;BR /&gt;series x=DIM y=Pred/group=Tratamiento;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2019 04:57:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/555262#M154510</guid>
      <dc:creator>JorgeHidalgo</dc:creator>
      <dc:date>2019-05-02T04:57:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot predicted values by groups?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/555265#M154512</link>
      <description>&lt;P&gt;1. You need to sort by the X axis variable to avoid the line going back and forth&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2.&lt;EM&gt; &amp;gt; I was expecting just one line, because I have just two "Tratamientos", just two leves in the group&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Look at your data and see all the values for the variables DIM and PRED that you are plotting.&lt;/P&gt;
&lt;P&gt;Since you plot all these points, that does not draw one line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 02:29:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/555265#M154512</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-05-01T02:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot predicted values by groups?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/555269#M154515</link>
      <description>&lt;P&gt;I appreciate your help Chris, now the plot looks like that, but I understood why.&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="Screenshot 2019-04-30 23.48.49.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29144i2C562D6E754B2434/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2019-04-30 23.48.49.png" alt="Screenshot 2019-04-30 23.48.49.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to get the average predicted values for level of effect?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I mean the average predicted value in each value of X for a determined level of a effect as if the rest of the effects were fixed or no changing. In other words, using lsmeans I got a significant difference between levels of "Tratamiento", Is possible to represent this with two curves?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate your patience, I promise the is the last question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 03:54:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/555269#M154515</guid>
      <dc:creator>JorgeHidalgo</dc:creator>
      <dc:date>2019-05-01T03:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot predicted values by groups?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/555272#M154517</link>
      <description>&lt;P&gt;You need to replace all the observations in the table for these 2 plots with just one data point for each DIM.&lt;/P&gt;
&lt;P&gt;What statistical method you choose is left to you appreciation, but once you have the points, the code for plotting is the code you already have.&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 04:46:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/555272#M154517</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-05-01T04:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot predicted values by groups?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/555273#M154518</link>
      <description>&lt;P&gt;Or you could use the PBSPLINE statement instead of the SERIES statement.&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 04:50:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/555273#M154518</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-05-01T04:50:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot predicted values by groups?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/555380#M154560</link>
      <description>&lt;P&gt;Another possible option would be :&lt;/P&gt;
&lt;PRE&gt;proc sgpanel data=Out;
panelby Tratamiento / columns=2;
vbox  pred / category=dim connect=mean ;
run;&lt;/PRE&gt;
&lt;P&gt;Which still displays the dispersion of the predicted values but should show the means of&amp;nbsp; predicted for each DIM&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 15:33:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/555380#M154560</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-05-01T15:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot predicted values by groups?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/555530#M154608</link>
      <description>&lt;P&gt;Thanks a lot to both, Chris and Ballardw, your comments really help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found my perfect plot in effeplot&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc plm source=spMod;
effectplot slicefit(x=DIM sliceby=Tratamiento plotby=DS= 0 1);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now I am wondering if there are options to change the axis labels and the grid values, as well if I can put a specific title to this plots. I did look at the description for this statement but I could not get something related.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2019 04:51:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/555530#M154608</guid>
      <dc:creator>JorgeHidalgo</dc:creator>
      <dc:date>2019-05-02T04:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot predicted values by groups?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/555532#M154609</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2019-05-02 00.49.37.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29153iE1B8ACF1B68E11B0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2019-05-02 00.49.37.png" alt="Screenshot 2019-05-02 00.49.37.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2019 04:53:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-plot-predicted-values-by-groups/m-p/555532#M154609</guid>
      <dc:creator>JorgeHidalgo</dc:creator>
      <dc:date>2019-05-02T04:53:20Z</dc:date>
    </item>
  </channel>
</rss>

