Before I realized PROC PLM was a thing for getting simple slopes, I was taught how to get them from the proc mixed output by combining the estimates available there. I'm now noticing that one estimate is consistently different.
Let's say we have data A B and M, where A is categorical with 2 levels, B is categorical with 2 levels, and M is continuous.
I want to get the slope for M at:
A1B1
A2B1
A1B2
A2B2 (reference)
The default reference for categorical is the last value so A2B2 is the reference. If you calculate by hand from the solution for fixed effects, the values are the same for A2B2, A2B1, and A1B2 but wildly different for A1B1 and I can't for the life of me figure out why. For example:
A2B2 is -.2300 (same in PLM)
A2B1 is -.2300 + 1.4324 = 1.2033 (1.2024 in PLM)
A1B2 is -.2300 + .4836 = .2555 (.2535 in PLM)
using the same method, A1B1 would be -.2300 + -1.3125 = -1.542
using PLM, A1B1 is .3735
Here's my syntax for the estimates:
estimate 'medinc x Target1 x stim1' medinc 1 medinc*target 0 1 medinc*stim 0 1 medinc*target*stim 0 0 0 1,
'medinc x Target1 x stim2' medinc 1 medinc*target 0 1 medinc*stim 1 0 medinc*target*stim 0 0 1 0,
'medinc x Target2 x stim1' medinc 1 medinc*target 1 0 medinc*stim 0 1 medinc*target*stim 0 1 0 0,
'medinc x Target2 x stim2' medinc 1 medinc*target 1 0 medinc*stim 1 0 medinc*target*stim 1 0 0 0 /e;
Does anyone understand the difference? What is the value in the solution for A1B1 if not the comparison to the joint reference?
The default reference for categorical is the last value so A2B2 is the reference. If you calculate by hand from the solution for fixed effects, the values are the same for A2B2, A2B1, and A1B2 but wildly different for A1B1 and I can't for the life of me figure out why. For example:
A2B2 is -.2300 (same in PLM)
A2B1 is -.2300 + 1.4324 = 1.2033 (1.2024 in PLM)
A1B2 is -.2300 + .4836 = .2555 (.2535 in PLM)
using the same method, A1B1 would be -.2300 + -1.3125 = -1.542
using PLM, A1B1 is .3735
Your calculations for A1B1 are incorrect. It should be -0.2300+1.4324+0.4836-1.3125 = .3735, same as PLM.
This will be much easier if you rewrite the model into an equivalent form. Create a single variable, AB, with 4 values. Then write the model as:
class ab; model <your-response>=ab ab*m / noint <other-options>;
The AB parameters are then the intercepts for each group and the AB*M parameters are the group slopes. No need for ESTIMATE statements. If you want to test for equality of slopes or to compare group slopes, then see this note that shows how.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.