[R-meta] I2 for a multilevel model with subsets

Viechtbauer, Wolfgang (SP) wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Thu Aug 26 14:15:11 CEST 2021


Dear Tharaka,

Try:

W <- diag(m1$vi)

Best,
Wolfgang

>-----Original Message-----
>From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces using r-project.org] On
>Behalf Of Tharaka S. Priyadarshana
>Sent: Thursday, 26 August, 2021 13:15
>To: r-sig-meta-analysis using r-project.org
>Subject: [R-meta] I2 for a multilevel model with subsets
>
>Dear all,
>
>I am trying to calculate I2 for a multilevel model with subsets –
>following this,
>https://www.metafor-project.org/doku.php/tips:i2_multilevel_multivariate
>
>My model looks like as below,
>m1<- rma.mv(yi, vi, random = ~ 1 | Study_ID / Sub_sudy_ID, data=dat,
>subset=(Taxa_treatment=="Abundance")&(Taxa_fine=="Coleoptera"))
>
>Then I ran,
>W <- diag(1/dat$vi) # this work
>X <- model.matrix(m1) # this work
>P <- W - W %*% X %*% solve(t(X) %*% W %*% X) %*% t(X) %*% W # this does not
>work
>Here I get the following error message,
>"Error in W %*% X : non-conformable arguments"
>
>Could someone please help me with this.
>
>Thank you,
>Tharaka


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