# [R-meta] Question about the metafor package

Viechtbauer, Wolfgang (SP) wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Mon Aug 17 18:28:35 CEST 2020

```Dear Safa,

You could just do:

mods = ~ Age_TRT_mean + Age_Control_mean + male_TRT_pc + male_Control_pc

(I think this is what you meant).

Since 'yi' is a standardized mean difference here (i.e., it reflects the difference between the two groups), one could also consider a model that directly relates the size of the group difference to the *difference* in the mean age and the *difference* in the proportion of males in the two groups. That would be:

mods = ~ I(Age_TRT_mean - Age_Control_mean) + I(male_TRT_pc - male_Control_pc)

or you could compute these differences beforehand and then include them in the model.

Best,
Wolfgang

>-----Original Message-----
>From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces using r-project.org]
>On Behalf Of Safa Aouinti
>Sent: Monday, 17 August, 2020 18:14
>To: r-sig-meta-analysis using r-project.org
>Subject: [R-meta] Question about the metafor package
>
>Dear all,
>
>I would like to generate a meta-regression using the function rma (package
>metafor) with mods option and I have a question about how we can precise in
>mods the covariates in each group (TRT and control) ?
>
>This is an extract of my data and my code:
>
>metadata <- data.frame(   Study=factor(c("[Study1, 2008]", "[Study2, 2013]",
>"[Study3, 2018]", "[Study4, 2015]")),
>                                       N_TRT= c(86, 43, 12, 675),
>                                       N_Control=c(55, 86, 23, 264),
>                                       mean_TRT= c(12.72, 13.4, 17.58,
>31.68),
>                                       SD_TRT= c(2.56, 0.6, 2.67, 5.3),
>                                       mean_Control= c(14.5, 15.3, 18.48,
>33.95),
>                                        SD_Control= c(2.04, 0.3, 1.34,
>4.48),
>                                       Age_TRT_mean= c(19.2, 23.5, 24.5,
>18.49),
>                                       Age_TRT_SD= c(2.6, 3.8, 3.1, 4.25),
>                                       male_TRT_pc= c(57, 27.9, 100, 57.6),
>                                       Age_Control_mean= c(21.2, 29.2,
>27.04, 19.77),
>                                      Age_Control_SD= c(6.1, 6.7, 2.91,
>4.72),
>                                       male_Control_pc= c(60, 46.5, 100,
>51.5)
>                                     )
>
>dat1 <- escalc(measure="SMD", m1i= mean_TRT, sd1i= SD_TRT, n1i=N_TRT,
>               m2i=mean_Control, sd2i=SD_Control, n2i=N_Control,
>
>res <- metafor::rma(data = dat1,
>                    yi = yi, # effect size
>                    vi = vi,
>                    method = "DL",mods=~............,
>                    slab = Study)
>
>
>I would like to precise in the meta-regression (in mods option) the age in
>the group TRT (Age_TRT), the age in the group control (Age_control_pc), the
>percentage of males in the group TRT (male_TRT_pc) and the percentage of
>males in the group control (male_control_pc). Is-it possible ? or it should
>be treated differently ?
>
>The purpose of this meta-regression is to compare the mean difference of a
>medical test between two groups (treatment 'TRT' and control) and see if the
>age and the gender (male percentage) influence the results.
>