[R-meta] model selection using the glmulti
Dear Wolfgang, The attachments were my raw data (shuai. csv), the code (shuai. txt), and my results/question/explain (suhai. docx). I put my figures and table in the word, all in all, I don't know why these two methods led to different results, and I hope you can help me. Thank you very much. Yours, sincerely Shuai
At 2019-06-02 02:49:22, "Viechtbauer, Wolfgang (SP)" <wolfgang.viechtbauer at maastrichtuniversity.nl> wrote:
Dear Shuai, Please always cc the mailing list. The results are only contradictory in so far that two different methods are leading to different conclusions. Maybe climate becomes only relevant when other moderators are included in the model. Without the data and reproducible code, I cannot tell you what is going on. Best, Wolfgang -----Original Message----- From: shuai [mailto:zss_1994 at 163.com] Sent: Monday, 27 May, 2019 14:53 To: Viechtbauer, Wolfgang (SP) Subject: Re:RE: [R-meta] model selection using the glmulti Dear. Wolfgang Thank you very much for your reply! I have used the code you gave for model selection. And I got this figure: and we can see that climate is important. (>0.8 climate include arid and humid) But when I calculate the Qm of climate using the code as follow: r4<-rma(yi,vi, mods=~climate, data=eff1, method="REML") I got the result:Qm=0.0467, p=0.8289 so this result means the climate is not important? Are the results of these two methods contradictory? Looking forward to your reply, Best wishes, Shuai At 2019-05-27 17:26:39, "Viechtbauer, Wolfgang (SP)" <wolfgang.viechtbauer at maastrichtuniversity.nl> wrote:
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):
library(metafor)
library(glmulti)
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)
print(res)
weightable(res)
plot(res)
plot(res, type="s")
# check the fit of a model that includes alloc
summary(res at objects[[5]])
Best,
Wolfgang
-----Original Message-----
From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces at r-project.org] On Behalf Of shuai
Sent: Monday, 27 May, 2019 4:51
To: r-sig-meta-analysis at 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,
Shuai
-------------- next part -------------- An HTML attachment was scrubbed... URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20190602/d6cebcc9/attachment-0001.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: shuai.csv Type: application/octet-stream Size: 11980 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20190602/d6cebcc9/attachment-0001.obj> -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: shuai.txt URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20190602/d6cebcc9/attachment-0001.txt> -------------- next part -------------- A non-text attachment was scrubbed... Name: shuai.docx Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document Size: 96229 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20190602/d6cebcc9/attachment-0001.docx>