Message-ID: <AS8PR08MB91931B3235EC6C2F75BA7EA18B8FA@AS8PR08MB9193.eurprd08.prod.outlook.com>
Date: 2023-12-11T09:26:44Z
From: Wolfgang Viechtbauer
Subject: [R-meta] About meta-regression analysis
In-Reply-To: <CAPm5Ok2LzzG5RCYKJSBCXKegsiqymrc6uaQ_ztR596nrg435dw@mail.gmail.com>
Dear Nick,
One does not have to manually change a categorical moderator into a numerical one to examine interactions. Of course, categorical moderators are represented in a model in terms of numerical variables (typically via a set of dummy variables), but R can handle all of this encoding for you automatically. Here is an example with two categorical variables, one consisting of two levels, the other with three levels:
https://www.metafor-project.org/doku.php/tips:multiple_factors_interactions
Best,
Wolfgang
> -----Original Message-----
> From: R-sig-meta-analysis <r-sig-meta-analysis-bounces at r-project.org> On Behalf
> Of ?????? via R-sig-meta-analysis
> Sent: Monday, December 11, 2023 08:38
> To: r-sig-meta-analysis at r-project.org
> Cc: ?????? <t571 at wlgsh.tp.edu.tw>
> Subject: [R-meta] About meta-regression analysis
>
> Hello all,
> As I read through the "Doing meta in R" website and to the part of
> meta-regression, this is the example that the website provides in order to
> change the categorical moderators into numerical ones (since you need
> "numbers" to begin to test the interaction between moderators):
> --------------------------------------------------------------------
> # Add factor labels to 'continent'
> # 0 = Europe
> # 1 = North America
> levels(MVRegressionData$continent) = c("Europe", "North America")
> --------------------------------------------------------------------
> and I thought of my own data. I have a moderator in my data named "Duration
> of treatment," with "Short", "Medium", "Long" and "N/A"(some of the studies
> didn't provide the duration of treatment). In this case, how would I code
> in order to change this moderator into numerical order to begin the
> meta-regression analysis?
> Nick
> ??? (Nick Chen)
> Email: t571 at wlgsh.tp.edu.tw <t5741 at wlgsh.tp.edu.tw>