# [R-meta] Co-variances of the random structure

Gram, Gil (IITA) G@Gr@m @end|ng |rom cg|@r@org
Fri Feb 28 16:59:46 CET 2020

```Dear Wolfgang,

Thanks for your response. Yes that is what I meant. This brings me to my second question:

As you can see in my model design, I sqrt transformed my data so I am modeling sqrt(yi). I should therefore back-transform yield estimates with ^2. But at what point do I back-transform the variances when I’m interested in computing variance responses with:
varTREATMENTresponse = varTREATMENT + varControl - 2*covar(TREATMENT, Control)

The matrices MOD\$G and MOD\$H are thus the var-cov matrices of a sqrt transformed data, and are in fact standard deviations, right? So
- do I first back-transform the SDs into VAR by (MOD\$G)^2 and (MOD\$H)^2, and then use the above formula?
or
- do I first use the above formula and then back-transform the resulting VAR response by (varTREATMENTresponse)^2?
or
- is there a way to adapt the above formula for SDs?

Gil

> On 18 Feb 2020, at 13:00, Viechtbauer, Wolfgang (SP) <wolfgang.viechtbauer using maastrichtuniversity.nl> wrote:
>
> Hi Gil,
>
> Not sure if I understand.
>
> MOD\$G and MOD\$H contain the var-cov matrices for the ~ treatment|idSite and ~ treatment|idSite.time random effects.
>
> Or are you looking for var-cov matrices of the variance components (and covariances) themselves?
>
> Best,
> Wolfgang
>
> -----Original Message-----
> From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces using r-project.org] On Behalf Of Gram, Gil (IITA)
> Sent: Tuesday, 18 February, 2020 12:13
> To: r-sig-meta-analysis using r-project.org
> Subject: [R-meta] Co-variances of the random structure
>
> Dear all,
>
> I have the following question: is it possible to extract the covariances from random variance components of a rma.mv model? For example, from my model below this email.
>
>
> Gil
>
> ---
>
> My model design:
>
> MOD = rma.mv(sqrt(yi), vi, method = 'REML', struct="HCS", sparse=TRUE, data=dat,
>                              mods = ~ rateORone + rateORtwo + rateORthree + rateORManure + kgMN
>                              + I(rateORone^2) + I(rateORtwo^2) + I(rateORthree^2) + I(rateORManure^2) + I(kgMN^2)
>                              + rateORone:kgMN + rateORtwo:kgMN + rateORthree:kgMN + rateORManure:kgMN
>                              + I(rateORone^2):I(kgMN^2) + I(rateORtwo^2):I(kgMN^2) + I(rateORthree^2):I(kgMN^2) + I(rateORManure^2):I(kgMN^2)
>                              + cropSys + idF,
>                              random = list(~1|ref, ~1|idRow, ~ treatment|idSite, ~ treatment|idSite.time))
>
> Where ‘treatment’ in the random structure has 4 levels, Control, OR, MR and ORMR.
> I wish to evaluate the variances of the responses of the 3 last levels with the first. For instance with OR: Var_response = Var_OR + Var_control – 2 * Cov_OR:control.
>
> My model output yields the following:
>
> Multivariate Meta-Analysis Model (k = 2695; method: REML)
>
> Variance Components:
>
>           estim    sqrt  nlvls  fixed  factor
> sigma^2.1  0.0513  0.2264     34     no     ref
> sigma^2.2  0.0139  0.1178   2625     no   idRow
>
> outer factor: idSite    (nlvls = 62)
> inner factor: treatment (nlvls = 4)
>
>           estim    sqrt  k.lvl  fixed    level
> tau^2.1    0.1683  0.4103    255     no  Control
> tau^2.2    0.1403  0.3745    324     no       MR
> tau^2.3    0.1305  0.3612    993     no       OR
> tau^2.4    0.1094  0.3308   1123     no     ORMR
> rho        0.8343                    no
>
> outer factor: idSite.time (nlvls = 230)
> inner factor: treatment   (nlvls = 4)
>
>             estim    sqrt  k.lvl  fixed    level
> gamma^2.1    0.1061  0.3258    255     no  Control
> gamma^2.2    0.1272  0.3566    324     no       MR
> gamma^2.3    0.1052  0.3243    993     no       OR
> gamma^2.4    0.1344  0.3666   1123     no     ORMR
> phi          0.9229                    no
>
> Test for Residual Heterogeneity:
> QE(df = 2673) = 115058.0204, p-val < .0001
>
> Test of Moderators (coefficients 2:22):
> QM(df = 21) = 754.8078, p-val < .0001

```