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

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

sg.var | 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). |

n.sg | The number of subgroups we want to inlcude in our subgroup analysis (e.g. n.sg = 2) |

subgroup[x] | Here, we specify all the subgroups we want to include in the meta-analysis. Subgroup Analyses with up to 6 subgroups are possible with this function. The ‘subgroup’ parameters have to be numbered (e.g. subgroup1 = ‘Name of your first subgroup’, subgroup2 = ‘Name of your second subgroup’, …) |

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 paramters looks like this.

```
subgroup.analysis.mixed.effects(data=m.hksj,
sg.var=madata$Control,
n.sg = 3,
subgroup1 = "WLC",
subgroup2 = "no intervention",
subgroup3 = "information only")
```

```
## 95%-CI %W(fixed) meta
## 1 0.7836 [0.3721; 1.1951] 8.9 3
## 2 0.5108 [0.2767; 0.7449] 27.6 2
## 3 0.4048 [0.2505; 0.5592] 63.5 1
##
## Number of studies combined: k = 3
##
## 95%-CI z p-value
## Fixed effect model 0.4679 [0.3449; 0.5909] 7.46 < 0.0001
##
## Quantifying heterogeneity:
## tau^2 = 0.0079; H = 1.23 [1.00; 2.15]; I^2 = 34.0% [0.0%; 78.4%]
##
## Test of heterogeneity:
## Q d.f. p-value
## 3.03 2 0.2196
##
## Results for subgroups (fixed effect model):
## k 95%-CI Q tau^2 I^2
## meta = information only 1 0.4048 [0.2505; 0.5592] 0.00 -- --
## meta = no intervention 1 0.5108 [0.2767; 0.7449] 0.00 -- --
## meta = WLC 1 0.7836 [0.3721; 1.1951] 0.00 -- --
##
## Test for subgroup differences (fixed effect model):
## Q d.f. p-value
## Between groups 3.03 2 0.2196
## Within groups 0.00 0 --
##
## Details on meta-analytical method:
## - Inverse variance method
```

The results of the subgroup analysis are displayed under `Results for subgroups (fixed effect model)`

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

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.

Please not that the values displayed under `k`

in the `Results for subgroups (fixed effects model)`

section are always 1, as the pooled effect of the subgroup is treated as a single study. To determine the actual \(k\) of each subgroup, you can use the `count`

function from `dplyr`

in R.

```
library(dplyr)
dplyr::count(madata, vars=madata$Control)
```