Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

fitstats

Fit Statistics and Information Criteria for 'rma' Objects


Description

Functions to extract the log-likelihood, deviance, AIC, BIC, and AICc values from objects of class "rma".

Usage

fitstats(object, ...)

## S3 method for class 'rma'
fitstats(object, ..., REML)

## S3 method for class 'rma'
logLik(object, REML, ...)
## S3 method for class 'rma'
deviance(object, REML, ...)

## S3 method for class 'rma'
AIC(object, ..., k=2, correct=FALSE)
## S3 method for class 'rma'
BIC(object, ...)

Arguments

object

an object of class "rma".

...

optionally more fitted model objects.

REML

logical indicating whether the regular or restricted likelihood function should be used to obtain the fit statistics and information criteria. Defaults to the method of estimation used, that is TRUE if object was fitted with method="REML" and FALSE otherwise.

k

numeric value specifying the penalty per parameter to use. The default (k=2) is the classical AIC. See AIC for more details.

correct

logical indicating whether the regular (default) or corrected (i.e., AICc) should be extracted.

Value

For fitstats, a data frame with the (restricted) log-likelihood, deviance, AIC, BIC, and AICc values for each model passed to the function.

For logLik, an object of class "logLik", providing the (restricted) log-likelihood of the model evaluated at the estimated coefficient(s).

For deviance, a numeric value with the corresponding deviance.

For AIC and BIC, either a numeric value with the corresponding AIC, AICc, or BIC or a data frame with rows corresponding to the models and columns representing the number of parameters in the model (df) and the AIC, AICc, or BIC.

Note

Variance components in the model (e.g., τ² in random/mixed-effects models) are counted as additional parameters in the calculation of the AIC, BIC, and AICc. Also, the fixed effects are counted as parameters in the calculation of the AIC, BIC, and AICc even when using REML estimation.

Author(s)

References

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

See Also

Examples

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

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

fitstats(res1, res2)

logLik(res1)
logLik(res2)

deviance(res1)
deviance(res2)

AIC(res1, res2)
AIC(res1, res2, correct=TRUE)
BIC(res1, res2)

metafor

Meta-Analysis Package for R

v2.4-0
GPL (>= 2)
Authors
Wolfgang Viechtbauer [aut, cre] (<https://orcid.org/0000-0003-3463-4063>)
Initial release
2020-03-19

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.