- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 03-02-2024 05:45 PM
(1148 views)
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
R is a free software that may show it nicer: https://search.r-project.org/CRAN/refmans/Hmisc/html/rcspline.plot.html
If you install R, their forum is this:
https://community.rstudio.com/
If you install R, their forum is this:
https://community.rstudio.com/
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the recommendation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I think you should consider EFFECTPLOT statement of PROC PLM to get visualizing.
Check @Rick_SAS blogs:
https://blogs.sas.com/content/iml/2016/06/22/sas-effectplot-statement.html
https://blogs.sas.com/content/iml/2019/05/30/visualize-interaction-effects-regression.html
https://blogs.sas.com/content/iml/2018/12/19/visualize-mixed-model.html
https://blogs.sas.com/content/iml/2016/03/21/statistical-analysis-stephen-curry-shooting.html
https://blogs.sas.com/content/iml/2019/02/11/proc-plm-regression-models-sas.html
Check @Rick_SAS blogs:
https://blogs.sas.com/content/iml/2016/06/22/sas-effectplot-statement.html
https://blogs.sas.com/content/iml/2019/05/30/visualize-interaction-effects-regression.html
https://blogs.sas.com/content/iml/2018/12/19/visualize-mixed-model.html
https://blogs.sas.com/content/iml/2016/03/21/statistical-analysis-stephen-curry-shooting.html
https://blogs.sas.com/content/iml/2019/02/11/proc-plm-regression-models-sas.html