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

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?

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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.

View solution in original post

4 REPLIES 4
ballardw
Super User

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.

emaneman
Quartz | Level 8

Thank you!

Rick_SAS
SAS Super FREQ

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.

 

emaneman
Quartz | Level 8

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 

SAS INNOVATE 2024

innovate-wordmarks-white-horiz.png

SAS is headed back to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team.

Interested in speaking? Content from our attendees is one of the reasons that makes SAS Innovate such a special event!

Submit your idea!

What is Bayesian Analysis?

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 4 replies
  • 296 views
  • 0 likes
  • 3 in conversation