Interpreting and extracting residual variance for multiple groups

Hi,

I am currently doing an analysis of population differences in behavioural variation across a temperature gradient. Here, individuals from 2 populations were repeatedly tested at both a Low temperature (3 repeated measures) and a high temperature (3 repeated measures).

A simplified example of my dataset is as follows:

ID     Pop      Temp_measured     Temp_treatment     Trial   Behaviour
1       A           25.1              Low              1        603
1       A           28.2              High             2        927
1       A           24.8              Low              3        715
1       A           27.4              High             4        1068
1       A           25.0              Low              5        541
1       A           28.1              High             6        854
2       B           25.0              Low              1        733
2       B           28.1              High             2        813
etc.

One of the things I am interested in investigating is the residual variance of each Population (A or B) at each temperature treatment (Low or High). I have therefore fit something similar to the following model using the brms package:

Behaviour ~ Pop*scale(Temp_measured)+
                        scale(Trial)+
                       (scale(Temp_measured)|gr(ID, by = Pop)), 
                        sigma ~ 0 + Pop*Temp_treatment, family = gaussian)

From this model, I get the following output under Population-Level Effects:

                             Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
sigma_PopA                     5.51      0.07     5.49     5.73 1.00     8353     8811
sigma_PopB                     6.22      0.11     6.07     6.51 1.00     6080     7977
sigma_Temp_treatmentLow        0.39      0.09     0.18     0.53 1.00     8325     9092
sigma_PopB:Temp_treatmentLow  -0.72      0.13    -0.89    -0.43 1.00     8253     9088

My questions are:

  1. Am I correct in that sigma_PopA and sigma_PopB represent the residual variation (on the log scale) for population A and B, respectively, at the High temperature treatment?

  2. Also, is there a simple way to extract the residual variance for each population at the ‘Low’ temperature treatment? Is it a case of combining the posterior distributions?
    For example, something like…

Vresid_PopB_Low <- exp(posterior_samples(Model)$"b_sigma_PopB")^2  + exp(posterior_samples(Model)$"b_sigma_PopB:Temp_treatmentLow")^2 

Any help or guidance would be greatly appreciated!

Many thanks!

I believe you’re correct in your interpretation of 1.

As to 2, the old method would be to work directly with the posterior draws using the posterior_samples() function. That function still works, but was depreciated in the recent brms update. You’ll have to look through the reference manual for the current recommended practice. I’m not totally up on it, yet.

1 Like

Great, thanks for the help Solomon!

Would I be correct as well then that sigma_Temp_treatmentLow represents the difference in residual variation when Population A are tested in the Low temperature treatment? And vice versa for sigma_PopB:Temp_treatmentLow and Population B? Just want to make sure I am understanding the output correctly.

Provided this is correct, does combining the sigma_PopA and sigma_Temp_treatmentLow posterior distributions (using the current recommended practice outlined in the reference manual) in order to get a posterior distribution for PopA at the Low temperature treatment sound like a sensible idea?

Thanks again for the help. I really appreciate it.

It’s going to be hard for me to keep up with the exact interpretation of your model, given its complexity and so on. Instead, here are a couple strategies for thinking about and working with models which include a linear model on \sigma:

  • Broadly speaking, interpret the coefficients in the model for \sigma much the same as you would interpret the coefficients for \mu. The only big difference is you’re typically modeling \log \sigma, so convert as necessary.
  • Any time you’re working with a new model (or even with new data), start with very simple models and slowly build up to more complex ones. Also, never jump up to a complex model until you have 100 \% nailed down all the parameters in the simpler one. In your case, consider simplifying your model for \log \sigma and build up once you’re confident you understand the parameters. I use this kind workflow all the time.
1 Like

Great, thanks for the help Solomon.