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

I have a question about calculating the simple slopes in a proc mixed solution with multiple class variables interacting with a continuous variables. Because of how these class variables are dummy coded, a class*class*continuous variable interaction has left me a little cautious on how to add the SAS output. 

 

Let's say I have a Dependent Variable A and Independent variables X that is continuous and Y and Z that are class variables. Some easy coefficients as they would appear in SAS output are shown below:

 
X  =  5 - this is at Y3*Z3 because of the dummy coding, that is, the b slope of A = bX + intercept is 5 a when in condition Y3 and Z3. 
 
X*Y1 = 2   - this would be change from X at Y3 and Z3, so 7 would be the b slope when in condition Y1 and Z3
X*Y2 = 1 - this would be 6
X*Y3 =  NA - this should be 5
 
X*Z1 = -2  - as above
X*Z2 = -1
X*Z3 = NA - this should be 5
 
This is where the confusion comes, calculating the simple slopes:
 
X*Y1*Z1 = -.5   - Is this the change from X*Y1 or the change from X*Y3?
X*Y1*Z2 = -.6   - So should this be (5 - .6) = 4.4?,   5 + (2 - .6) = 6.6 or (5 + 2) - .6 = 6.6?  I know the last 2 are the same, just curious about how they are supposed to be combined. 
X*Y1*Z3 = NA - This should be X at Y1 or 5+2=7
 
So effectively I am trying to calculate/understand what the b slope of A = bX + intercept is at Y1 and Z1 plus the other 3 conditions to compare and plot the relationship between X and A at different combinations of Y and Z. 
1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Is the question that you want to understand these coefficients and maybe even do "pencil and paper" calculations?

 

Or is the question that you want to take this model and do predictions and generate plots that could show the slopes computed by the model? Because in this case, you could use PROC PLM to get all of the information about the model.

--
Paige Miller

View solution in original post

5 REPLIES 5
PaigeMiller
Diamond | Level 26

Is the question that you want to understand these coefficients and maybe even do "pencil and paper" calculations?

 

Or is the question that you want to take this model and do predictions and generate plots that could show the slopes computed by the model? Because in this case, you could use PROC PLM to get all of the information about the model.

--
Paige Miller
rhampton16
Fluorite | Level 6
I guess I would say both. Ultimately, it looks like PROC PLM will get me what I need for reporting the slopes computed by the model but it would also help to know what's going on under the hood so that I could verify with "pencil and paper" calculations if I feel that something is not as it should be. Typically with procedures I'm not familiar with I like to have this option until I get a little practice in. Thanks for this reference!
PaigeMiller
Diamond | Level 26

I understand why you say both ... my opinion is different (but that's not to say you are wrong).

 

There was a time in my life where I could take the model outputs with class variables and make sense of them, but that was a long time ago, and I'm not sure I can explain them now, or that I would even try. With PROC PLM and other tools, my position now is that I can DRAW pictures of the slopes of interest, and see how they vary as the class variable levels change, and this lets me interpret the model easier and quicker than trying to understand the printed estimates in the PROC MIXED output. If anything doesn't look right in the plots, then this is an indication that maybe I specified the model incorrectly (I no longer think that it is SAS doing the wrong calculations). The plots also allow me to explain the model to others.

--
Paige Miller
rhampton16
Fluorite | Level 6
Oh certainly, and I definitely appreciate the use of PLM and will be sure to utilize it. It's less so that I think that SAS has done something wrong and moreso that I suspect that I have put something in the syntax incorrectly or, as you suggested, specified the model incorrectly. Fortunately, given my familiarity with the data set I'm currently using, I should be able to reverse engineer the algebra that PROC PLM uses.

I'll be sure to post it here if/when I figure it out, thanks again!
rhampton16
Fluorite | Level 6

Actually now I'm not sure it will as LSMEANS/LSMESTIMATE/SLICE all work only on interactions that only include CLASS variables whereas I am trying to calculate a continuous relationship of one IV to the DV at different levels of other CLASS level IVs. Am I reading the Help Center info incorrectly about these statements? I know that I've tried to use LSMEANS before and it won't work, but I thought SLICE might be different. I'll update my post to be more clear. 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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
  • 5 replies
  • 1300 views
  • 0 likes
  • 2 in conversation