## Proc Mixed/Glimmix to calculate intraclass correlations

Solved
Occasional Contributor
Posts: 8

# Proc Mixed/Glimmix to calculate intraclass correlations

Hello,

I typically compute intraclass correlations using the Gelman & Hill (2006) method (ratio of the between-group variance to the total data variance) using proc mixed or glimmix with the unstructured variance/covariance structure.

I noticed in the SAS documentation on Glimmix that the Cholesky root parameterization is generally recommended over a completely unstructured matrix (http://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_glimmix_sect...) and (http://blogs.sas.com/content/iml/2012/02/08/use-the-cholesky-transformation-to-correlate-and-uncorre...)

I was performing initial data cleaning/model building/specification and noticed that a multiplicative transformation (in this case, taking the dependent variable times 100) resulted in a drastically different ICC from the original model (both using the Cholesky parameterization).  Moreover, the completely unstructured matrix does not suffer this difference with a multiplicative transform (it also results in a notably different ICC than the Cholesky-root ICC's).

I suspect that the differences between type=UN and type=CHOL are enough that only UN should be used for ICC calculations, but is anyone able to explain why a simple transform results in such a great discrepancy with the CHOL parameterization?

I thought maybe others with more knowledge in Cholesky transformations may be able to enlighten me.

Best,

Matt

Accepted Solutions
Solution
‎10-29-2013 06:44 PM
Valued Guide
Posts: 684

## Re: Proc Mixed/Glimmix to calculate intraclass correlations

Actually, the correlation results are the same. As I said in a previous post, the value in the Table of Covariance Parameters is NOT the between-subject variance when you use type=CHOL. You have to put in the G option to see thebetween-person variance. Try running the example you cited.

These give the same results:

proc glimmix data=pr method=rspl ;

class Person Gender;

model y = Gender Age Gender*Age / s;

random int / sub=Person type=un g;

run;

proc glimmix data=pr method=rspl ;

class Person Gender;

model y = Gender Age Gender*Age / s;

random int / sub=Person type=chol g;

run;

With the latter, you have to look in the G table to see the variance.

If you multiply y by 10 you get the same intraclass correlation. I just did it and results are identical. Both the between-person variance and the residual variance are 100x larger when y is 10 times larger. By the way, you do not need either UN or CHOL. With this model, you are still getting a VC structure result.

All Replies
Valued Guide
Posts: 684

## Re: Proc Mixed/Glimmix to calculate intraclass correlations

You are probably not using the actual variance estimates. I am guessing you are using the covariance parameter estimates that are displayed with CHOL, which are not the variances or covariances of your data. The proc will display the variance-covariance matrix if you add the G option on the random statement. This is calculated from the parameters of the CHOL-based matrix. It is a good practice to always use CHOL instead of UN with GLIMMIX. In well behaved cases (plenty of data, no ill-conditioned or singular matrices, positive-definite var.-cov. matrix), the G results are identical. But as you get into more problem areas, things can go wrong with UN (parameter estimates moving into 'impossible' regions, and so on). CHOL is very stable parameterization. In MIXED, you can get the same thing with type=FA0(#), where # is the dimension of the G matrix. But always remember to use the G option to see the G matrix.

Occasional Contributor
Posts: 8

## Re: Proc Mixed/Glimmix to calculate intraclass correlations

LVM,

Thanks for the response.  I appreciate it.

However, that isn't my understanding based upon some SAS documentation:  SAS/STAT(R) 9.2 User's Guide, Second Edition (search 'intraclass', it is in the middle of the page).  Also here: http://www2.sas.com/proceedings/forum2008/374-2008.pdf

I am open to correction, if I am misreading these or they are inaccurate.  Please let me know.

Thanks,

Matt

Valued Guide
Posts: 684

## Re: Proc Mixed/Glimmix to calculate intraclass correlations

You have some misunderstandings. I was answering your question about UN versus CHOL, and my comments are accurate. However, you want a CS type of covariance structure if you want to calculate the intraclass correlation using them method you cite. Basically, you want a between group and within group variance, and that is what you get with type=cs. In MIXED it would be

repeated / type=cs subject=____  R;

But in GLIMMIX it would be

random _residual_ / type=cs subject=____ G;

You don't want either UN or CHOL for this version of the intraclass correlation. With these latter structures, you get a more complex variance-covariance matrix. There are ways of getting intraclass correlations for this situation (a different situation from what you describe); see the new book by Vonesh for correlated data (SAS Press).

I am assuming you are dealing with continuous (normal) data and an identify link. This matters for the formula.

Valued Guide
Posts: 684

## Re: Proc Mixed/Glimmix to calculate intraclass correlations

Just to continue, there are several ways of getting r (intraclass correlation) with MIXED or GLIMMIX which are equivalent for normal data and identify link function. These do not involve UN or CHOL. In addition to the above, where you use CS structure (and read off the two variances), you can use:

random int / sub=____;

where the underline is the subject variable. Here is residual variance is there by default (for normal distribution). You would use the two variances as in the user's guide. You would not need repeated (in mixed) or random _residual_ (in GLIMMIX). In short, there are numerous equivalent ways for getting r, and I give you some of the choices.

Occasional Contributor
Posts: 8

## Re: Proc Mixed/Glimmix to calculate intraclass correlations

Thanks LVM.  Therein lies the confusion.

I was using the latter:

random int/ sub=subject;

My original question was if I have two different iterations of my response variable:  Response and Response*100, why do the covariance parameter estimates for the intercept and the residual not change by the same factor when running:

random int/ sub=subject type=CHOL;

but the covariance parameter estimates change by the same factor when the same models are run with

random int/ sub=subject type=UN;

Solution
‎10-29-2013 06:44 PM
Valued Guide
Posts: 684

## Re: Proc Mixed/Glimmix to calculate intraclass correlations

Actually, the correlation results are the same. As I said in a previous post, the value in the Table of Covariance Parameters is NOT the between-subject variance when you use type=CHOL. You have to put in the G option to see thebetween-person variance. Try running the example you cited.

These give the same results:

proc glimmix data=pr method=rspl ;

class Person Gender;

model y = Gender Age Gender*Age / s;

random int / sub=Person type=un g;

run;

proc glimmix data=pr method=rspl ;

class Person Gender;

model y = Gender Age Gender*Age / s;

random int / sub=Person type=chol g;

run;

With the latter, you have to look in the G table to see the variance.

If you multiply y by 10 you get the same intraclass correlation. I just did it and results are identical. Both the between-person variance and the residual variance are 100x larger when y is 10 times larger. By the way, you do not need either UN or CHOL. With this model, you are still getting a VC structure result.

Occasional Contributor
Posts: 8

## Re: Proc Mixed/Glimmix to calculate intraclass correlations

Got it, we're on the same page.  Also, thanks for notifying me about the Vonesh book. I was aware of a number of his publications, but not the recent book.

🔒 This topic is solved and locked.