I'm working on doing a subgroup meta-analysis in R using metaprop from the meta package. I'm using the following code to achieve this:
pes.summary <- metaprop(`Events`, `Subjects`, `Author` , data = data , sm = "PFT", subgroup = Subgroup)
forest(pes.summary)
In the snippet above, data is a dataframe with columns 'Events', 'Subjects', 'Author', and 'Subgroup'. The Subgroup column specifies two subgroups within the data. Is there a way to run only a common effects model on SubgroupA, and only a random effects model on SubgroupB? I can change my code to add the following arguments:
pes.summary <- metaprop(`Events`, `Subjects`, `Author` , data = data , sm = "PFT", subgroup = Subgroup, fixed = TRUE, random = FALSE)
This gets me part of the way there. These arguments allow me to specify only random or fixed for the entire forest plot. However, I want to specify fixed = TRUE, random = FALSE for SubgroupA, and fixed = FALSE, random = TRUE for SubgroupB. The closest solution I can find is to manually subset data dataframe into the two subsets and then generate two forest plots separately. However, I am looking to have both subgroups appear in the same forest plot, which is the point of using the subgroup argument. Any ideas? Thanks in advance! Here is a picture of my current forest plot.
So in this example, I would like SubgroupA to only show Common effects, and SubgroupB to only show Random effects.
Here is a data sample if needed:
| Author | Events | Subjects | Subgroup |
|---|---|---|---|
| Author1 | 191 | 201 | SubgroupA |
| Author2 | 90 | 105 | SubgroupA |
| Author3 | 164 | 192 | SubgroupA |
| Author4 | 51 | 59 | SubgroupB |
| Author5 | 23 | 29 | SubgroupB |
| Author6 | 37 | 42 | SubgroupB |
