Learn R Programming

tidyBF (version 0.4.0)

bf_meta_random: Bayes factor for random-effects meta-analysis

Description

Bayes factor for random-effects meta-analysis

Usage

bf_meta_random(
  data,
  d = prior("norm", c(mean = 0, sd = 0.3)),
  tau = prior("invgamma", c(shape = 1, scale = 0.15)),
  metaBMA.args = list(),
  ...
)

Arguments

data

A dataframe. It must contain columns named estimate (effect sizes or outcomes) and std.error (corresponding standard errors). These two columns will be used for y and SE arguments in metaBMA::meta_random.

d

prior distribution on the average effect size d. The prior probability density function is defined via prior.

tau

prior distribution on the between-study heterogeneity tau (i.e., the standard deviation of the study effect sizes dstudy in a random-effects meta-analysis. A (nonnegative) prior probability density function is defined via prior.

metaBMA.args

A list of additional arguments to be passed to metaBMA::meta_random.

...

Arguments passed on to bf_extractor

conf.level

Confidence/Credible Interval (CI) level. Default to 0.95 (95%).

centrality

The point-estimates (centrality indices) to compute. Character (vector) or list with one or more of these options: "median", "mean", "MAP" or "all".

conf.method

The type of index used for Credible Interval. Can be "hdi" (default, see bayestestR::hdi()), "eti" (see bayestestR::eti()) or "si" (see bayestestR::si()).

k

Number of digits after decimal point (should be an integer) (Default: k = 2L).

top.text

Text to display as top.text (will be displayed on top of the Bayes Factor top.text/message).

output

If "expression", will return expression with statistical details, while "dataframe" will return a dataframe containing the results.

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
# setup
set.seed(123)
library(metaBMA)

# creating a dataframe
(df <-
  structure(
    .Data = list(
      study = c("1", "2", "3", "4", "5"),
      estimate = c(
        0.382047603321706,
        0.780783111514665,
        0.425607573765058,
        0.558365541235078,
        0.956473848429961
      ),
      std.error = c(
        0.0465576338644502,
        0.0330218199731529,
        0.0362834986178494,
        0.0480571500648261,
        0.062215818388157
      )
    ),
    row.names = c(NA, -5L),
    class = c("tbl_df", "tbl", "data.frame")
  ))

# to get dataframe
bf_meta_random(
  data = df,
  k = 3,
  metaBMA.args = list(iter = 500, rscale_discrete = 0.880),
  output = "dataframe"
)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab