BookmarkSubscribeRSS Feed
RubenPnx
Calcite | Level 5

I would like to know how I can implements different variances per categorical factor in Proc GLIMMIX of SAS.

I have done a generalized lineal mixed model with a beta distribution with 1 categorical fixed factor, and 3 random factors, with the result of  a model with heteroscedasticity along my categorical fixed factors.

Now I want to add a variance structure like "varIdent" in the package nlme of R as is recommended in the book "Mixed Effects Models and Extensions in Ecology with R" Zuur et al., 2009.

6 REPLIES 6
SteveDenham
Jade | Level 19

To get separate variance estimates for each level of your categorical fixed effect (called fixedeffectname in the code below) you can add a RANDOM statement:

random _residual_/group=fixedeffectname;

Note that you will now need to look at marginal means rather than conditional means, as the method=laplace and method=quad options do not support R-side estimation.

Not familiar enough with Zuur's variance structure to know if this is exactly what you want.

Steve Denham

RubenPnx
Calcite | Level 5

I mean to take into account the heterogeneity variance of the residual spread in a fixed variable.

How I can take into account the different residual spread varying per level (in a nominal variable) or in a continuous explanatory variable?

An example of this problem of different residual spread is in the Glimmix SAS Manual in the figure 38.21 (Chapter 38, page 2284) but with a nominal random variable.

file:///E:/Ruben/Ciencia/SAS/GLIMMIX/manual_glimmix.pdf

SteveDenham
Jade | Level 19

Well, that link didn't come through, but I refer you to the GROUP= option in the RANDOM statement.

If you have a continuous variable that results in a different residual spread, I would suggest transforming the continuous variable in such a way that the residuals look better in a QQ plot.

Steve Denham

RubenPnx
Calcite | Level 5

Excuse me for the link. SAS/STAT 9.2 User's Guide The GLIMMIX Procedure (Book Excerpt):

https://support.sas.com/documentation/cdl/en/statugglmmix/61788/PDF/default/statugglmmix.pdf

So if I want to take into account the diverse spread of the residuals in categorical predictors I have to:

1) Put "group=" and the caterical variable that suffers it in their levels, without any specification in "type=".

2) Make again the covtest to check that the spread of the residuals have no statistical different between the levels.

3) If it keep being significantly different I have to change the "type=" and to probe again with the covtest?

Doubts:

A) Which is the most recommended kind of covariance matrix (type=)  to control the heterocedasticity?

B) In the case that the transformation of the variable don't solve the problem of heterocedasticity in a continuous variable (predictor lineal), which kind of covariance structure I should introduce in the model? (e.g. cl, vc, vcorr...)

Thanks in advance

SteveDenham
Jade | Level 19

Selection of the covariance type will depend strongly on the design.  See what happens first with step 1 of your list, and see if the hetereogeneity is solved.  You could then explore other covariance types.  Note however that the heterogeneity in the fixed effects is a separate issue from the design, and that combining a covariance type= with group= will greatly increase the number of covariance parameters to be estimated.

For instance, suppose you fit a heterogeneous autoregressive covariance structure to four points.  You would estimate 5 parameters.  Now suppose you add group= for a categorical variable with 6 levels.  You would now have to estimate 30 parameters, 5 for each level of the categorical variable.  This may lead to inability to converge, or poor estimates and standard errors, or a non-positive definite Hessian matrix.

Steve Denham

lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

Citing a particular chapter, section, or page number in the User's Guide isn't automatically helpful because there are different versions of SAS in use, and the chapter number and page number are different in the relevant User's Guide for each version.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register 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
  • 6 replies
  • 1568 views
  • 3 likes
  • 3 in conversation