An HTML attachment was scrubbed... URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20230317/e2cea8bf/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: 07E6B0FED9334E889B0D1CA01BC402CE.png Type: image/png Size: 2336 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20230317/e2cea8bf/attachment.png> -------------- next part -------------- A non-text attachment was scrubbed... Name: 18A62EF59EF649C5903A71D147066AA8.png Type: image/png Size: 1491 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20230317/e2cea8bf/attachment-0001.png> -------------- next part -------------- A non-text attachment was scrubbed... Name: 1AA8D9C5AB54460BA519F64955015C66.png Type: image/png Size: 855 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20230317/e2cea8bf/attachment-0002.png> -------------- next part -------------- A non-text attachment was scrubbed... Name: A00C288E1A044FBC9E16B6D37BF06BC3.jpg Type: image/jpeg Size: 1279 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20230317/e2cea8bf/attachment.jpg> -------------- next part -------------- A non-text attachment was scrubbed... Name: A7D6181A72C34F60B85632BCD8A8408D.png Type: image/png Size: 1294 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20230317/e2cea8bf/attachment-0003.png> -------------- next part -------------- A non-text attachment was scrubbed... Name: A9A8A9FFAC1A451691F9A1AC9C27A293.png Type: image/png Size: 1321 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20230317/e2cea8bf/attachment-0004.png> -------------- next part -------------- A non-text attachment was scrubbed... Name: BB89D61EE1EE47EAAB7CF3D76D6D7274.png Type: image/png Size: 479 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20230317/e2cea8bf/attachment-0005.png> -------------- next part -------------- A non-text attachment was scrubbed... Name: E04A062320094EDBB36B3BB1A9B9B8FA.png Type: image/png Size: 471 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20230317/e2cea8bf/attachment-0006.png>
[R-meta] predict error in metafor
9 messages · Fatih ÇELİK, Wolfgang Viechtbauer, Fatih Çelik
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 at 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 at 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 at trabzon.edu.tr? ?fatihcelik2842 at gmail.com
An HTML attachment was scrubbed... URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20230317/8994590e/attachment.html>
That is correct. Best, Wolfgang
-----Original Message----- From: Fatih ?EL?K [mailto:fatihcelik2842 at 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 at 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 at 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 at trabzon.edu.tr? ?fatihcelik2842 at gmail.com
An HTML attachment was scrubbed... URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20230317/e2522311/attachment-0001.html>
An HTML attachment was scrubbed... URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20230317/2048e10e/attachment.html>
When fitting the model, use rma(..., test="knha"). P.S.: Please post in plain text, as explained here: https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis Best, Wolfgang
-----Original Message----- From: Fatih ?EL?K [mailto:fatihcelik2842 at gmail.com] Sent: Friday, 17 March, 2023 21:59 To: Viechtbauer, Wolfgang (NP); R Special Interest Group for Meta-Analysis Subject: Ynt: predict error in metafor I am sorry, sir? I have one more question. How can I apply "Knapp-Hartung's statistic for testing the significance" by following the codes mentioned before? I need F, R2, and Qw results for Avova results. --- ?yi ?al??malar dilerim? Yours sincerely?
1 day later
Hello, sir.
As you pointed out, when I run the Knapp-Hartung test, Qw (statistic
for testing the model misspecification) does not appear in the output.
How can I access this value? Below I first present to you the model I
created and then the output.
Model:
res1 <- rma(measure="ARAW", ai=ai, mi=mi, ni=ni, mods = ~ sample,
test="knha", data=dat)
outputs:
Mixed-Effects Model (k = 85; tau^2 estimator: REML)
tau^2 (estimated amount of residual heterogeneity): 0.0021 (SE = 0.0004)
tau (square root of estimated tau^2 value): 0.0457
I^2 (residual heterogeneity / unaccounted variability): 94.01%
H^2 (unaccounted variability / sampling variability): 16.70
R^2 (amount of heterogeneity accounted for): 0.00%
Test for Residual Heterogeneity:
QE(df = 83) = 2139.6714, p-val < .0001
Test of Moderators (coefficient 2):
F(df1 = 1, df2 = 83) = 0.9652, p-val = 0.3287
Model Results:
estimate se tval df pval ci.lb ci.ub
intrcpt 0.8286 0.0102 81.0985 83 <.0001 0.8083 0.8489 ***
samplestudent -0.0117 0.0119 -0.9825 83 0.3287 -0.0354 0.0120
---
Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
---
Yours sincerely?
Kimden: Viechtbauer, Wolfgang (NP)
G?nderilme: 18 Mart 2023 Cumartesi 15:57
Kime: Fatih ?EL?K; R Special Interest Group for Meta-Analysis
Konu: RE: predict error in metafor
When fitting the model, use rma(..., test="knha").
P.S.: Please post in plain text, as explained here:
https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis
Best,
Wolfgang
-----Original Message-----
From: Fatih ?EL?K [mailto:fatihcelik2842 at gmail.com]
Sent: Friday, 17 March, 2023 21:59
To: Viechtbauer, Wolfgang (NP); R Special Interest Group for Meta-Analysis
Subject: Ynt: predict error in metafor
I am sorry, sir?
I have one more question.
How can I apply "Knapp-Hartung's statistic for testing the significance" by
following the codes mentioned before? I need F, R2, and Qw results for Avova
results.
---
?yi ?al??malar dilerim?
Yours sincerely?
The F-test replaces the Qw statistic when using test="knha" (it tests the same thing, but now based on the K&H method). Best, Wolfgang
-----Original Message-----
From: Fatih ?elik [mailto:fatihcelik2842 at gmail.com]
Sent: Monday, 20 March, 2023 12:23
To: Viechtbauer, Wolfgang (NP); R Special Interest Group for Meta-Analysis
Subject: Ynt: predict error in metafor
Hello, sir.
As you pointed out, when I run the Knapp-Hartung test, Qw (statistic
for testing the model misspecification) does not appear in the output.
How can I access this value? Below I first present to you the model I
created and then the output.
Model:
res1 <- rma(measure="ARAW", ai=ai, mi=mi, ni=ni, mods = ~ sample,
test="knha", data=dat)
outputs:
Mixed-Effects Model (k = 85; tau^2 estimator: REML)
tau^2 (estimated amount of residual heterogeneity): 0.0021 (SE = 0.0004)
tau (square root of estimated tau^2 value): 0.0457
I^2 (residual heterogeneity / unaccounted variability): 94.01%
H^2 (unaccounted variability / sampling variability): 16.70
R^2 (amount of heterogeneity accounted for): 0.00%
Test for Residual Heterogeneity:
QE(df = 83) = 2139.6714, p-val < .0001
Test of Moderators (coefficient 2):
F(df1 = 1, df2 = 83) = 0.9652, p-val = 0.3287
Model Results:
estimate se tval df pval ci.lb ci.ub
intrcpt 0.8286 0.0102 81.0985 83 <.0001 0.8083 0.8489 ***
samplestudent -0.0117 0.0119 -0.9825 83 0.3287 -0.0354 0.0120
---
Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
---
Yours sincerely?
Kimden: Viechtbauer, Wolfgang (NP)
G?nderilme: 18 Mart 2023 Cumartesi 15:57
Kime: Fatih ?EL?K; R Special Interest Group for Meta-Analysis
Konu: RE: predict error in metafor
When fitting the model, use rma(..., test="knha").
P.S.: Please post in plain text, as explained here:
https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis Best, Wolfgang