Skip to contents

This function summarizes the output of generalTestBF(..., whichModels = "top") from the BayesFactor package. It computes the Bayes factor (BF) in favor of excluding each variable from the full model, and classifies the strength of evidence based on the log BF scale.

Usage

summary_generalTestBF(x, inc_ranef = FALSE)

Arguments

x

An object returned by generalTestBF(), or a named list containing:

res_BF

An object returned by generalTestBF()

variables

Character vector of variable names

full_model_vars

Character vector of variables in the full model

inc_ranef

Logical. Whether to output results of random effects.

Value

A tibble with one row per model comparison. Columns include:

effect

The effect excluded from the full model

type

Indicates whether the term is Fixed or random effect

BF

Bayes factor for the null (exclusion) over the alternative hypothesis

error

Estimated numerical error

log10_BF

Base-10 logarithm of the Bayes factor

favor

Indicates whether data favor the null or alternative hypothesis

evidence

Strength of evidence ("anecdotal", "moderate", "strong", "very strong", "extreme")

Examples

library(BayesFactor)
set.seed(123)
dat <- data.frame(
 id = as.factor(rep(1:30, each = 4)),
 A = as.factor(rep(c("low", "high"), times = 60)),
 B = as.factor(rep(c("left", "right"), each = 2, times = 30)),
 y = rnorm(120)
)

res <- generalTestBF(
 y ~ A + B + A:B + id + A:id + B:id,
 data = dat,
 whichRandom = c("id", "A:id", "B:id"),
 whichModels = "top"
)

summary_generalTestBF(res)
#> Error in str_detect(full_model_vars, "s"): could not find function "str_detect"