[R-meta] model selection using the glmulti

Viechtbauer, Wolfgang (SP) wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Mon May 27 11:26:39 CEST 2019

Dear Shuai,

The example you linked to uses a mixture of continuous and dummy variables. Factors are typically encoded as dummy variables, so as long as your factors only have two levels, it's really the same thing. Factors with more than two levels are typically encoded as a bunch of dummy variables, but we typically do not want to enter/remove individual dummy variables, but the whole factor. Fortunately, this all works like a charm with metafor + glmulti. Here is an example (year and ablat are continuous, alloc is a three-level factor):


dat <- dat.bcg
dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg)

rma.glmulti <- function(formula, data, ...)
   rma(formula, vi, data=data, method="ML", ...)

res <- glmulti(yi ~ year + ablat + alloc, data=dat,
               level=1, fitfunction=rma.glmulti, crit="aicc", confsetsize=8, plotty=FALSE)

plot(res, type="s")

# check the fit of a model that includes alloc
summary(res using objects[[5]])


-----Original Message-----
From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces using r-project.org] On Behalf Of shuai
Sent: Monday, 27 May, 2019 4:51
To: r-sig-meta-analysis using r-project.org
Subject: [R-meta] model selection using the glmulti

Dear Mr./Ms.

I'd like to perform a model selection using the glmulti(http://www.metafor-project.org/doku.php/tips:model_selection_with_glmulti_and_mumin),

I noticed that there are only continuous variables(length, wic, feedback, infor, pers, imag, meta) in this example: res <- glmulti(yi ~ length+ wic + feedback + info + pers + imag + meta, data=dat,
level=1, fitfunction=rma.glmulti, crit="aicc", confsetsize=128)

What if I have continuous variables and categorical variables?  such as distance:1,2,3,10,20km...etc, and ecosystem types: grassland, wetland, cropland...etc

Any help you can provide would be really appreciated!

Thank you very much and looking forward to your reply!
Best wishes,

More information about the R-sig-meta-analysis mailing list