<?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 Utilizing Restricted Cubic Splines with PROC PHREG and Plotting the Results in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Utilizing-Restricted-Cubic-Splines-with-PROC-PHREG-and-Plotting/m-p/741603#M36041</link>
    <description>&lt;P&gt;I am doing survival analysis with proc phreg looking at a continuous nutrient exposure and colorectal cancer as the outcome. I have never performed restricted cubic splines analysis before and tried to find similar SAS posts and incorporate them into my model which I have listed here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc phreg data = want;
title "Colorectal-cancer incidence attempt";

effect resid_total_polys = spline(resid_total_poly / basis=tpf(noint) NATURALCUBIC details knotmethod=percentiles(4));

class categorical_covariate (ref="0");

model eof_age_CRC*Inc_CRC(0) =  resid_total_polys 
		categorical_covariate continuous_covariate
		/ entry=enrollment_agemonths rl=wald;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;First, I am not sure how to best compare the results of the spline models with the model I have done separately by quintiles. Should I compare the -2 Log L of the Global Fit Statistics or just use the P value (Pr &amp;gt;ChiSq) of testing the global null hypothesis output?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second, I would like to be able to plot this data in a meaningful way, but am not sure how to appropriately plot this data or include 95% confidence bars if possible. I would hope it might look something like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fikel_0-1621060478280.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59462iDE3F1C9407C62E88/image-size/medium?v=v2&amp;amp;px=400" role="button" title="fikel_0-1621060478280.png" alt="fikel_0-1621060478280.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="fikel_1-1621060524238.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59463i940E4BD54889B209/image-size/medium?v=v2&amp;amp;px=400" role="button" title="fikel_1-1621060524238.png" alt="fikel_1-1621060524238.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>Sat, 15 May 2021 06:36:10 GMT</pubDate>
    <dc:creator>fikel</dc:creator>
    <dc:date>2021-05-15T06:36:10Z</dc:date>
    <item>
      <title>Utilizing Restricted Cubic Splines with PROC PHREG and Plotting the Results</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Utilizing-Restricted-Cubic-Splines-with-PROC-PHREG-and-Plotting/m-p/741603#M36041</link>
      <description>&lt;P&gt;I am doing survival analysis with proc phreg looking at a continuous nutrient exposure and colorectal cancer as the outcome. I have never performed restricted cubic splines analysis before and tried to find similar SAS posts and incorporate them into my model which I have listed here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc phreg data = want;
title "Colorectal-cancer incidence attempt";

effect resid_total_polys = spline(resid_total_poly / basis=tpf(noint) NATURALCUBIC details knotmethod=percentiles(4));

class categorical_covariate (ref="0");

model eof_age_CRC*Inc_CRC(0) =  resid_total_polys 
		categorical_covariate continuous_covariate
		/ entry=enrollment_agemonths rl=wald;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;First, I am not sure how to best compare the results of the spline models with the model I have done separately by quintiles. Should I compare the -2 Log L of the Global Fit Statistics or just use the P value (Pr &amp;gt;ChiSq) of testing the global null hypothesis output?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second, I would like to be able to plot this data in a meaningful way, but am not sure how to appropriately plot this data or include 95% confidence bars if possible. I would hope it might look something like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fikel_0-1621060478280.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59462iDE3F1C9407C62E88/image-size/medium?v=v2&amp;amp;px=400" role="button" title="fikel_0-1621060478280.png" alt="fikel_0-1621060478280.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="fikel_1-1621060524238.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59463i940E4BD54889B209/image-size/medium?v=v2&amp;amp;px=400" role="button" title="fikel_1-1621060524238.png" alt="fikel_1-1621060524238.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>Sat, 15 May 2021 06:36:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Utilizing-Restricted-Cubic-Splines-with-PROC-PHREG-and-Plotting/m-p/741603#M36041</guid>
      <dc:creator>fikel</dc:creator>
      <dc:date>2021-05-15T06:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: Utilizing Restricted Cubic Splines with PROC PHREG and Plotting the Results</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Utilizing-Restricted-Cubic-Splines-with-PROC-PHREG-and-Plotting/m-p/741666#M36057</link>
      <description>&lt;P&gt;I did some digging and was able to use this code:&lt;/P&gt;&lt;LI-CODE lang="sas"&gt;proc phreg data = want;
title "Colorectal-cancer incidence attempt";

effect resid_total_polys = spline(resid_total_poly / basis=tpf(noint) NATURALCUBIC details knotmethod=percentiles(4));

class categorical_covariate (ref="0");

model eof_age_CRC*Inc_CRC(0) =  resid_total_polys 
		categorical_covariate continuous_covariate
		/ entry=enrollment_agemonths rl=wald;

store work.coxr;
run;

%macro est(ref=212, start=0, end=3000, by=1);

%Do i = 1 %To %eval(%SysFunc( Ceil( %SysEvalF( ( &amp;amp;End - &amp;amp;Start ) / &amp;amp;By ) ) ) +1) ;

   %Let value=%SysEvalF( ( &amp;amp;Start - &amp;amp;By ) + ( &amp;amp;By * &amp;amp;I ) ) ;

    estimate "&amp;amp;value." resid_total_polys [-1, &amp;amp;ref] [1, &amp;amp;value] / exp cl;

    %end;

%mend est;

ods exclude all;

ods dataset Estimates=Estimates;

proc plm restore=work.coxr;

    %est(ref=212, start=0, end=3000, by=1);

run;

ods exclude none;

data estimates;

    set estimates;

    resid_total_poly=label*1;

run;

proc sgplot data=estimates NOAUTOLEGEND Noborder;

    Series y=ExpEstimate x=resid_total_poly / LINEATTRS=(color=black thickness=3px);

    Series y=LowerExp x=resid_total_poly / LINEATTRS=(pattern=ShortDash color=Black THICKNESS=1);

    Series y=UpperExp x=resid_total_poly / LINEATTRS=(pattern=ShortDash color=Black THICKNESS=1);
    
    band x=resid_total_poly upper=UpperExp lower=LowerExp / fillattrs=(color=graydd) transparency=.50;

    REFLINE 1 / axis=y;

    REFLINE 3000 / Axis=X LINEATTRS=(pattern=ThinDot color=Black THICKNESS=1);;

    yaxis Values=(0.5 0.8 1 1.2 1.5) Label="Hazard ratio" Type=LOG LABELATTRS=(weight=BOLD);

    xaxis min=0 VALUES=(0 to 3000 by 100) LABELATTRS=(weight=BOLD);

run;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which created this graph:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fikel_0-1621108094155.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59477i47806ED6D89F615D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="fikel_0-1621108094155.png" alt="fikel_0-1621108094155.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My remaining question would be what output from proc PHREG I should use to compare this to the model by quintiles or the linear model to determine how much better the cubic splines model is. Do I then use this to decide how many knots to use?&lt;/P&gt;</description>
      <pubDate>Sat, 15 May 2021 19:54:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Utilizing-Restricted-Cubic-Splines-with-PROC-PHREG-and-Plotting/m-p/741666#M36057</guid>
      <dc:creator>fikel</dc:creator>
      <dc:date>2021-05-15T19:54:31Z</dc:date>
    </item>
  </channel>
</rss>

