Good point, @jiltao about the standard errors. Let me talk a bit about the study. It is an AB/BA cross-over for non-inferiority in dogs. Due to the sample size, it was run in two rooms, so regulatory science requires room as a random effect - and I can't remove it. The other factors in the model are typical for the design.
Rather than using an autoregressive structure with a random subject effect, the following code uses a Cholesky factorization for an unstructured matrix ,which should eliminate the random intercept for subject. Now, the two methods still give different log likelihoods, but at least the lsmeans and standard errors differ. All covariance parameters are estimated as are their standard errors.
Here is the code:
proc glimmix data=two; * order=data;
class subject room sequence period treatment;
model lauctlast=treatment period sequence/ ddf=32,32,32;
random intercept /subject=room;
random period/subject=subject(room) residual type=chol;
lsmeans treatment / diff=controll cl;
ods output lsmeans=lsmlsauctlast diffs=difflsauctlast;
run;
proc glimmix data=two;* order=data;
class subject room sequence period treatment;
model lauctlast=treatment period sequence/ ddf=32,32,32;
random intercept /subject=room;
random _residual_/subject=subject(room) type=chol ;
lsmeans treatment / diff=controll cl;
ods output lsmeans=lsmlsauctlast2 diffs=difflsauctlast2;
run;
Again the first glimmix gives 4.40 as -2 res log likelihood, and takes 7 iterations to converge. The second gives 3.12 as -2 res log likelihood and but now also takes 7 iterations. Both have the same generalized chi squared = 68.00. The first yields identical standard errors for the lsmeans (0.07233) while the second yields standard errors that are about 30% larger and differ for the two means (0.09770 and 0.09461). However, the standard errors of the difference between the two means are identical for the two representations. I suspect that using the _residual_ method somehow removes the equality constraint (adds overdispersion), but that is not apparent from the Details in the documentation. My preference is to always specify the repeated factor in the random statement (and in the model). However, this whole experience is causing me a fair amount of confusion.
... View more