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

# S3 method for anova.rma
as.data.frame(x, ...)
# S3 method for 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)
#> Error in anova.rma(res, res0, refit = TRUE): Refitting the full model with ML estimation failed.
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