<?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 visualization the interaction and odds ratio/ risk ratio? in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-visualization-the-interaction-and-odds-ratio-risk-ratio/m-p/837563#M41487</link>
    <description>&lt;P&gt;You can get risk ratio from URL I post.&lt;BR /&gt;Or you could use &lt;BR /&gt;lsmeans A / at x1=1.2 ODDSRATIO diff cl ;&lt;BR /&gt;lsmeans A / at x1=1.4 ODDSRATIO diff cl ;&lt;BR /&gt;lsmeans A / at x1=1.6 ODDSRATIO diff cl ;&lt;BR /&gt;...........&lt;BR /&gt;to get oddsratio, after that use PROC SGPLOT to plot it.&lt;BR /&gt;&lt;BR /&gt;and maybe &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13633"&gt;@StatDave&lt;/a&gt; know more things.&lt;/P&gt;</description>
    <pubDate>Mon, 10 Oct 2022 11:38:32 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2022-10-10T11:38:32Z</dc:date>
    <item>
      <title>How to visualization the interaction and odds ratio/ risk ratio?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-visualization-the-interaction-and-odds-ratio-risk-ratio/m-p/837553#M41482</link>
      <description>&lt;P&gt;Dear all, I have a question of how to create the plot using continuous in the model as the independent variable and the odds ratio/ predicted probability as the dependent variable.&lt;/P&gt;
&lt;P&gt;I try to use the effectplot statement in proc genmod, however, it seems to not work&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc genmod data = ITT1;
class enroll_order group(desc) score_0to1(desc)/PARAM = GLM;
model score_0to1 = group age/ dist = poisson link = log covB corrb;
effectplot fit(x = age);
repeated subject = enroll_order/type = un;
estimate "beta" group 1 -1/exp;
lsmeans group/diff exp cl;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The score_0to1 is a binary responce(0 and 1 ), why this get negtive value?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Diels_O_1-1665288643129.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76035i199D8E5665091AA6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Diels_O_1-1665288643129.png" alt="Diels_O_1-1665288643129.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I get plot like the this? (This plot shows the odds ratio for group changing with time)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Diels_O_0-1665288340415.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76034iC216E6774D775542/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Diels_O_0-1665288340415.png" alt="Diels_O_0-1665288340415.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Diels_O_2-1665288768678.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76036i3235E328E7E86F87/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Diels_O_2-1665288768678.png" alt="Diels_O_2-1665288768678.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Oct 2022 04:13:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-visualization-the-interaction-and-odds-ratio-risk-ratio/m-p/837553#M41482</guid>
      <dc:creator>Diels_O</dc:creator>
      <dc:date>2022-10-09T04:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to visualization the interaction and odds ratio/ risk ratio?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-visualization-the-interaction-and-odds-ratio-risk-ratio/m-p/837559#M41484</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*
Check this URL:

https://support.sas.com/kb/24/188.html
http://support.sas.com/kb/37/344.html

*/

data Seizure;
input ID Count Visit Trt Age Weeks;
datalines;
104 11 0 0 31 8
104 5 1 0 31 2
104 3 2 0 31 2
104 3 3 0 31 2
104 3 4 0 31 2
106 11 0 0 21 8
106 15 1 0 21 2
106 13 2 0 21 2
106 30 3 0 21 2
106 32 4 0 21 2
234 2 0 1 35 8
234 1 1 1 35 2
234 4 2 1 35 2
234 3 3 1 35 2
234 12 4 1 35 2
235 2 0 1 30 8
235 11 1 1 30 2
235 40 2 1 30 2
235 32 3 1 30 2
235 22 4 1 30 2
236 12 0 1 30 8
236 1 1 1 37 2
236 4 2 1 37 2
236 3 3 1 37 2
236 2 4 1 37 2
;
data Seizure;
set Seizure;
if ID ne 207;
if Visit = 0 then do;
X1=0;
Ltime = log(8);
end;
else do;
X1=1;
Ltime=log(2);
end;
run;

proc gee data = Seizure;
class ID Visit trt;
model Count = age Trt  / dist=poisson link=log offset= Ltime;
repeated subject = ID /within=visit type=unstr covb corrw;
effectplot slicefit(x=age sliceby=trt) /  limits ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1665314918543.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76037iF28B7782599E2982/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1665314918543.png" alt="Ksharp_0-1665314918543.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Oct 2022 11:28:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-visualization-the-interaction-and-odds-ratio-risk-ratio/m-p/837559#M41484</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-10-09T11:28:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to visualization the interaction and odds ratio/ risk ratio?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-visualization-the-interaction-and-odds-ratio-risk-ratio/m-p/837561#M41485</link>
      <description>Thanks for your help! However, how could I plot the ODDS ratio or risk ratio of a categorical changing with the continous variable?</description>
      <pubDate>Sun, 09 Oct 2022 11:52:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-visualization-the-interaction-and-odds-ratio-risk-ratio/m-p/837561#M41485</guid>
      <dc:creator>Diels_O</dc:creator>
      <dc:date>2022-10-09T11:52:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to visualization the interaction and odds ratio/ risk ratio?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-visualization-the-interaction-and-odds-ratio-risk-ratio/m-p/837563#M41487</link>
      <description>&lt;P&gt;You can get risk ratio from URL I post.&lt;BR /&gt;Or you could use &lt;BR /&gt;lsmeans A / at x1=1.2 ODDSRATIO diff cl ;&lt;BR /&gt;lsmeans A / at x1=1.4 ODDSRATIO diff cl ;&lt;BR /&gt;lsmeans A / at x1=1.6 ODDSRATIO diff cl ;&lt;BR /&gt;...........&lt;BR /&gt;to get oddsratio, after that use PROC SGPLOT to plot it.&lt;BR /&gt;&lt;BR /&gt;and maybe &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13633"&gt;@StatDave&lt;/a&gt; know more things.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 11:38:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-visualization-the-interaction-and-odds-ratio-risk-ratio/m-p/837563#M41487</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-10-10T11:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to visualization the interaction and odds ratio/ risk ratio?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-visualization-the-interaction-and-odds-ratio-risk-ratio/m-p/837564#M41488</link>
      <description>&lt;P&gt;Thank you very much, and I hope &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13633"&gt;@StatDave&lt;/a&gt; and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt; have other ways to visualize odds/risk ratio changing with continuous variable&lt;/P&gt;</description>
      <pubDate>Sun, 09 Oct 2022 12:22:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-visualization-the-interaction-and-odds-ratio-risk-ratio/m-p/837564#M41488</guid>
      <dc:creator>Diels_O</dc:creator>
      <dc:date>2022-10-09T12:22:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to visualization the interaction and odds ratio/ risk ratio?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-visualization-the-interaction-and-odds-ratio-risk-ratio/m-p/837661#M41490</link>
      <description>&lt;P&gt;If you want a plot of how the predicted probability, relative risk, risk difference, or odds ratio changes over the levels of age, then you need to include the group*age interaction in the model so that the model allows for change over age. Since your response is binary, then this is really much easier to do with a logistic model, which is the only model you can use if you want odds ratios. And while PROC LOGISTIC would normally be the best choice, it is more convenient to use PROC NLMIXED to fit the model since you can then use its PREDICT statement to save data sets of the predicted probabilities and the estimated relative risks and odds ratios. If you aggregate the data for the group-age combinations so that each observation has a count of the events (r) and a count of the total number of cases (n), then the following code fits the model, saves the needed data sets, and produces each of the plots against age. The difference of probabilities could similarly be computed and plotted.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc nlmixed;
   p=logistic(b0 + b1*(group='A') + b2*age + b3*age*(group='A'));
   model r ~ binomial(n,p);
   predict p out=pred;
   predict  logistic(b0+b1+b2*age+b3*age) / logistic(b0+b2*age) out=rr;
   predict exp(b0+b1+b2*age+b3*age)/exp(b0+b2*age) out=or;
   run;
proc sort data=pred; by group age; run;
proc sgplot data=pred;
   band upper=upper lower=lower x=age/group=group transparency=.8;
   series y=pred x=age/group=group;
   yaxis label="Predicted probability";
   run;
proc sort data=rr; by age; run;
proc sgplot data=rr noautolegend;
   band upper=upper lower=lower x=age/transparency=.8;
   series y=pred x=age;
   yaxis label="Relative risk";
   run;
proc sort data=or; by age; run;
proc sgplot data=or noautolegend;
   band upper=upper lower=lower x=age/transparency=.8;
   series y=pred x=age;
   yaxis label="Odds ratio";
   run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Oct 2022 13:33:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-visualization-the-interaction-and-odds-ratio-risk-ratio/m-p/837661#M41490</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2022-10-10T13:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to visualization the interaction and odds ratio/ risk ratio?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-visualization-the-interaction-and-odds-ratio-risk-ratio/m-p/838092#M41507</link>
      <description>&lt;P&gt;Thank you Dave , yet I met problems when preparing my data to proc nlmixed, and the score_0to1 is a binary response, n is the total number of events and r is the number of predicted event. How shoud I transform my data? Thank you very much!&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data q2; 
set q1; 
n = _n_;
r =(score_0to1 = 1);  
output;  
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2022 15:47:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-visualization-the-interaction-and-odds-ratio-risk-ratio/m-p/838092#M41507</guid>
      <dc:creator>Diels_O</dc:creator>
      <dc:date>2022-10-12T15:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to visualization the interaction and odds ratio/ risk ratio?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-visualization-the-interaction-and-odds-ratio-risk-ratio/m-p/838311#M41511</link>
      <description>&lt;P&gt;The NLMIXED code I gave is appropriate for aggregated data rather than individual data. If your data is individual level data, then you can either aggregate it with a procedure like MEANS or FREQ to save the n and r counts, or you could change the NLMIXED MODEL statement to be appropriate for individual level data. To change NLMIXED, your response variable needs to be numeric and coded 1 for the event and 0 for the nonevent. Then change the MODEL statement to: model y ~ binary(p);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2022 22:13:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-visualization-the-interaction-and-odds-ratio-risk-ratio/m-p/838311#M41511</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2022-10-12T22:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to visualization the interaction and odds ratio/ risk ratio?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-visualization-the-interaction-and-odds-ratio-risk-ratio/m-p/838365#M41512</link>
      <description>Thank you Dave! Wish you a luck day!</description>
      <pubDate>Thu, 13 Oct 2022 10:41:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-visualization-the-interaction-and-odds-ratio-risk-ratio/m-p/838365#M41512</guid>
      <dc:creator>Diels_O</dc:creator>
      <dc:date>2022-10-13T10:41:17Z</dc:date>
    </item>
  </channel>
</rss>

