Getting R squared from a multi-level model of a mixed effect in a metaphor

I am doing a meta-analysis on an R specific treatment in the woods. For this model, I need to adjust random effects to account for differences between researchers in the method and variations in the age of sites, since both of them are mixing variables, and I am not interested in studying the changes that he changed.

However, as far as I can tell, the package [metfor]does not allow you to calculate statistics like R when you have a multi-level model.

In any case, to describe my problem in more detail, this is a mock dataset

Log<-data.frame(Method=rep(c("RIL","Conv"),each=10),
     RU=runif(n=20,min=10,max=50),SDU=runif(n=20,5,20),
     NU=round(runif(n=20,10,20),0))
Log$Study<-rep(1:4,each=5)
Log$Age<-rep(c(0,10,15,10),times=5)
RIL<-(Log$RU-(Log$RU*(abs(rnorm(n=20,mean=.6,sd=0.1)))))+(0.5*Log$Age)
Conv<-(Log$RU-(Log$RU*(abs(rnorm(n=20,mean=.2,sd=0.1)))))+(0.2*Log$Age)
Log$RL<-ifelse(Log$Method=="RIL",RIL,Conv)
Log$SDL<-Log$SDU
Log$NL<-Log$NU

#now we perform a meta-analysis using metafor
require(metafor)
ROM<-escalc(data=Log,measure="ROM",m2i=RU,
sd2i=SDU,n2i=NU,m1i=RL,sd1i=SDL,n1i=NL,append=T)
Model1<-rma.mv(yi,vi,random=~(1|Study)+(1|Age),method="ML",data=ROM)
summary(Model1)
forest(Model1)

- , , . . , , , , enter image description here

, :

Model2<-rma.mv(yi,vi,mods=~Method,random=~(1|Study)+(1|Age),method="ML",data=ROM)
summary(Model2)

.

    Multivariate Meta-Analysis Model (k = 20; method: ML)

  logLik  Deviance       AIC       BIC      AICc  
  0.4725   19.8422    7.0550   11.0380    9.7217  

Variance Components: 

outer factor: Age   (nlvls = 3)
inner factor: Study (nlvls = 4)

            estim    sqrt  fixed
tau^2      0.0184  0.1357     no
rho        1.0000             no

Test for Residual Heterogeneity: 
QE(df = 18) = 23.3217, p-val = 0.1785

Test of Moderators (coefficient(s) 2): 
QM(df = 1) = 19.6388, p-val < .0001

Model Results:

           estimate      se     zval    pval    ci.lb    ci.ub     
intrcpt     -0.1975  0.1007  -1.9622  0.0497  -0.3948  -0.0002    *
MethodRIL   -0.4000  0.0903  -4.4316  <.0001  -0.5768  -0.2231  ***

---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

, , R. GLMM . , - - ? , , , , .

!

+4
1

, rma.mv(). , :

Model1 <- rma.mv(yi, vi, random = list(~ 1 | Study, ~ 1 | Age), method="ML", data=ROM)
Model2 <- rma.mv(yi, vi, mods = ~ Method, random = list(~ 1 | Study, ~ 1 | Age), method="ML", data=ROM)

, R-, - R. , . , :

(Model1$sigma2[1] - Model2$sigma2[1]) / Model1$sigma2[1]
(Model1$sigma2[2] - Model2$sigma2[2]) / Model1$sigma2[2]

, .

, :

(sum(Model1$sigma2) - sum(Model2$sigma2)) / sum(Model1$sigma2)
+3

Source: https://habr.com/ru/post/1531369/


All Articles