BookmarkSubscribeRSS Feed
rhampton16
Fluorite | Level 6

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:

rhampton16_0-1714093022011.png

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?

4 REPLIES 4
Ksharp
Super User
Did you try LSMESTIMATE ,not ESTIMATE ?
rhampton16
Fluorite | Level 6
I believe that's just for means from CLASS variables, no? I'm looking at simple slopes.
PaigeMiller
Diamond | Level 26

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:

PaigeMiller_0-1714126067346.png

 

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.

--
Paige Miller
StatDave
SAS Super FREQ

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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 4 replies
  • 615 views
  • 4 likes
  • 4 in conversation