BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
GavinB
Fluorite | Level 6

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;

 

 

Capture.PNGCapture2.PNG

 

 

 

 

Kind regards,

Gavin

1 ACCEPTED SOLUTION

Accepted Solutions
GavinB
Fluorite | Level 6

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 Man Wink

View solution in original post

2 REPLIES 2
sld
Rhodochrosite | Level 12 sld
Rhodochrosite | Level 12

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

https://www.crcpress.com/Generalized-Linear-Mixed-Models-Modern-Concepts-Methods-and-Applications/St...

 

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

GavinB
Fluorite | Level 6

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 Man Wink

sas-innovate-2024.png

Available on demand!

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

 

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