🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Fluorite | Level 6

## Manually calculate GCorr

Hello,

I need some help with the G and GCorr matrix in generalized linear mixed models. I thought it was the covariance and the correlation matrix of the random effects. However, when I use proc corr to calculate the correlation between the estimated random effects given in the output table solutionR, I get different results from the output table GCorr? BTW, I have already taken into account the grouping variable.

Do you have any hint for me what went wrong?

Thanks in advance + regards,

M

1 ACCEPTED SOLUTION

Accepted Solutions
SAS Super FREQ

## Re: Manually calculate GCorr

This is a common misconception.  If you look at the doc that discusses mixed model theory, you will see that the random effects are generated by a matrix G. What you are seeing is an estimate of this matrix.

In general, correlation matrices that get printed as part of regression model are the correlation of the PARAMETERS (coefficients) in the model. In many cases, you can show that the sampling distribution of the parameter estimates is multivariate normal. These matrices estimate the parameters in the sampling distribution. The blog post "Simulate many samples from a logistic model" shows a similar situation for fixed effects in a logistic model.  It simulates many data sets and estimates the regression coefficients for each sample. It then displays a scatter plot of the estimates. You can see that the estimates are correlated.

3 REPLIES 3
SAS Super FREQ

## Re: Manually calculate GCorr

This is a common misconception.  If you look at the doc that discusses mixed model theory, you will see that the random effects are generated by a matrix G. What you are seeing is an estimate of this matrix.

In general, correlation matrices that get printed as part of regression model are the correlation of the PARAMETERS (coefficients) in the model. In many cases, you can show that the sampling distribution of the parameter estimates is multivariate normal. These matrices estimate the parameters in the sampling distribution. The blog post "Simulate many samples from a logistic model" shows a similar situation for fixed effects in a logistic model.  It simulates many data sets and estimates the regression coefficients for each sample. It then displays a scatter plot of the estimates. You can see that the estimates are correlated.

Rhodochrosite | Level 12

## Re: Manually calculate GCorr

Also note: G is the covariance matrix of the (unknown) random effects in the model (gamma). G is not the covariance matrix of the estimated (really predicted) random effects in the model (gamma^).

Adding to the complexity, as indicated by Rick, what you get from the output is G^, the estimated covariance matrix of the (unknown) random effects. G^ is not the estimated covariance matrix of the estimated (predicted) random effects.

Fluorite | Level 6

## Re: Manually calculate GCorr

Rick and Ivm, thank you for the helpful clarification!

But then, do I have any chance to get the (co)variance of the reference category of a random effect (3 unordered categories) that follows a multinomial distribution? If I don't choose the largest category as reference in my GLMM, the model does not converge. However if I do so, the G Matrix only contains the blocks of (co)variances for non-reference categories and of course, the (co)variance of the largest category is of main interest.

Thanks again!

Discussion stats
• 3 replies
• 1868 views
• 5 likes
• 3 in conversation