BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ChristosK
Quartz | Level 8

Rick:

 

Thank you for the link and suggestions. I have been doing a logistic regression with only one continuous variable being a spline.

The Univariate  code is as follows:

ods select ModelANOVA ParameterEstimates SplineKnots;
proc logistic data=HEERDT.VPICU_label;
  effect spl = spline(Ind_DBP1 / details naturalcubic basis=tpf(noint)                 
                               knotmethod=percentiles(5) ); /* fit model by using spline effects */
  model Vent__240(reference ='0')= spl / ct covb clodds=wald   selection=none;
  output out=SplineOut  predicted=Fit lower = l upper = u;    /* output predicted values for graphing */
  effectplot fit;
run;
proc sort data =SplineOut; by Ind_DBP1; run; 
proc sgplot data = SplineOut;
band x=Ind_DBP1 lower=L upper=U;
series x = Ind_DBP1 y = fit/ curvelabel = "Predicted value";
series x = Ind_DBP1 y = u/ curvelabel = "Upper CI";
series x = Ind_DBP1 y = l/ curvelabel = "Lower CI";
run;

 I tried some of your suggestions, but since you were using gym, and only had single lines rather than 95% CI's as well, I got a bit confused and was not able to get it to work.

Initially I just added multiple covariates, ands this worked fine when running loess in proc sgplot, but with series there were alot of jagged lines for all the reasoned you had mentioned.

 

 

I tried various iterations of slice fit:

ods select ModelANOVA ParameterEstimates SplineKnots;
proc logistic data=HEERDT.VPICU_label;
  effect spl = spline(Ind_DBP1 / details naturalcubic basis=tpf(noint)                 
                               knotmethod=percentiles(5) ); /* fit model by using spline effects */
  class Sex(ref="F")Race_d (ref="C")/param=ref;
  model Vent__240(reference ='0')= spl Sex Age 
/*    Race_d CABG ACEI ARB Statin1 BMI NIDDM1  BB  pre_Cr pre_K*/
/ ct covb clodds=wald   selection=none;
  output out=Splineout  predicted=Fit lower = l upper = u;    /* output predicted values for graphing */
  effectplot slicefit / at (Sex ='F' Age=50);
run;
proc sort data =SplineOut; by Ind_DBP1; run;
 
proc sgplot data = SplineOut ;
band x=Ind_DBP1 lower=L upper=U;
series x = Ind_DBP1 y = fit/ curvelabel = "Predicted value";
series x = Ind_DBP1 y = u/ curvelabel = "Upper CI";
series x = Ind_DBP1 y = l/ curvelabel = "Lower CI";
run;

The only difference I see between your examples and what I am modeling is that you had a continuous dependent variable and that I was generating predicted probabilities out of a logistic regression. And that I was plotting confidence intervals, Adding anything my univariate model created jagged edges because this was being modeled on the actual values I guess rather than an an estimate of what these should be by the model.

 

If this was not entertaining enough, I am also trying to get a way to  get odds ratios for pr-specifiued levels of the  continuous exposure that is splined, comparing the odds of that level to the mode. It seems to be easy in Stada and R but not SAS. Any idea ?

Rick_SAS
SAS Super FREQ

Here's an example for PROC LOGISTIC to get you started.

 

 

data cars;    /* create example data */
set sashelp.cars;
where type^='Hybrid' & cylinders in (4,6,8);
run;
 
ods graphics / attrpriority=none;     /* groups determine symbols and line patterns */
 
proc logistic data=cars;
effect spl = spline(mpg_city / details naturalcubic basis=tpf(noint)                 
                               knotmethod=percentiles(5) ); 
class cylinders type / param=ref;
model origin = spl cylinders type weight engineSize;
effectplot slicefit (X=mpg_city) / clm ilink 
                                   at(cylinders='4'
                                      type='Sedan'
                                      weight=MEAN
                                      engineSize=MEAN);
oddsratio cylinders;
oddsratio type;
quit;

 

This is complicated stuff, so you might need to reread the articles and the documentation of the EFFECTPLOT statement several times. Also, pay attention to the SAS log. I think you are getting notes that tell you that some of your PROC LOGISTIC syntax is not valid. For example, you are currently fitting a cumulative logistic model, which does not support the REF= and CTABLE options.

 

Your remaining questions seem to be statistical, not graphical. I suggest you close out this thread and if you have questions about odds ratios and logistic models, open a new thread in the Statistical Procedures Community. Good luck!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 16 replies
  • 4951 views
  • 0 likes
  • 3 in conversation