## 7.1 Subgroup Analyses using the Mixed-Effects-Model

To conduct subgroup analyses using the **Mixed-Effects-Model** (random-effects-model within subgroups, fixed-effects-model between subgroups), you can use the `subgroup.analysis.mixed.effects`

function we prepared for you. To use the function, `meta`

and `metafor`

need to be installed and loaded in your library.

As the code for the function is pretty long, we **don’t display it here**. To access the function, use this link. Again, R doesn’t know this function yet, so we have to let R learn it by **copying and pasting** the code from the website **in its entirety** into the **console** on the bottom left pane of RStudio, and then hit **Enter ⏎**.

For the `subgroup.analysis.mixed.effects`

function, the following parameters have to be set:

Code | Description |
---|---|

m | The output of you meta-analysis. In my case, this is ‘m.hksj’ |

subgroups | The variable in our dataset in which we coded which study belongs to which subgroup. Note that we also tell the function in which dataset this variable is stored. In my case, this was the ‘madata’ dataset i used to get the meta-analysis output ‘m.hksj’. The dataset and the subgroup variable have to be connected with $ (e.g. madata$Control). It is important that the subgroup variable is defined for each effect size we used to calculate the initial meta-analysis |

exclude | This controls if one or more subgroups should be excluded from the subgroup analysis. To exclude one or more subgroups, we have to provide the function with the name of the subgroup as it appears in our dataframe (in quotation marks; e.g., exclude=‘psychology’). One can also exclude more than one subgroup at the same time. To do this, one has to concatenate the names of the subgroups we want to exclude (e.g. exclude = c(‘psychology’,‘general’)). If you do not want to exclude subgroups (as is advised), you can leave out this parameter. |

In my `madata`

dataset, which i used previously to generate my meta-analysis output `m.hksj`

, i stored the subgroup variable `Control`

. This variable specifies **which control group type was employed in which study**. There are **three subgroups**: `WLC`

(waitlist control), `no intervention`

and `information only`

.

The function to do a subgroup analysis using the mixed-effects-model with these parameters looks like this.

```
subgroup.analysis.mixed.effects(m=m.hksj,
subgroups=madata$Control)
```

```
## Subgroup Results:
## --------------
## Subgroup k TE seTE LLCI ULCI p
## 1 information only 3 0.4048358 0.07875304 0.250 0.559 2.739011e-07
## 2 no intervention 8 0.5107720 0.11945084 0.277 0.745 1.902797e-05
## 3 WLC 7 0.7836032 0.20993337 0.372 1.195 1.894924e-04
## Q I2 I2.lower I2.upper
## 1 1.144426 0.00 0.00 0.82
## 2 16.704467 0.58 0.08 0.81
## 3 22.167163 0.73 0.42 0.87
##
## Test for subgroup differences (mixed/fixed-effects (plural) model):
## --------------
## Q df p
## Between groups 3.031562 2 0.2196365
##
## - Total number of studies included in subgroup analysis: 18
## - Tau estimator used for within-group pooling: SJ
```

The results of the subgroup analysis are displayed under `Subgroup Results`

. We also see that, while the **pooled effects of the subgroups differ quite substantially** (*g* = 0.41-0.78), this difference is **not statistically significant**.

This can be seen under `Test for subgroup differences (mixed/fixed-effects (plural) model)`

in the `Between groups`

row. We can see that \(Q=3.03\) and \(p=0.2196\). This information can be reported in our meta-analysis paper.