I am analyzing data from a multi-location trial (5 locations) to test the effectiveness of a treatment with 2 levels.
The design is RCB with 3-4 replications in every location.

I use the model below:

proc mixed data=mydata;
class location rep trt ;
model Y=trt/ddfm=kr2 residual;
random location rep(location ) trt(location );
lsmeans trt/pdiff;
estimate "Improved vs Control at loc1" trt -1 1 | trt(location ) -1 1 0 0 0 0 0 0 0 0;
estimate "Improved vs Control at loc2" trt -1 1 | trt(location ) 0 0 -1 1 0 0 0 0 0 0 ;
estimate "Improved vs Control at loc3" trt -1 1 | trt(location ) 0 0 0 0 -1 1 0 0 0 0 ;
estimate "Improved vs Control at loc4" trt -1 1 | trt(location ) 0 0 0 0 0 0 -1 1 0 0 ;
estimate "Improved vs Control at loc5" trt -1 1 | trt(location ) 0 0 0 0 0 0 0 0 -1 1 ;
estimate "Improved vs Control across locations" trt -5 5 | trt(location ) -1 1 -1 1 -1 1 -1 1 -1 1/divisor=5 ;

I am interested in the trt effect across locations (that is why I used the random effects in the random statement).
The last estimate statement was used as a test to see if I would get exactly the same results with the LSMEANS.
But although the estimates are the same, the standard errors are different.

I thought they should be the same. Why the standard errors (and p-values) are different?
Does LSMEANS and ESTIMATE with random effect test something different?

Since I am interested in the trt difference across the locations (locations as random effect), which result should I choose?

Thank you
Thank you hlsmith.
I will read it thoroughly because I really need to understand the difference.
It appears that LSMEAN compute the treatment effect across locations differently than the ESTIMATE (BLUP). I don't think I am doing something wrong, I follow the examples in chapter 6 in SAS for Mixed Models, second edition from Littel et al.

Do LSMEANS account for random effects the same way as the ESTIMATE? If not, how should I interpret the results?

I need to understand how they differ and which one is the correct result for narrow and broad inference in a mixed model.



Less is more. Stay pure. Stay poor.
I get you wanting to know why - we should always know what we are doing! Just curious how different the results are?
I need to know why they are different. If the above BLUP estimate is the inference across the 5 locations, what is the LSMEANS then?
Don't LSMEANS take into account the random effects and produce estimate of fixed effects across the 5 locations? That is what I thought.
So which one should I report?

There has to be an explanation (or me making a mistake in the model), it is just not obvious to me.


Less is more. Stay pure. Stay poor.
Well if you are getting the same estimate but the SEs are different, they are just calculating them differently - the SEs. So they are estimating the same effect but are using a different formula for SEs. I see you posted this on SAS Communities - if they can't answer it who can? Well if you give them a bump and reasonable time and you don't get a resolve, I would email the author of the book you referenced or just give SAS a call. I have never done that, but I know people do call them with analytic questions. I am still curious how different the SE's are? is it a trivial amount?
Thank you hlsmith for your thoughts and interest on this. I will try to email the author of the book, there is no reply to my post on SAS Communities.

The std error for LSMEANS is 1.01 (p-value=0.0197) and for the BLUP is 0.83 (p-value=0.0005). The issue is that in another dataset, the difference might be around the 5% significance level and will make it difficult to be sure what to report.

I believe that the estimate statement should give exactly the same result with the LSMEANS. Maybe that is what I am doing wrong, not specifying the estimate statement correctly.