# [R-sig-ME] conditional repeatability from MCMCglmm with random slope

John Morrongiello john.morrongiello at unimelb.edu.au
Mon Sep 11 12:39:06 CEST 2017

```Looks great, thanks Conor!

Dr John Morrongiello
Lecturer in Marine and Freshwater Biology

School of Biosciences
University of Melbourne
Victoria 3010, Australia
T: +61 3 8344 8929
M: 0403 338 554
E: john.morrongiello at unimelb.edu.au
W: www.morrongiellolab.com<http://%20www.morrongiellolab.com>

From: Conor Michael Goold
Sent: Monday, 11 September, 19:53
Subject: Re: conditional repeatability from MCMCglmm with random slope
To: John Morrongiello, r-sig-mixed-models at r-project.org

Ah, I see. It's my understanding that you can just take the range of values for the covariate, and apply the formula below. I'm not sure what you mean by the 'covariate specific random effect variance'...the variance of the random effects (intercept and slope variance terms) do not change with the covariate, but the value of the ICC will change depending on which value of the covariate it is estimated. If X is some covariate, I'd just do something like: ######### library(rethinking) # for the HPDI interval function # get the unique values of your covariate X covariate_values Sent: Monday, September 11, 2017 11:06 AM To: Conor Michael Goold; r-sig-mixed-models at r-project.org Subject: RE: conditional repeatability from MCMCglmm with random slope Hi Conor Thanks for getting back to me. I'll have a close read of the Martin etal paper (I'm familiar with the Goldstein etal 2002 paper they cite in this section). In regards to rptR being able to calculate a conditional repeatability involving random slopes, they provide an example of this towards the end of their vignette (https://cran.r-project.org/web/packages/rptR/vignettes/rptR.html). The trick (which is a little beyond my coding ability) is to properly average repeatability estimates across the range of the covariate as indicated in your formula below from MCMCglmm. I've had a look at the source code for rpt and I can't see where this function is estimating each covariate specific random effect variance to then calculate the mean random effect variance. Cheers John -- Dr. John R. Morrongiello School of BioSciences University of Melbourne Victoria 3010, Australia T: +61 3 8344 8929 M: +61 403 338 554 E: john.morrongiello at unimelb.edu.au W: http://morrongiellolab.com -----Original Message----- From: Conor Michael Goold [mailto:conor.goold at nmbu.no] Sent: Monday, 11 September 2017 4:49 PM To: John Morrongiello ; r-sig-mixed-models at r-project.org Subject: Re: conditional repeatability from MCMCglmm with random slope Hi again John, In the repeatability formula I worte, it should be Cov( V_intercept, V_slope ) with an addition sign! Conor ________________________________________ From: Conor Michael Goold Sent: Monday, September 11, 2017 8:41 AM To: John Morrongiello; r-sig-mixed-models at r-project.org Subject: Re: conditional repeatability from MCMCglmm with random slope Hi John, Repeatability for models with a random slope are a bit tricky to understand since it is calculated with respect to a particular value of a covariate. In general, it can be calculated as: R = Vg / (Vg + Vr) = V_intercept + V_slope * X_i^2 + 2 * Cov( V_intercept + V_slope ) * X_i / (numerator + Vr) where V_intercept = variance of intercepts, V_slope = variance of slopes, X_i is the covariate at a particular value i, Cov represents the covariance, and Vr = the residual variance. I'm not sure it can be calculated with rptR. For more details, see Martin et al. 2011. http://onlinelibrary.wiley.com/doi/10.1111/j.2041-210X.2010.00084.x/abstract (particularly pages 371 - 372) Best regards Conor Goold PhD Student Phone: +47 67 23 27 24 Norwegian University of Life Sciences Campus Ås. http://www.nmbu.no ________________________________________ From: R-sig-mixed-models on behalf of John Morrongiello Sent: Monday, September 11, 2017 5:26 AM To: r-sig-mixed-models at r-project.org Subject: [R-sig-ME] conditional repeatability from MCMCglmm with random slope Dear list I would like to estimate conditional repeatability of a behavioural trait from a model including random slopes fit with MCMCglmm. Would someone have some tips for how this can be done? The rptR package offers this option using bootstrapping, based on Johnson's 2014 paper (equation 11). Here, the average repeatability is estimated across the distribution of a covariate in question. I can readily estimate raw (intercept only) and a conditional (common slope) repeatability from a MCMCglmm model, but I'm not sure how to get the random slopes repeatability. Any help/ advice is much appreciated. (Johnson, P.C.D. (2014). Extension of Nakagawa & Schielzeth's R2GLMMRGLMM2 to random slopes models. Methods in Ecology and Evolution 5: 944-946). library(rptR) library(MCMCglmm) #######some data####### behaviour W: http://morrongiellolab.com [[alternative HTML version deleted]] _______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

[[alternative HTML version deleted]]

```