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

Dear all,

I have a couple of questions regarding plotting results of a multiple regression using PROC REG.

 

PROC REG; MODEL DV = A  B;

 

1. I can obtain the partial observed residual plot for variable A and B using the /PARTIAL option in the model statement, but I cannot obtain a partial plot for, say, A, where the criterion (on the y-axis) is on the scale of the original DV. Could i get that?

 

2. The same /PARTIAL option described above produces the plot with data points and the regression line, but not confidence interval bands (which PROC REG produces automatically in the plot of a simple regression). Is there a way to obtain that?

 

Many thanks in advance for your help and suggestions.

 

Eman

1 ACCEPTED SOLUTION

Accepted Solutions
emaneman
Pyrite | Level 9

1. Silly me

2. Terrific, thank you!

View solution in original post

3 REPLIES 3
Rick_SAS
SAS Super FREQ

As stated in the documentation

 the partial regression leverage plot is the plot of ...the residuals for the dependent variable against the residuals for the selected regressor, where the residuals for the dependent variable are calculated with the selected regressor omitted, and the residuals for the selected regressor are calculated from a model where the selected regressor is regressed on the remaining regressors.

 

1. This explains why you are not seeing the "scale of the original DV."  By definition, residuals are for the OLS model will be centered about 0, and the range of the residuals will reflect the scale of the error terms, not the scale of the original variables.

2. Yes, you can get confidence bands. If you use the PARTIALDATA option on the MODEL statement, you will get a table of the various residuals that are used to create the plots. You can use ODS OUTPUT to write the residuals to a SAS data set, then call PROC REG a second time to perform the regression and create the fit plots. Here is an example that uses the Sashelp.Class data:

proc reg data=sashelp.class;
model weight = height age / partial partialdata;
ods exclude PartialPlotData;
ods output PartialPlotData=PD;
quit;

proc reg data=PD plots(only)=fitplot;
'Intercept': model part_Weight_Intercept = part_Intercept;
'Height'   : model part_Weight_Height = part_Height;
'Age'      : model part_Weight_Age = part_Age;
run;

 

emaneman
Pyrite | Level 9

1. Silly me

2. Terrific, thank you!

emaneman
Pyrite | Level 9

Follow up re #2:

 

I would like to do the use the "ODS output partialplotdata=PD" with PROC LOGISTIC, since in this case too I have multiple predictors, but in the ODS table for PROC LOGISTIC I cannot find an equivalent. Is there a way to do this?

 

My ultimate goal is to be able to produce a graph in which I can represent, using different colours, the partial effect of the same predictor on two different DVs. 

 

Specifically, I am testing two PROC LOGISTIC:

 

proc logistic data=covid ; model close2 (event='1') = policy close1 identif ctrlvar2;

proc logistic data=covid ; model distant2 (event='1') = policy distant1 identif ctrlvar2;

 

Using the "plots=effect (clband=yes)" I can obtain the graph attached.  What I would like to do, however, is to produce one single graph displaying the the partial effect of policy on close2 and distant2 using, say the color RED for close2 and the color BLUE for distant2. 

 

Am I asking too much?

 

Screenshot 2021-10-28 at 16.54.10.png

 

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 537 views
  • 0 likes
  • 2 in conversation