I have data from a randomized block design with 2 treatments and 4 blocks. Each block has unequal size of subjects: only 1 subject for treatment A and a different number of subject from treatment B for each of the 4 blocks. I need to generate a graph showing the mean and error bar for each treatment group. I used the following code:
proc glm;
class trt block;
model outcome=trt block;
lsmean trt/stderr;
run;
I then use the lsmean and stderr to generate a bar graph for treatment A and B. However, it gave me a pause when I saw the stderr generated by this model for treatment A is almost 3 times higher than the raw data using proc mean (var outcome; where trt='A';), for which I only have 1 pt per block. Is my glm model correct? I think for my bar graph I should use the SE from proc means. Any insight would be greatly appreciated.
Without going into how to fit an RCBD, I will take a swing at the large standard error that gets reported for treatment A. It comes down to the assumption of homogeneous variances that underlies GLM. GLM uses the pooled root mean squared error to calculate the standard errors, which may not be appropriate in a design where you treat BLOCK as a fixed effect, and the number of observations per block is unequal. Work through the first and third examples for PROC GLM in the SAS documentation. The first is for the analysis of an RCBD, the third is for an unbalanced ANOVA for a two-way design.
SteveDenham
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.