BookmarkSubscribeRSS Feed
Lyson
Obsidian | Level 7

Hi friends,

I am trying to estimate a linear mixed model for treatments arranged in CRD using SAS using proc mixed or proc glimmix. I have 3 categorical factors A, B and C where factor C is assumed random, and A,B are fixed. My data set looks like this:

Lyson_0-1721308307376.png

 

The  syntaxes that I am exploring are:

a) PROC GLIMMIX

proc glimmix data=FFRgroup outdesign=XZ;;
class factorA factorB factorC  groupA groupB groupC rep;
model yield= groupA | groupB / ddfm=satterthwaite;
random factorC factorA*factorC  factorB*factorC factorA*factorB*factorC /  V;
lsmeans groupA | groupB   / pdiff cl alpha=0.05 ;
Title "FFR Model";
run;

whch displays the following V matrix,

Lyson_2-1721307720866.png

 

b) PROC  MIXED:

proc mixed data=FFRgroup ;
class factorA factorB factorC  groupA groupB groupC rep;
model yield= groupA | groupB / ddfm=satterthwaite;
random factorC factorA*factorC  factorB*factorC factorA*factorB*factorC /  V;
lsmeans groupA | groupB   / pdiff cl alpha=0.05 ;
Title "FFR Model";
run;

displays the following V matrix,

Lyson_3-1721307827866.png

What could be the problem with these two approaches not producing the covariance structure that aligns with the model in question (block diagonal)? 

 

Thank you in advance for your assistance folks.

7 REPLIES 7
jiltao
SAS Super FREQ

If you rewrite your RANDOM statement below --

random factorC factorA*factorC  factorB*factorC factorA*factorB*factorC

to the one that makes the model to be processed by subjects and is more numerically efficient --

random int factorA  factorB factorA*factorB / subject=factorC v;

in both procedures, then you would probably see the V option displaying the first block (for the first level of FACTORC) of the variance covariance matrix. Do the two procedures give you the same output for the V matrix?

Also the values in the output you show from PROC MIXED look unusually large to me. What do you see in the Log from PROC MIXED? It might be a good idea to examine the logs from both procedures first.

Thanks,

Jill

 

Lyson
Obsidian | Level 7

Hi Jill

 

Thanks for the response. However, I have run both PROC MIXED and PROC GLIMMIX, but the result hasn't changed. I still get a diagonal matrix with single values, part of which is pasted below:

Lyson_0-1721323265869.png

Kindly clarify on the "Log" issue. I do not understand.

Mike_N
SAS Employee

When you use the V option of the random statement in either Proc Glimmix or Proc Mixed, the default behavior is to print out the first (single) block from the V matrix, not the whole block diagonal matrix. However, both procedures are still using block diagonal V. Note that blocks are usually defined by using the subject= option within the random statement. See here SAS Help Center: RANDOM Statement and here SAS Help Center: RANDOM Statement for more details about how to use the subject= statement to specify the blocks of V. 

Lyson
Obsidian | Level 7
Hi Mike,

As suggested by Jil, I have used the following code:
proc mixed data=FFRgroup ;
class factorA factorB factorC groupA groupB groupC repA repB repC;
model yield= groupA | groupB / ddfm=satterthwaite;
random int factorA factorB factorA*factorB/subject=factorC v;
lsmeans groupA | groupB / pdiff cl alpha=0.05 ;
Title "FFR Model";
run;

And the results are as follows:
Lyson
Obsidian | Level 7

Lyson_0-1721324780269.pngLyson_1-1721324834044.pngLyson_2-1721324870694.png

V still diagonal though,,,,

Lyson_3-1721324953491.png

Fixed effects look good...

Lyson
Obsidian | Level 7

Hi Jil & Mike,

 

I have created another variable "repA" through "repC" to capture the replications in each treatment cell, e.g., in the first cell I recorded "1, 1, 1, 1, 1" for the five replications in each of the rep variables. Then I had to define the "subject = " statement with  repC, the random variable. Is this in order? the data set, code and output are as shown below:

Lyson_0-1721325610560.png

proc mixed data=FFRgroup ;
class factorA factorB factorC groupA groupB groupC repA repB repC;
model yield= groupA | groupB / ddfm=satterthwaite;
random int factorA factorB factorA*factorB/subject=repC v;
lsmeans groupA | groupB / pdiff cl alpha=0.05 ;
Title "FFR Model";
run;

Lyson_1-1721325761653.pngLyson_2-1721325807377.pngLyson_3-1721325874630.pngLyson_4-1721325911225.png

Looks like the V matrix is still a diagonal matrix by default in PROC mixed, as highlighted by Mike.

Mike_N
SAS Employee

Your subject effect, FactorC, has one distinct level. All 120 observations have the value 'ra'. The subject= part of your model is not specified correctly. The documentation links above should help get you back on the right track.   

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 7 replies
  • 133 views
  • 2 likes
  • 3 in conversation