[R-meta] predict error in metafor
Viechtbauer, Wolfgang (NP)
wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Fri Mar 17 21:03:25 CET 2023
That is correct.
Best,
Wolfgang
>-----Original Message-----
>From: Fatih ÇELİK [mailto:fatihcelik2842 using gmail.com]
>Sent: Friday, 17 March, 2023 20:34
>To: Viechtbauer, Wolfgang (NP); R Special Interest Group for Meta-Analysis
>Subject: Ynt: predict error in metafor
>
>Dear Viechtbauer,
>
>Firstly, thank you for your interest.
>
>I performed the analyses in line with your recommendations and obtained the
>following output.
>
>table(dat$publication)
>
>conference paper book section articles Thesis
> 1 1 58
> 25
>
>Test of Moderators (coefficients 2:4):
>QM(df = 3) = 2.4308, p-val = 0.4879
>
>Model Results:
>
> estimate se zval
> pval ci.lb ci.ub
>intrcpt 0.8700 0.0467 18.6136 <.0001 0.
>7784 0.9616
>publicationbook section -0.0100 0.0665 -0.1505 0.8804 -0.1402 0.1202
>publicationArticle -0.0487 0.0472 -1.0320 0.3020 -
>0.1411 0.0438
>publicationthesis -0.0571 0.0478 -1.1962 0.2316 -
>0.1507 0.0365
>
>> predict(res1, newmods=rbind(0,diag(3)), digits=3)
>
> pred se ci.lb ci.ub pi.lb pi.ub
>1 0.870 0.047 0.778 0.962 0.741 0.999
>2 0.860 0.047 0.767 0.953 0.731 0.989
>3 0.821 0.006 0.809 0.834 0.730 0.912
>4 0.813 0.010 0.794 0.832 0.721 0.905
>
>In this case, should I evaluate the predict results according to the order that
>appears after the table function? In other words, should I report the red number
>1 as "conference paper", the blue number 2 as "book section", the green number 3
>as "article", and the yellow number 4 as "thesis"?
>
>---
>İyi çalışmalar dilerim…
>Yours sincerely…
>
>Kimden: Viechtbauer, Wolfgang (NP)
>Gönderilme: 17 Mart 2023 Cuma 18:32
>Kime: R Special Interest Group for Meta-Analysis
>Bilgi: Fatih ÇELİK
>Konu: RE: predict error in metafor
>
>Dear Fatih,
>
>First of all, given that the error message says that the model matrix contains 4
>columns, there must be four levels to the 'publications' factor, not three (i.e.,
>aside from article, book sections, and thesis, there must be another level).
>
>table(dat$publications)
>
>will tell you what the levels are.
>
>And if you look at the output from 'res', you will see that the model contains
>three dummy variables, one for each level except the reference level,
>corresponding to the model intercept.
>
>So, to use predict(), you have to specify the values for the three dummy
>variables. In particular,
>
>predict(res, newmods=c(0,0,0), digits=3)
>predict(res, newmods=c(1,0,0), digits=3)
>predict(res, newmods=c(0,1,0), digits=3)
>predict(res, newmods=c(0,0,1), digits=3)
>
>will give you the predicted average effect (or in this case, alpha) for each
>level (including the reference level). Or more compactly:
>
>predict(res, newmods=rbind(0,diag(3)), digits=3)
>
>Best,
>Wolfgang
>
>>-----Original Message-----
>>From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces using r-project.org] On
>>Behalf Of Fatih ÇELIK via R-sig-meta-analysis
>>Sent: Friday, 17 March, 2023 15:30
>>To: r-sig-meta-analysis using r-project.org
>>Cc: Fatih ÇELİK
>>Subject: [R-meta] predict error in metafor
>>
>>Respected members,
>>
>>While doing meta-analysis (reliability generalization) on R metafor, I am
>having
>>trouble and I can't get over it.
>>
>>I want to do moderator analysis with a categorical variable feature over
>>"publications" (i.e. article, book sections, and thesis). For this, I use the
>>following code
>>
>>res<- rma(measure="ARAW", ai=ai, mi=mi, ni=ni, mods = ~ publications, data=dat)
>>res
>>predict(res, newmods=c(0, 1), digits=3)
>>
>>However, when I run predict code (recent code), it gives the following error.
>>
>>Error in predict.rma(res4, newmods = c(0, 1), digits = 3) :
>>Dimensions of 'newmods' (3) do not the match dimensions of the model (4).
>>
>>As far as I understand, it gives this error because there are more than two
>>categories. Because when I analyse a different variable with two categories
>(like
>>female and male), it does the “predict” operation without giving an error. Can
>>you help me, please? How else can I edit and run this code (predict)?
>>
>>Sincerely….
>>
>>Ph.D. Fatih ÇELİK
>>Trabzon Üniversitesi/Trabzon University
>>Vakfıkebir Meslek Yüksekokulu/Vakfikebir Vocational School
>>Pazarlama ve Reklamcılık Bölümü/Department of Marketing and Advertising
>>
>>Contact
>>0462 455 46 80-----4687-4685
>>fatihcelik using trabzon.edu.tr fatihcelik2842 using gmail.com
More information about the R-sig-meta-analysis
mailing list