# [R-meta] Difference between "GEN" and "UN" in metafor

Farzad Keyhan |@keyh@n|h@ @end|ng |rom gm@||@com
Sat Aug 21 02:39:11 CEST 2021

```Thank you, Wolfgang! Do please correct me if I am wrong, but I would
interpret, say an estimate of 0.34 for the correlation between intercepts
and slopes of a grand_mean_centered AGE variable (AGE_ij - mean(AGE_ij)),
from a model like:

Model 1:  yi ~ AGE_cent, random = AGE_cent | study, struct = "GEN", as:

The association between the study-specific true effects for cases with an
average age across the studies (intercepts) and study-specific
grand_mean_centered AGE true effects across the studies (slopes)?

I would also interpret, say an estimate of 0.34 for the correlation between
intercepts and slopes of an `outcome` variable with levels A and B, from a
model like:

Model 2:  yi ~ outcome -1, random =  outcome -1 | study, struct = "GEN", as:

The association between the study-specific true effects of outcome A across
studies (intercepts) and study-specific true effects for outcome B across
the studies (slopes)?

You noted that "the interpretation of the variances components and
correlation [between "UN" and "GEN"] differs". So, let's say we have:

Model 3:  yi ~ outcome -1, random =  outcome -1 | study, struct = "UN"

I wonder how the interpretation of the correlation estimate and variance
components in Model 3 differ from those in Model 2?

Thanks a lot,
Fred

On Fri, Aug 20, 2021 at 12:18 PM Viechtbauer, Wolfgang (SP) <
wolfgang.viechtbauer using maastrichtuniversity.nl> wrote:
>
> Dear Fred,
>
> See my responses below.
>
> Best,
> Wolfgang
>
> >-----Original Message-----
> >From: R-sig-meta-analysis [mailto:
r-sig-meta-analysis-bounces using r-project.org] On
> >Behalf Of Farzad Keyhan
> >Sent: Friday, 20 August, 2021 17:55
> >To: R meta
> >Subject: [R-meta] Difference between "GEN" and "UN" in metafor
> >
> >Hello All,
> >
> >I guess my own question was misplaced when I was answering this question:
> >
https://stat.ethz.ch/pipermail/r-sig-meta-analysis/2021-August/003079.html.
> >
> >So, here is my own question for Wolfgang, I understand that for say
> >`outcome` with K levels, random = ~ outcome | study, struct="UN" creates
> >correlated random effects with K variances and K*(K-1)/2 covariances in
> >each `study`.
> >
> >Also, for struct="UN", `outcome` has to be a factor.
>
> This is likely no longer going to be a requirement in the next version of
metafor, that is, variable 'outcome' will automatically be treated as a
factor.
>
> >But apparently struct="GEN" can also be used with both numeric and
> >non-numeric variables and apparently with multiple variables on the left
of
> >the vertical bar `|` e.g., `outcome + var2 | id` (not sure if `||` or `
> >outcome * var2  | study` are also handled?).
>
> Correct. || and interactions are also possible.
>
> >First, for the same factor variable (say `outcome` a binary one), what is
> >the difference in the interpretation of random effects and the
correlation
> >estimates in:
> >
> >random = ~  outcome | study, struct="UN"
> >
> >VERSUS
> >
> >random = ~  outcome | study, struct="GEN"
>
> The former does something slightly non-standard in that it adds
correlated random effects for each outcome level within study, that is, it
is really doing:
>
> random = ~  outcome - 1 | study, struct="GEN"
>
> The latter uses standard formula syntax, so it will add a random
intercept for studies and a random slope for the outcome level that is not
the reference level (and allows the intercept and slope to be correlated).
>
> The fit of these two specifications is the same, but the interpretation
of the variances components and correlation differs.
>
> >Second, for a numeric variable (say `AGE`), what is the interpretation of
> >random effects and the correlation estimates in:
> >
> >random = ~ AGE | study, struct="GEN"
>
> Same as in lme(), lmer(), and other packages for multilevel/mixed-effects
modelling.
>
> In other words: struct="UN" is really just a special case where (a) one
can only specify a single categorical variable on the left of | and (b) the
formula gets automatically changed to 'factor(inner) - 1 | outer'. The rest
is just completely standard syntax / random-effects modelling.
>
> I added struct="UN" (and some of the simpler structures such as "HCS" and
"CS") because they are quite commonly used in the usual 'advanced'
meta-analytic models (e.g., as used in a 'standard' multivariate or
multilevel model or in network meta-analysis). But you can do everything
with struct="GEN" (and more) that struct="UN" gives you - although you
cannot adopt a simplified var-cov structure when you use struct="GEN" (like
"HCS" or "CS"), except if you use ||, which then is like struct="DIAG".
>
> >Thank you,
> >Fred

[[alternative HTML version deleted]]

```