Quartz | Level 8

## plotting same criterion, two predictors

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.

Eman

Suggestions?

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

## Re: plotting same criterion, two predictors

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.

4 REPLIES 4
Super User

## Re: plotting same criterion, two predictors

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.

Quartz | Level 8

Thank you!

SAS Super FREQ

## Re: plotting same criterion, two predictors

"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.

Quartz | Level 8

## Re: plotting same criterion, two predictors

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

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