BookmarkSubscribeRSS Feed
ehowie
Calcite | Level 5

Does anyone know how to create linear combinations using proc mixed or plm? In Stata, the syntax is lincom.

For example, if you were to model the change in gallons of ice cream consumed for 6 months in a particular population, with data collected at each month. Contrast and lsmestimates can be used to compare the predicted means for each month (ie ice cream at 1 vs 2 months), but how can I test if the change from 1 to 2 months is different from the change from 2 to 3 months. The basic model would be:

proc mixed data=heatwave;

class id month;

model icecream=month;

random int /subject=id;

run;

2 REPLIES 2
SteveDenham
Jade | Level 19

LSMESTIMATES are additve, so for your example, in GLIMMIX, I would have something like:

proc glimmix data=heatwave;

class id month;

model icecream=month;

random month/residual type=ar(1) subject=id;

random int / subject=id;

lsmestimate month 'Month 2 minus Month 1' -1 1 0 0 0 0,

                             'Month 3 minus Month 2' 0 -1 1 0 0 0,

                             'Difference' 1 -2 1 0 0 0;

run;

In this case, I just subtracted the first line from the second.  This could be extended as needed.

Steve Denham

Message was edited by: Steve Denham

ehowie
Calcite | Level 5

Aha! I knew it had to be something simple. Thanks!

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!

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