BookmarkSubscribeRSS Feed
Adele3
Calcite | Level 5

Hello,

 

I am running a multivariable linear model with restricted cubic splines for my main exposure of interest. I am having difficulty trying to graph the predicted curve of my model, as the predicted value appears very jagged. I have referenced the following SAS post 'Visualize multivariate regression models by slicing continuous variables' (https://blogs.sas.com/content/iml/2017/12/18/visualize-multivariate-regression-models-by-slicing-con...), however to no avail. 

 

Is anyone able to share guidance to help with my visualization? My code is as follows:

 

ODS SELECT ANOVA ParameterEstimates SplineKnots;
PROC GLMSELECT DATA=model3 outdesign(ADDINPUTVARS FULLMODEL)=Splines; 
     EFFECT spl = spline(exp1 / DETAILS naturalcubic BASIS=tpf(noint)                 
                                KNOTMETHOD=percentilelist(5 27.5 50 72.5 95));
     CLASS sex city income;
     MODEL IQ = spl sex city income weight/ SELECTION=none; /* fit model by using spline effects */
     OUTPUT OUT=SplineOut PREDICTED=Fit;   /* output predicted values for graphing */
QUIT;

TITLE "Restricted Cubic Spline Regression";
PROC SGPLOT DATA=SplineOut NOAUTOLEGEND;
     SCATTER x=exp1 y=IQ;
     SERIES x=exp1 y=Fit / LINEATTRS=(THICKNESS=3 COLOR=red);
RUN;
3 REPLIES 3
Adele3
Calcite | Level 5

Thank you for the recommendation. 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 251 views
  • 1 like
  • 3 in conversation