Closed zenrabbit closed 5 years ago
Argument byvar must be a single variable, thus, lever*athletes does not work.
However, you can use interaction() to construct an interaction term:
mdata$lever.athletes <- interaction(mdata$lever, mdata$athletes)
metagen(percent, var, studlab = ID, byvar = lever.athletes, data = mdata)
An alternative would be to run a meta-regression using metareg() with lever*athletes which - for categorical covariates - is identical to running a subgroup analysis assuming a common between-study variance in subgroups (see argument tau.common in metagen() and section 4.4.1 in our book Meta-Analysis with R).
I love the meta package! Quick Q - can I use the byvar argument to do interaction terms or do I have to do one factor at a time? I checked your book and online and vignette.
example m <- metagen(percent, var, studlab = ID, byvar = lever, data = mdata)
but I have different athlete types, just two types - so I did this:
elite only
m <- metagen(percent, var, studlab = ID, byvar = lever, subset = athletes == "elite", data = mdata) summary(m)
active only
m <- metagen(percent, var, studlab = ID, byvar = lever, subset = athletes == "active", data = mdata) summary(m)
So, I am using byvar for the main factor and then subset for the second factor or level. Be great to be able just to do: byvar = lever*athletes or byvar = c(lever,athletes)
Error: Arguments 'TE' and 'byvar' must have the same length. etc
possible?