Learn R Programming

statsExpressions (version 1.1.0)

meta_analysis: Random-effects meta-analyses

Description

A dataframe containing results from random-effects meta-analysis.

To see details about functions which are internally used to carry out these analyses, see the following vignette- https://indrajeetpatil.github.io/statsExpressions/articles/stats_details.html

Usage

meta_analysis(
  data,
  type = "parametric",
  random = "mixture",
  k = 2L,
  conf.level = 0.95,
  top.text = NULL,
  ...
)

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:

  • as yi and sei arguments in metafor::rma (for parametric test) or metaplus::metaplus (for robust test)

  • as y and SE arguments in metaBMA::meta_random (for Bayesian test).

type

A character specifying the type of statistical approach:

  • "parametric"

  • "nonparametric"

  • "robust"

  • "bayes"

You can specify just the initial letter.

random

The type of random effects distribution. One of "normal","t-dist","mixture", for standard normal, \(t\)-distribution or mixture of normals respectively.

k

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

conf.level

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

top.text

Text to display on top of the Bayes Factor message. This is mostly relevant in the context of ggstatsplot functions.

...

Additional arguments passed to the respective meta-analysis function.

Examples

Run this code
# NOT RUN {
# run examples only if the needed packages are available
if (all(unlist(lapply(
  c("metaplus", "metafor", "metaBMA"), # needed packages
  require,
  character.only = TRUE,
  quietly = TRUE,
  warn.conflicts = FALSE
)))) {
  # note that the `print` calls below are not necessary for you to write
  # they are in the documentation so that the website renders them

  # setup
  set.seed(123)
  library(statsExpressions)
  options(tibble.width = Inf, pillar.bold = TRUE, pillar.neg = TRUE)

  # renaming to what `statsExpressions` expects
  df <- dplyr::rename(mag, estimate = yi, std.error = sei)

  # ----------------------- parametric ---------------------------------------

  print(meta_analysis(data = df))

  # ----------------------- random -----------------------------------------

  print(meta_analysis(
    data = df,
    type = "random",
    random = "normal"
  ))

  # ----------------------- Bayes Factor -----------------------------------

  meta_analysis(
    data = df,
    type = "bayes",

    # additional arguments given to `metaBMA`
    iter = 5000,
    summarize = "integrate",
    control = list(adapt_delta = 0.99, max_treedepth = 15)
  )
}
# }

Run the code above in your browser using DataLab