Solved
Contributor
Posts: 45

# Is there a way to test for equal variances in PROC MIXED?

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

Accepted Solutions
Solution
‎07-09-2014 11:26 AM
Posts: 2,655

## Re: Is there a way to test for equal variances in PROC MIXED?

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

All Replies
Solution
‎07-09-2014 11:26 AM
Posts: 2,655

## Re: Is there a way to test for equal variances in PROC MIXED?

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

Contributor
Posts: 45

## Re: Is there a way to test for equal variances in PROC MIXED?

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

Posts: 2,655

## Re: Is there a way to test for equal variances in PROC MIXED?

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

Contributor
Posts: 45

## Re: Is there a way to test for equal variances in PROC MIXED?

Perfect Steve. Thanks!

Contributor
Posts: 39

## Re: Is there a way to test for equal variances in PROC MIXED?

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

Posts: 2,655

## Re: Is there a way to test for equal variances in PROC MIXED?

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

Contributor
Posts: 39

## Re: Is there a way to test for equal variances in PROC MIXED?

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?

Posts: 2,655

## Re: Is there a way to test for equal variances in PROC MIXED?

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

☑ This topic is solved.