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

Viechtbauer, Wolfgang (SP) wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Mon Mar 2 13:44:36 CET 2020

```Dear Gil,

I don't know what 'yi' represents in your case, but let's say you are simply analyzing means. And let's say 'vi' is the vector with the sampling variances of these means. You cannot simply analyze sqrt(yi) while keeping vi unchanged. The sampling variance of a square-root transformed mean is different from the sampling variance of a mean, so the variances need to be adjusted appropriately. For the square-root transformation, the adjusted (estimate of the) sampling variance is vi / (4 * yi) (where yi = mean) based on the delta method.

Similarly, you cannot simply reverse-transform the variance-covariance matrix of the random effects or some linear combination thereof. And no, 'G' and 'H' are still variance-covariance matrices, regardless of what kind of transformation you apply to 'yi' - they are just variance-covariance matrices for outcomes that are in some kind of transformed units.

I haven't thought this all the way through, but I think one could get an estimate of the variance in the back-transformed units again by applying the delta method, so if varTREATMENTresponse is the variance for your sqrt-transformed outcome, then varTREATMENTresponse * 4 * meanTREATMENTresponse would be the variance for the untransformed outcome, but to compute this, you need an estimate of 'meanTREATMENTresponse' (based on the sqrt-transformed outcome), so this isn't invariant to the mean level.

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: Friday, 28 February, 2020 17:00
To: r-sig-meta-analysis using r-project.org
Subject: Re: [R-meta] Co-variances of the random structure

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
```