Programming the statistical procedures from SAS

How to include a block factor in ANOVA/ANCOVA model

Reply
Occasional Contributor
Posts: 6

How to include a block factor in ANOVA/ANCOVA model

Hi,

 

I am analyzing data from a randomized block design study. We have two independent variables (Treatment and Site), two covariate and one block factor (categorical). I wonder what is a proper way to set up an ANCOVA model with the block factor. I use SAS EG to do the analyses but I've told that  I may need to modify the code myself to include a block factor. Do I just add one more factor as a classification (independent) variable in Linear Model? How can I make sure that SAS would treat the block variable separately from the two independent variables I have? Below is my code from SAS EG.

 

PROC GLM DATA=work1;
CLASS Treatment Site Block;
MODEL Tb_BVTV= Treatment Site Treatment*Site Block Covariate(1) Covariate (2) / SS3;
LSMEANS Treatment Site Treatment*Site / PDIFF=ALL ADJUST=TUKEY ;
RUN;

 

 

Any advice would be appreciated.

Thank you!

Valued Guide
Valued Guide
Posts: 679

Re: How to include a block factor in ANOVA/ANCOVA model

You really need to switch to MIXED or GLIMMIX for this. See SAS for Mixed Models, 2nd edition (2006). The syntax is a bit different compared with GLM. In particular, you do NOT put random effects in a model statement; random effects are given only in one or more random statements. Based on your description, I think blocks are nested within sites. Thus, there would be no block main effect, but there would be a block(site) effect. The procedure automatically figures everything out that you are concerned about.

PROC MIXED DATA=work1;
CLASS Treatment Site Block;
MODEL Tb_BVTV= Treatment Site Treatment*Site Covariate(1) Covariate (2) / SS3;

random block(site);
LSMEANS Treatment Site Treatment*Site / PDIFF=ALL ADJUST=TUKEY ;
RUN;

Occasional Contributor
Posts: 6

Re: How to include a block factor in ANOVA/ANCOVA model

Thank you for your answer.

 

I wonder if the GLM would still work if I have a control on the blocks I used?

Ask a Question
Discussion stats
  • 2 replies
  • 222 views
  • 0 likes
  • 2 in conversation