# Interaction effects in network meta-analysis (multiple treatment comparison) in R, with greater than two levels per effect?

I have a problem extremely similar to that found in question "Interaction effects in network meta-analysis (multiple treatment comparison) in R?", where I would like to use meta-analysis to investigate main and interaction factor effects of two to three factors on continuous outcome variables, where each study does not necessarily compare all potential factors together. In the previously posed question, the very helpful answer suggested assigning the factors as dummy variables (i.e. male, female became 1,0), and analyzing with the rma.mv function in the metafor package.

I am doing a similar comparison, but with some factors that have greater than 2 levels, and am wondering how to incorporate these factors into the model without using a dummy variable, or with modified dummy variables. For example, comparing different genotypes (A,B,C) and food levels (x1, x2, x5) on weight gain. I.e. how to work into the model:

rma.mv(mean, vi, mods = ~ genotype*food, random = list(~ arm | study), data=my_data)


For food level, I think it would be possible to include this factor as (1, 2, 5) as they are scaled as such, but for genotype this would not be possible. One possibility would be to break genotype into two dummy variables (i.e. A or not A (1,0), B or not B (1,0) so that A B and C would be coded as (1,0) (0,1) and (0,0) respectively. However, I do not see how to work this into the model as a single factor, including interactions with food level. Is it possible to calculate the effects of multi-level factors and their interactions through meta-analysis, when not all factors/levels are included in each study? Thanks very much.

If I understand the data structure correctly, you have means (and corresponding sampling variances) for different combinations of genotype and food within studies (so those combinations define the various arms of the studies).
Indeed, a three-level factor like genotype can be coded in terms of two dummy variables. You can either leave food as continuous if this is deemed sensible or again use two dummy variables. You actually do not have to do the dummy coding manually. If you declare one or both variables as factors (or if those variables are actually character variables), R will be happy to do the dummy coding for you. The interactions terms are then products of those dummy variables.
I have a very extensive example written up on the metafor package website that illustrates this type of analysis (with one two-level and one three-level factor):
In this example, each study contributes one combination of the two factors to the dataset, while in your case (at least some) studies appear to contribute more than one combination, but this is accounted for by the random = ~ arm | study part as you did and does not change how the fixed effects are modeled or interpreted.