Learn R Programming

metafor (version 0.5-0)

fitstats.rma: Fit Statistics and Information Criteria for rma Objects

Description

The function extracts the log likelihood, deviance, AIC, and BIC values from objects of class "rma".

Usage

## S3 method for class 'rma':
fitstats(x, REML=NULL, ...)

Arguments

x
an object of class "rma".
REML
logical indicating whether the regular or restricted likelihood function should be used to obtain the fit statistics and information criteria. When NULL (default), the regular likelihood is used, unless restricted maximum likelihood estimatio
...
other arguments.

Value

  • A column vector with the log likelihood, deviance, AIC, and BIC values.

See Also

rma.uni, rma.mh, rma.peto

Examples

Run this code
### load BCG vaccine data
data(dat.bcg)

### meta-analysis of the log risk rates using a random-effects model
res1 <- rma(ai=tpos, bi=tneg, ci=cpos, di=cneg, 
            data=dat.bcg, measure="RR", method="ML")
fitstats(res1)

### mixed-effects model with two moderators (latitude and publication year)
res2 <- rma(ai=tpos, bi=tneg, ci=cpos, di=cneg, mods=cbind(ablat, year),
            data=dat.bcg, measure="RR", method="ML")
fitstats(res2)

### LR-test of the two moderators 
### note: must use ML to compare models with different fixed effects
pchisq(fitstats(res1)[2] - fitstats(res2)[2], df=2, lower.tail=FALSE)

### LR-test of the amount of residual heterogeneity 
### note: REML is usually better for testing variance components
### note: need to halve the p-value since the test is one-sided
res2 <- rma(ai=tpos, bi=tneg, ci=cpos, di=cneg, mods=cbind(ablat, year),
            data=dat.bcg, measure="RR", method="REML")
res3 <- rma(ai=tpos, bi=tneg, ci=cpos, di=cneg, mods=cbind(ablat, year),
            data=dat.bcg, measure="RR", method="REML", tau2=0)
pchisq(fitstats(res3)[2] - fitstats(res2)[2], df=1, lower.tail=FALSE) / 2

Run the code above in your browser using DataLab