Methods for objects of class "anova.rma" and "list.anova.rma".

# S3 method for class 'anova.rma'
as.data.frame(x, ...)
# S3 method for class 'list.anova.rma'
as.data.frame(x, ...)

Arguments

x

an object of class "anova.rma" or "list.anova.rma".

...

other arguments.

References

Viechtbauer, W. (2010). Conducting meta-analyses in R with the metafor package. Journal of Statistical Software, 36(3), 1–48. https://doi.org/10.18637/jss.v036.i03

Examples

### copy data into 'dat'
dat <- dat.bcg

### calculate log risk ratios and corresponding sampling variances
dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat)

### fit mixed-effects meta-regression model
res <- rma(yi, vi, mods = ~ alloc + ablat, data=dat)

### test the allocation factor
sav <- anova(res, btt="alloc")
sav
#> 
#> Test of Moderators (coefficients 2:3):
#> QM(df = 2) = 1.2850, p-val = 0.5260
#> 

### turn object into a regular data frame
as.data.frame(sav)
#>   coefs       QM df      pval
#> 1   2:3 1.285017  2 0.5259714

### test the contrast between levels random and systematic
sav <- anova(res, X=c(0,1,-1,0))
sav
#> 
#> Hypothesis:                                     
#> 1: allocrandom - allocsystematic = 0 
#> 
#> Results:
#>    estimate     se    zval   pval   
#> 1:  -0.3260 0.3104 -1.0501 0.2937   
#> 
#> Test of Hypothesis:
#> QM(df = 1) = 1.1027, p-val = 0.2937
#> 

### turn object into a regular data frame
as.data.frame(sav)
#>                                  hyp   estimate        se      zval      pval
#> 1: allocrandom - allocsystematic = 0 -0.3259536 0.3104031 -1.050098 0.2936731

### fit random-effects model
res0 <- rma(yi, vi, data=dat)

### LRT comparing the two models
sav <- anova(res, res0, refit=TRUE)
sav
#> 
#>         df     AIC     BIC    AICc   logLik     LRT   pval       QE  tau^2      R^2 
#> Full     5 24.0269 26.8517 32.5984  -7.0135                 26.2034 0.0294          
#> Reduced  2 29.3302 30.4601 30.5302 -12.6651 11.3032 0.0102 152.2330 0.2800 89.4967% 
#> 

### turn object into a regular data frame
as.data.frame(sav)
#>         df      AIC      BIC     AICc     logLik      LRT       pval        QE      tau^2      R^2
#> Full     5 24.02692 26.85167 32.59835  -7.013462       NA         NA  26.20344 0.02941209       NA
#> Reduced  2 29.33015 30.46005 30.53015 -12.665076 11.30323 0.01019428 152.23301 0.28002817 89.49674