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

Hello, 

 

I would like to create a basic scatter plot after a fixed effects regression. I am using PROC GLM for the FE regression. Best would be to add an effectplot line to the my code, as such:

proc glm data=individuals;
class year (ref='2010' ) age_gr (ref='0' );
absorb id;
model cost=year|type/ solution;
effectplot fit / obs;
run;

but effectplot doesn't seem to work with GLM.  What are my other options?

 

Thank you.  

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

I don't know what a good plot is, you still haven't really described what you hope to see/learn here.


The problem with the EFFECTPLOT is that is only defined for a single X-variable, but your model has two X-variables, plus an ABSORB variable. You can't plot just one variable of the model, you have to determine what you want to do about the other variables in the model (plus the ABSORB variable) in order to get anything meaningful. When there's more than one X-variable, as you have, usually people don't plot the actual data on a scatterplot, they plot the model residuals as the y-variable on a scatterplot.

--
Paige Miller

View solution in original post

5 REPLIES 5
PaigeMiller
Diamond | Level 26

@GKati wrote:

Hello, 

 

I would like to create a basic scatter plot after a fixed effects regression.

 


Scatter plot of what?

 

Have you looked at ODS Graphics to see if the plot you want is already in there?

--
Paige Miller
GKati
Pyrite | Level 9

Hi @PaigeMiller :

 

I would like a scatterplot of cost vs type with a regression line and 95% CIs. Sort of like the graph attached. WFKReg5-1024x768

 

I know that this can be generated by adding the line

effectplot fit / obs;

 to my code above.

 

The problem is that I need to perform a Fixed Effects and using PROC GLM is the only way I know how to do that and PROC GLM doesn't support the effectplot command. 

 

K. 

PaigeMiller
Diamond | Level 26

So the example plot you show doesn't really fit the analysis you are doing, as far as I can see.


So in the scatterplot you want, please be specific. What is the X-axis variable? What is the Y-axis variable? What are the lines on the plot, relative to the variables you have?

--
Paige Miller
GKati
Pyrite | Level 9
The X- axis variable should be type, the y-axis variable should be cost. What would be a more appropriate plot in your opinion?
PaigeMiller
Diamond | Level 26

I don't know what a good plot is, you still haven't really described what you hope to see/learn here.


The problem with the EFFECTPLOT is that is only defined for a single X-variable, but your model has two X-variables, plus an ABSORB variable. You can't plot just one variable of the model, you have to determine what you want to do about the other variables in the model (plus the ABSORB variable) in order to get anything meaningful. When there's more than one X-variable, as you have, usually people don't plot the actual data on a scatterplot, they plot the model residuals as the y-variable on a scatterplot.

--
Paige Miller

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 1014 views
  • 0 likes
  • 2 in conversation