Dear community,
I have a dataset with three variables, in which I ran a multiple regression model with one criterion/RMET and two predictors LIT and POP.
I would like a scatter plot + regression line for both predictors, in the same graph.
So far I have been unable to do so using REG or SGPLOT. The latter allows to have grouped data, so that if I wanted to plot, say, the RMET/Literary regression line for men vs. women, I could easily do so, and even color them differently. But that is not what I want.
I would like one graph with RMET in the y axis, and both LIT and POP on the x axis (they are both standardized vars), with say a blue scatter and reg line for LIT and a red scatter and reg line for POP.
I attach the datafile in excel format.
Thanks in advance.
Eman
Suggestions?
2 predictors and 1 dependent variable is a 3 dimension problem. The predictors are used as pairs, i.e. coordinates from a plane, the result is a third dimension.
So if you can't draw one by hand and show us what you think you want this to look like you are likely out of luck unless you have access to Proc G3D.
You can overlay graphs with two different X variables:
Proc sgplot data=yourdata;
scatter x=predictor1 y=result ;
scatter x=predictor2 y=result;
run;
Or Series or other plots.
Interpretation? I don't know.
2 predictors and 1 dependent variable is a 3 dimension problem. The predictors are used as pairs, i.e. coordinates from a plane, the result is a third dimension.
So if you can't draw one by hand and show us what you think you want this to look like you are likely out of luck unless you have access to Proc G3D.
You can overlay graphs with two different X variables:
Proc sgplot data=yourdata;
scatter x=predictor1 y=result ;
scatter x=predictor2 y=result;
run;
Or Series or other plots.
Interpretation? I don't know.
Thank you!
Read this article to understand why your description will not actually work:
"Visualize multivariate regression models by slicing continuous variables"
What most people do is to create a sliced fit plot in which you set the value of one predictors (often to the mean value) and then plot the predicted response as a function of the second predictor. SAS helps with this task: Use the SLICEFIT option in the EFFECTPLOT statement, which is supported in several regression procedures.
Thank you Rick.
For a simple plot of the two predictors on the same graph, the solution with SGPLOT reported above works. Of course, as noted, this is not the same as reporting the results of a multiple regression, for which I will be reading the documents you shared.
Eman
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.