BookmarkSubscribeRSS Feed
SophieSw
Calcite | Level 5

I have a model with a third order interaction with splines:

class trt sex;

effect spl = spline(age);

model aval = trt|sex|spl

I am looking for a way to get an estimate for the trt*sex interaction effect at specific values for age.

I managed to get an estimate for the effect of either trt or sex at a specific value for age with for instance:

estimate 'Diff trt at sex 1 x= 20' trtn [1,1] [-1,2] trtn*sex [1,1 1] [-1,2 1] trt*spl [1,1 20] [-1,2 20]  trt*sex*spl[1,1 1 20] [-1,2 1 20] /e;

but fail at producing an estimate for the interaction effect.

Help much appreciated!

KR Sophie

6 REPLIES 6
SteveDenham
Jade | Level 19

Have you tried using an LSMESTIMATE statement with the AT option?

For two treatments and two sexes, it would look like:

lsmestimate trt*sex*spl 'Trt diff for sex=1 at age = 20' 1 0 -1 0/at age=20;

and if you have multiple comparisons, more like;

lsmestimate trt*sex*spl 'Trt diff for sex=1 at age = 20' 1 0 -1 0,

                                   'Trt diff for sex=2 at age = 20' 0 1 0 -1/at age=20;

Of course, nonpositional syntax shuch as you have can also be used, but the advantage is in comparing the lsmeans at a given level.

Steve Denham

SophieSw
Calcite | Level 5

Dear Steve,

Many thanks for your responds. Actually I had tried something like this but all my attempts gave the message

ERROR: The constructed effect spl*trtn*SEXN is not a valid LSMESTIMATE effect.

I have two treatments and two sexes so I just tried exactly the code you provided and got the same error message again.

Kind regards, Sophie

SteveDenham
Jade | Level 19

Have you tried:

lsmestimate trt*sex 'Trt diff for sex=1 at age = 20' 1 0 -1 0,

                                   'Trt diff for sex=2 at age = 20' 0 1 0 -1/at age=20;

It appears that you cannot use the constructed effect (or its interactions) in the LSMEANS or LSMESTIMATE statement.  But you might be able to look at the trt*sex interaction, and see what the effect is at various ages by using the AT option.  I am trying to generalize from the documentation--Details: GLIMMIX Procedure> Parameterization of Generalized Linear Mixed Models> Notes on the EFFECT Statement.

Steve Denham

SophieSw
Calcite | Level 5

Dear Steve,

Many thanks for trying to help me. But I still have not what I need because my interest is in the estimate and se for the difference in difference. The extent that the “trt diff for sex = 1” is different from the “trt diff for sex=2” at specific ages. I was already able to get an estimate for the effect of either trt or sex at a specific value for age with for instance:

estimate 'Diff trt at sex 1 x= 20' trtn [1,1] [-1,2] trtn*sex [1,1 1] [-1,2 1] trt*spl [1,1 20] [-1,2 20]  trt*sex*spl[1,1 1 20] [-1,2 1 20] /e;

and indeed, your code

lsmestimate trt*sex 'Trt diff for sex=1 at age = 20' 1 0 -1 0;

works as well

(even though this one fails:

lsmestimate trt*sex 'Trt diff for sex=1 at age = 20' 1 0 -1 0,

                                   'Trt diff for sex=2 at age = 20' 0 1 0 -1/at age=20;)

but what I need is the contrast of 'Trt diff for sex=1 at age = 20' versus 'Trt diff for sex=2 at age = 20’.

Kind regards,

Sophie

SteveDenham
Jade | Level 19

Difference of the differences would be:

lsmestimate trt*sex "Differences between sexes for treatment differences at age = 20' 1 -1 -1 1/at age=20;

Note that this is the first line minus the second line of the previous lsmestimate statement.

Good luck.

Steve Denham

SophieSw
Calcite | Level 5

Dear Steve,

I have used the weekend to try out and double check your suggestion. Everything works perfectly. Many thanks!

Kind regards, Sophie

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 6 replies
  • 1851 views
  • 6 likes
  • 2 in conversation