Learn R Programming

statsExpressions (version 0.2.1)

bf_meta: Bayes factor message for random-effects meta-analysis

Description

Bayes factor message for random-effects meta-analysis

Usage

bf_meta(
  data,
  d = prior("norm", c(mean = 0, sd = 0.3)),
  tau = prior("invgamma", c(shape = 1, scale = 0.15)),
  k = 2,
  caption = NULL,
  messages = TRUE,
  ...
)

Arguments

data

data frame containing the variables for effect size y, standard error SE, labels, and moderators per study.

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.

k

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

caption

Text to display as caption. This argument is relevant only when output = "caption".

messages

Decides whether messages references, notes, and warnings are to be displayed (Default: TRUE).

...

Arguments passed on to metaBMA::meta_random

labels

optional: character values with study labels. Can be a character vector or the quoted or unquoted name of the variable in data

rscale_contin

scale parameter of the JZS prior for the continuous covariates.

rscale_discrete

scale parameter of the JZS prior for discrete moderators.

centering

whether continuous moderators are centered.

logml

how to estimate the log-marginal likelihood: either by numerical integration ("integrate") or by bridge sampling using MCMC/Stan samples ("stan"). To obtain high precision with logml="stan", many MCMC samples are required (e.g., logml_iter=10000, warmup=1000).

summarize

how to estimate parameter summaries (mean, median, SD, etc.): Either by numerical integration (summarize = "integrate") or based on MCMC/Stan samples (summarize = "stan").

ci

probability for the credibility/highest-density intervals.

rel.tol

relative tolerance used for numerical integration using integrate. Use rel.tol=.Machine$double.eps for maximal precision (however, this might be slow).

logml_iter

number of iterations (per chain) from the posterior distribution of d and tau. The samples are used for computing the marginal likelihood of the random-effects model with bridge sampling (if logml="stan") and for obtaining parameter estimates (if summarize="stan"). Note that the argument iter=2000 controls the number of iterations for estimation of the random-effect parameters per study in random-effects meta-analysis.

silent_stan

whether to suppress the Stan progress bar.

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")
  ))

# getting Bayes factor in favor of null hypothesis
bf_meta(
  data = df,
  k = 3,
  iter = 1500,
  messages = TRUE
)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab