<?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 Plotting Restricted Cubic Spline: Predicted Probability in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Plotting-Restricted-Cubic-Spline-Predicted-Probability/m-p/922538#M363256</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am conducting an analysis to evaluate the relationship between several binary outcomes (death, blood transfusion, 30-day readmission) and a continuous predictor (number of surgeries done at a hospital). I would also like to adjust my model for covariates (age, sex, cardiac anomaly). My objective is to visually examine whether there exists an inflection point, indicating a number of surgeries, where the probability of the outcome changes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is a paper by Ravi et al. (&lt;A href="https://www.bmj.com/content/348/bmj.g3284" target="_blank"&gt;https://www.bmj.com/content/348/bmj.g3284&lt;/A&gt;) that conducted an analysis similar to what I'm hoping to do, using restricted cubic spline plots.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My current approach was to use PROC LOGISTIC with the EFFECTS function for restricted cubic splines, and then plot the predicted probabilities, but I am having trouble with graphing the output though and could use some help. I also appreciate any feedback on my approach/coding in general.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So far, this is what I am using:&lt;/P&gt;&lt;PRE&gt;proc logistic data = have outdesignonly;
effect spl = spline (surgeries / details naturalcubic basis= tpf(noint) knotmethod= percentiles(3));
class sex (ref=0) cardiac_anomaly (ref=0)/ param=ref;
model blood_transfusion = surgeries age sex cardiac_anomaly;
output out= splineout predicted= fit;
run;

title "Restricted Cubic Spline Regression for Blood Transfusion";
proc sgplot data= splineout noautolegend;
scatter x= surgeries y=fit/ lineattrs= (thickness =3 color=red);
run;&lt;/PRE&gt;&lt;P&gt;I have chosen 3 knots because my sample is relatively small (n ~500).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eventually, I would like to be able to plot an overlay plot for the various outcomes, but I am also unclear on how this could be achieved.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance for any suggestions!&lt;/P&gt;</description>
    <pubDate>Tue, 02 Apr 2024 12:37:34 GMT</pubDate>
    <dc:creator>Bumble_15</dc:creator>
    <dc:date>2024-04-02T12:37:34Z</dc:date>
    <item>
      <title>Plotting Restricted Cubic Spline: Predicted Probability</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Plotting-Restricted-Cubic-Spline-Predicted-Probability/m-p/922538#M363256</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am conducting an analysis to evaluate the relationship between several binary outcomes (death, blood transfusion, 30-day readmission) and a continuous predictor (number of surgeries done at a hospital). I would also like to adjust my model for covariates (age, sex, cardiac anomaly). My objective is to visually examine whether there exists an inflection point, indicating a number of surgeries, where the probability of the outcome changes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is a paper by Ravi et al. (&lt;A href="https://www.bmj.com/content/348/bmj.g3284" target="_blank"&gt;https://www.bmj.com/content/348/bmj.g3284&lt;/A&gt;) that conducted an analysis similar to what I'm hoping to do, using restricted cubic spline plots.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My current approach was to use PROC LOGISTIC with the EFFECTS function for restricted cubic splines, and then plot the predicted probabilities, but I am having trouble with graphing the output though and could use some help. I also appreciate any feedback on my approach/coding in general.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So far, this is what I am using:&lt;/P&gt;&lt;PRE&gt;proc logistic data = have outdesignonly;
effect spl = spline (surgeries / details naturalcubic basis= tpf(noint) knotmethod= percentiles(3));
class sex (ref=0) cardiac_anomaly (ref=0)/ param=ref;
model blood_transfusion = surgeries age sex cardiac_anomaly;
output out= splineout predicted= fit;
run;

title "Restricted Cubic Spline Regression for Blood Transfusion";
proc sgplot data= splineout noautolegend;
scatter x= surgeries y=fit/ lineattrs= (thickness =3 color=red);
run;&lt;/PRE&gt;&lt;P&gt;I have chosen 3 knots because my sample is relatively small (n ~500).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eventually, I would like to be able to plot an overlay plot for the various outcomes, but I am also unclear on how this could be achieved.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance for any suggestions!&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2024 12:37:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Plotting-Restricted-Cubic-Spline-Predicted-Probability/m-p/922538#M363256</guid>
      <dc:creator>Bumble_15</dc:creator>
      <dc:date>2024-04-02T12:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting Restricted Cubic Spline: Predicted Probability</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Plotting-Restricted-Cubic-Spline-Predicted-Probability/m-p/922682#M363326</link>
      <description>You didn't include spline effect SPL in your model.&lt;BR /&gt;You could try EFFECTPLOT statement of PROC LOGISTIC or PROC PLM.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2016/03/21/statistical-analysis-stephen-curry-shooting.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2016/03/21/statistical-analysis-stephen-curry-shooting.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;proc logistic data=curry;&lt;BR /&gt;where Shot_Distance &amp;lt;= 30;&lt;BR /&gt;effect spl = spline(X Y / degree=2);&lt;BR /&gt;model Shot_Made(event='Made') = spl / SCALE=NONE AGGREGATE;&lt;BR /&gt;effectplot contour / showCLegend;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2016/06/22/sas-effectplot-statement.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2016/06/22/sas-effectplot-statement.html&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2019/02/11/proc-plm-regression-models-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2019/02/11/proc-plm-regression-models-sas.html&lt;/A&gt;</description>
      <pubDate>Wed, 03 Apr 2024 08:52:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Plotting-Restricted-Cubic-Spline-Predicted-Probability/m-p/922682#M363326</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-04-03T08:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting Restricted Cubic Spline: Predicted Probability</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Plotting-Restricted-Cubic-Spline-Predicted-Probability/m-p/923028#M363414</link>
      <description>&lt;P&gt;Thank you for your response.&lt;/P&gt;&lt;P&gt;It seems I'm able to plot the predicted probabilities of my model using Proc PLM and EFFECTPLOT. The code I am using is:&lt;/P&gt;&lt;PRE&gt;proc logistic data = have;
effect spl= spline(surgeries/ details naturalcubic basis=tpf(noint) knotmethod=percentiles(4));
class sex cardiac_anomaly/ param =ref;
model blood_transfusion (event ='1') = surgeries age sex cardiac_anomaly spl;
store Model;
run;

proc plm source = Model;
effectplot fit (x=surgeries)/ at (sex ='0' cardiac_anomaly ='0');
run;&lt;/PRE&gt;&lt;P&gt;I would appreciate any feedback on my model; the way I understand it, is that the cubic spline regression predictions are plotted, showing trends within my data. I am unable to share my plots unfortunately, but they do ressemble those in:&amp;nbsp;&lt;A href="https://blogs.sas.com/content/iml/2016/06/22/sas-effectplot-statement.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2016/06/22/sas-effectplot-statement.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2024 18:33:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Plotting-Restricted-Cubic-Spline-Predicted-Probability/m-p/923028#M363414</guid>
      <dc:creator>Bumble_15</dc:creator>
      <dc:date>2024-04-04T18:33:23Z</dc:date>
    </item>
  </channel>
</rss>

