Unlimited learning, half price | 50% off
Get 50% off unlimited learning

statsExpressions (version 0.6.2)

expr_meta_random: Making expression for random-effects meta-analysis

Description

Making expression for random-effects meta-analysis

Usage

expr_meta_random(
  data,
  type = "parametric",
  metaBMA.args = list(),
  random = "mixture",
  k = 2L,
  conf.level = 0.95,
  caption = NULL,
  output = "expression",
  ...
)

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 yi and sei arguments in metafor::rma (for parametric analysis) or metaplus::metaplus (for robust analysis).

type

Type of statistic expected ("parametric" or "nonparametric" or "robust" or "bayes").Corresponding abbreviations are also accepted: "p" (for parametric), "np" (nonparametric), "r" (robust), or "bf"resp.

metaBMA.args

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

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

Scalar between 0 and 1. If unspecified, the defaults return 95% confidence/credible intervals (0.95).

caption

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

output

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

...

Additional arguments passed to the respective meta-analysis function.

Details

This analysis is carried out using-

  • parametric: metafor::rma

  • robust: metaplus::metaplus

  • Bayesian: metaBMA::meta_random

Examples

Run this code
# NOT RUN {
# setup
set.seed(123)
library(statsExpressions)
library(metaplus)

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

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

# creating expression
expr_meta_random(data = df, k = 3)

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

# creating expression
expr_meta_random(
  data = df,
  type = "random",
  random = "normal",
  output = "dataframe"
)

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

# making subtitle
expr_meta_random(
  data = df,
  type = "bayes",
  k = 3,
  # additional arguments given to `metaBMA`
  metaBMA.args = list(
    iter = 5000,
    summarize = "integrate",
    control = list(adapt_delta = 0.99, max_treedepth = 15)
  )
)
# }

Run the code above in your browser using DataLab