Learn R Programming

statsExpressions (version 0.6.0)

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",
  d = prior("norm", c(mean = 0, sd = 0.3)),
  tau = prior("invgamma", c(shape = 1, scale = 0.15)),
  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.

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.

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

# making subtitle
expr_meta_random(
  data = df,
  k = 3
)

# making caption
expr_meta_random(
  data = df,
  output = "caption"
)

# ----------------------- 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`
  iter = 5000,
  summarize = "integrate",
  control = list(adapt_delta = 0.99, max_treedepth = 15)
)
# }

Run the code above in your browser using DataLab