BookmarkSubscribeRSS Feed
jsb
Calcite | Level 5 jsb
Calcite | Level 5

Hi

I am working on a dataset where the interest is not in testing for the adjusted mean differences solely but on testing whether the variability differs between two independent groups.  The measurements are nested in a sense in a combination of distance and location within a distance of a circle.  Assuming the center of the circle is a reference point (of the eye) there are 3 levels of eccentricity (distance) and locations on that circle (location).  I need to correctly specify this model, considering this structure to accurately have the proper degrees of freedom and fixed effects.  Specifically, I have the following questions that I hope some could help me out with:

1. I generally use PROC MIXED but in a search focusing on variability and not means, I found that GLIMMIX is best to use as a test for homogeneity that should provide this result.  Assuming the model is specified correctly, would the indpendent factor being specified as a fixed factor in addition to group variance in a random statement be appropriate?

 

2. I have currently specified 3 random statements, one for ID and two each for the nested (locationxdistance combo within id scenario? This seems over specified.

 

Thank you for your help.

7 REPLIES 7
Ksharp
Super User

Not sure I undestand your question.

You could use GROUP= option to assume obs from the same group have the same variance .

random int/subject=school group=class;

Ksharp_0-1741054800964.png

 

 

2)You also could try COVTEST statement to test if the covariance is different between two group:

Ksharp_0-1741055252304.png

 

 

jsb
Calcite | Level 5 jsb
Calcite | Level 5

Thank you for your responses.  I'dl ike to specify that the residuals could differ across group.  I am trying to ask the question, does the variance differ across groups (independent factor) while maintaining the structure/design features of the datset.  So, I think I would like to determine whether the residual variance differs across group while maintaining this two-way design.  My mixed model could look something like this but I am unsure how to specify this in glimmix, given that GLIMMIX does not allow repeated statement. I understand how to do this with one repeated factor but not 2.  Is this more clear? group=independent group; rf1=first within-subject condition; rf2=second within-subject factor such that rf1xrf2 create a unique combination. I first need to specify the residual structure in glimmix correctly and then will use the covtest.

 

proc mixed data=data covtest;
class id group rf1 rf2;
model y=group;
random subj rf1(id) rf2(id)/ v vcorr group=group;
run;

 

 

Ksharp
Super User

"I understand how to do this with one repeated factor but not 2. "

If you want to specify two factors in REPEATED ,you need to specify a special covariance construct:

 

Ksharp_0-1741224519428.png

Ksharp_1-1741224547336.png

 

For GLIMMIX, could like:

random Var Year/type=un@ar(1) subject=Child residual;

 

And @SteveDenham  might know your question better and could give you a hand.

 

SteveDenham
Jade | Level 19

Here are links to couple threads in the community from some years ago:

 

https://communities.sas.com/t5/SAS-Procedures/GLIMMIX-with-two-repeated-measures-variables/td-p/2326...

 

https://communities.sas.com/t5/Statistical-Procedures/repeated-measures-in-glimmix/td-p/128310

 

The first from @sld has several ways of modeling the doubly repeated measures and compares V matrices from MIXED and GLIMMIX.

 

The second is from me, and has a lot of untested code in the GLIMMIX call, but basically boils down to calling one effect as strictly G side, and the effect nested within that variable (say time) as an R-side (residual). Take care in identifying the subject for the R-side effect.

 

SteveDenham

jsb
Calcite | Level 5 jsb
Calcite | Level 5
I beleive I was emailing you as you were posting. I am new to posting on this site. I will look through these and get back with any questions. Thank you.
jsb
Calcite | Level 5 jsb
Calcite | Level 5

Hi Steve @sld ,

Thank you for the code provided.  I have a few questions for you if you could help. 

1. In your code provided, I understand year and month are within-subject factors but was treatment?  

2. The whole purpose to evaluate the variance (heterogeneity) of group.  In the GLIMMIX example below, I am able to estimate a variance matric for each rf1, but am not sure how to add a second group.  How would you recommend manipulating the code?  

3. My factors are imbalanced.  Factor levels of rf2 vary by rf1.  I do not necessarily need a 20x20 (point by point) but would like an estimated variance of rf1 and rf2 (potentially rf1xrf2) and group.  Neither of the models below get me that. Would a random statement for each be better?

4. I am familiar with post plots of lsmeans but do you know of a good post plot to display the variances aside from a table?

Thank you.

 

proc mixed data=data covtest;
class rf1 rf2 subj group;
model y = group|rf1|rf2 / ddfm=kr;
repeated rf1 rf2/subject=subj(group) type=un@cs r rcorr group=group;
run;

proc glimmix data=data;
    nloptions gconv=0;
    class rf1 rf2 subj group;
    model y = group|rf1|rf2 / ddfm=kr;
    random rf2 / subject=subj(group) group=rf1 type=ar(1) v residual;
    run;

proc mixed data=y covtest;
    class rf1 rf2 subj group;
    model y = group|rf1|rf2 / ddfm=kr;
random intercept/subject=subj group=group v vcorr;
repeated rf2/subject=subj*rf1 type=ar(1) group=group;
run;

 

 

 

jsb_0-1742233968681.png

 

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore Now →
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
  • 2798 views
  • 0 likes
  • 3 in conversation