BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
marcioadg
Calcite | Level 5

I am aware how to do that on GLM, however, if I have random variables in my mixed model, not sure how one account for that on using GLM. So, is there a way to test / check for equal variances in Mixed? Or should one do in GLM without the random variables.

Thank you,

Marcio

1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

There is a way in PROC GLIMMIX, and since about anything that can be done in MIXED can be done in GLIMMIX, I would recommend it.

As an example, suppose you wanted to test if the variances by group_no in the following were homogeneous:

proc glimmix data=somedata;

class group_no;

model response_var=group_no;

random _residual_/group=group_no;

covtest homogeneity;

run;

This will give a likelihood ratio test of the homogeneity of variances over the fixed effect of group_no.  It is not restricted by sample size (as is Levene's test), and will accommodate more complex models as needed.

Steve Denham

View solution in original post

8 REPLIES 8
SteveDenham
Jade | Level 19

There is a way in PROC GLIMMIX, and since about anything that can be done in MIXED can be done in GLIMMIX, I would recommend it.

As an example, suppose you wanted to test if the variances by group_no in the following were homogeneous:

proc glimmix data=somedata;

class group_no;

model response_var=group_no;

random _residual_/group=group_no;

covtest homogeneity;

run;

This will give a likelihood ratio test of the homogeneity of variances over the fixed effect of group_no.  It is not restricted by sample size (as is Levene's test), and will accommodate more complex models as needed.

Steve Denham

marcioadg
Calcite | Level 5

Thank you, that is very helpful! Can I replace _residual_ for my block variable?

SteveDenham
Jade | Level 19

Not quite.  You will need two random statements:

proc glimmix data=somedata;

class group_no block;

model response_var=group_no;

random _residual_/group=group_no;

random block;  /*and perhaps block*group_no */

covtest homogeneity;

run;

Steve Denham

marcioadg
Calcite | Level 5

Perfect Steve. Thanks!

Ruhi
Obsidian | Level 7

Hi Steve

 

I am having a similar issue on checking equlaity of varainces. My experiment involves repeated measurements on 30 subjects. 6 scans on human back, taken within 5 sec all in one sanp shot. So we have repeated data. I want to test for equality of varainces in gender , bmi and bf groups.

I am doing correct by running a model as below??

 

proc glimmix data=dat;
class gender bmi pt bf ;
model distance=gender| bmi| bf;
random intercept/sub=pt type=un group=bf; * runing it 3 times for each gender, bmi and bf group to test for equality of varaince in the three subgroups;
covtest homogeneity;
run;

Thanks so smuch

SteveDenham
Jade | Level 19

That will work.  Now the question comes, why are you testing for homogeneity?  My feeling on this is that unless you need homogeneity in order to fit the model, say due to memory constraints, just fit the heterogeneous variance model--let the data determine things.  The advantage of mixed models is that there is no assumption of homogeneity of variance required in the application of the optimizing algorithm.

 

Steve Denham

Ruhi
Obsidian | Level 7

Well the reason for testing the homogeneity of varainces is we are just trying to understand the varaibility of a new medical device. The investigator wanted to see how much varaibility is there within repated scans done on gender , bmi and body fat groups. Although we can get pooled estimates of varainces for these groups but he also wanted to see if there is significant difference in the varainces of the three groups?

SteveDenham
Jade | Level 19

I see.  Then your code will give likelihood ratio tests for the homogeneity of variance across groups for each of the grouping effects.  I hope that is what you are looking for.

 

Steve Denham

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 8 replies
  • 10722 views
  • 4 likes
  • 3 in conversation