Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Re: Proc glimmix contrasts

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 10-12-2017 06:08 AM
(1530 views)

Dear Reader,

In my model, where treatment is fixed and block is random, there seems to be a different treatment effect for a different set of blocks. Attached you see code where I estimate treatment effects per set of random blocks, and code where I estimate the difference for a set of blocks. The estimates do NOT coincide, meaning that the difference per treatment does not flow from the estimates of a treatment. Any help on explaining this difference would be much appreciated.

```
proc glimmix data=test_Per plots=all;
class TT block;
model Per=TT / s cl ddfm=kenwardroger;
random block / s cl g gcorr;
estimate 'trt=1 @ blocks 1-6' intercept 6 TT 6 0 | block 1 1 1 1 1 1 0 0 0 0 0 0 / divisor=6;
estimate 'trt=2 @ blocks 1-6' intercept 6 TT 0 6 | block 1 1 1 1 1 1 0 0 0 0 0 0 / divisor=6;
estimate 'trt=1 vs trt=2 @ blocks 1-6' TT -6 6 0 0 0 0 0 0 0 0 | block 1 1 1 1 1 1 0 0 0 0 0 0,
'trt=1 vs trt=3 @ blocks 1-6' TT -6 0 6 0 0 0 0 0 0 0 | block 1 1 1 1 1 1 0 0 0 0 0 0,
'trt=1 vs trt=4 @ blocks 1-6' TT -6 0 0 6 0 0 0 0 0 0 | block 1 1 1 1 1 1 0 0 0 0 0 0,
'trt=1 vs trt=5 @ blocks 1-6' TT -6 0 0 0 6 0 0 0 0 0 | block 1 1 1 1 1 1 0 0 0 0 0 0,
'trt=1 vs trt=6 @ blocks 1-6' TT -6 0 0 0 0 6 0 0 0 0 | block 1 1 1 1 1 1 0 0 0 0 0 0,
'trt=1 vs trt=7 @ blocks 1-6' TT -6 0 0 0 0 0 6 0 0 0 | block 1 1 1 1 1 1 0 0 0 0 0 0,
'trt=1 vs trt=8 @ blocks 1-6' TT -6 0 0 0 0 0 0 6 0 0 | block 1 1 1 1 1 1 0 0 0 0 0 0,
'trt=1 vs trt=9 @ blocks 1-6' TT -6 0 0 0 0 0 0 0 6 0 | block 1 1 1 1 1 1 0 0 0 0 0 0,
'trt=1 vs trt=10 @ blocks 1-6' TT -6 0 0 0 0 0 0 0 0 6 | block 1 1 1 1 1 1 0 0 0 0 0 0 / divisor=6 e adjdfe=row adjust=simulate(nsamp=100000);
estimate 'trt=1 vs trt=2 @ blocks 7-12' TT -6 6 0 0 0 0 0 0 0 0 | block 0 0 0 0 0 0 1 1 1 1 1 1,
'trt=1 vs trt=3 @ blocks 7-12' TT -6 0 6 0 0 0 0 0 0 0 | block 0 0 0 0 0 0 1 1 1 1 1 1,
'trt=1 vs trt=4 @ blocks 7-12' TT -6 0 0 6 0 0 0 0 0 0 | block 0 0 0 0 0 0 1 1 1 1 1 1,
'trt=1 vs trt=5 @ blocks 7-12' TT -6 0 0 0 6 0 0 0 0 0 | block 0 0 0 0 0 0 1 1 1 1 1 1,
'trt=1 vs trt=6 @ blocks 7-12' TT -6 0 0 0 0 6 0 0 0 0 | block 0 0 0 0 0 0 1 1 1 1 1 1,
'trt=1 vs trt=7 @ blocks 7-12' TT -6 0 0 0 0 0 6 0 0 0 | block 0 0 0 0 0 0 1 1 1 1 1 1,
'trt=1 vs trt=8 @ blocks 7-12' TT -6 0 0 0 0 0 0 6 0 0 | block 0 0 0 0 0 0 1 1 1 1 1 1,
'trt=1 vs trt=9 @ blocks 7-12' TT -6 0 0 0 0 0 0 0 6 0 | block 0 0 0 0 0 0 1 1 1 1 1 1,
'trt=1 vs trt=10 @ blocks 7-12' TT -6 0 0 0 0 0 0 0 0 6 | block 0 0 0 0 0 0 1 1 1 1 1 1 / divisor=6 e adjdfe=row adjust=simulate(nsamp=100000);
store glimmix_Per;
run;
```

Kind regards,

Gavin

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Well, we managed to figure out what the problem was after quite some time (and a lot of headaches).

The way the code was setup was simply not correct to show the results that I wanted. The design was a randomized complete block design and because of the way a mixed model works (using the entire dataset to estimate variance) – the difference between treatments will always be the same in each of the blocks if you code it like I did above. In order to actually see if treatment differences change due to the positioning in (for this particular dataset) barn, you need to include an interaction effect. This will give the replicated estimates of the treatments that I wanted.

That basically solves the issue

2 REPLIES 2

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

I looked at this not too long after you posted, but didn't see any obvious problem. I've been hoping someone (else) would respond.

If you are inclined, try posting again, including your data set or some variant that produces the same problem. Maybe you'll get a nibble.

If you have not already, you could consult

Edit: Or maybe you solved it already! Then you can post your own solution 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Well, we managed to figure out what the problem was after quite some time (and a lot of headaches).

The way the code was setup was simply not correct to show the results that I wanted. The design was a randomized complete block design and because of the way a mixed model works (using the entire dataset to estimate variance) – the difference between treatments will always be the same in each of the blocks if you code it like I did above. In order to actually see if treatment differences change due to the positioning in (for this particular dataset) barn, you need to include an interaction effect. This will give the replicated estimates of the treatments that I wanted.

That basically solves the issue

**Available on demand!**

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

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.