statsExpressions (version 0.3.1)

expr_meta_parametric: Making expression with frequentist random-effects meta-analysis results

Description

This analysis is carried out using the metafor package. For more, see ?metafor::rma.

Usage

expr_meta_parametric(
  data,
  conf.level = 0.95,
  k = 2,
  messages = FALSE,
  output = "subtitle",
  caption = 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 for yi and sei arguments in metafor::rma (for parametric analysis) or metaplus::metaplus (for robust analysis).

conf.level

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

k

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

messages

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

output

Character describing the desired output. If "subtitle", a formatted subtitle with summary effect and statistical details will be returned, and if "caption", expression containing details from model summary will be returned. The other option is to return "tidy" data frame with coefficients or "glance" dataframe with model summaries.

caption

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

...

Arguments passed on to metafor::rma

vi

vector of length \(k\) with the corresponding sampling variances. See ‘Details’.

weights

optional argument to specify a vector of length \(k\) with user-defined weights. See ‘Details’.

ai

see below and the documentation of the escalc function for more details.

bi

see below and the documentation of the escalc function for more details.

ci

see below and the documentation of the escalc function for more details.

di

see below and the documentation of the escalc function for more details.

n1i

see below and the documentation of the escalc function for more details.

n2i

see below and the documentation of the escalc function for more details.

x1i

see below and the documentation of the escalc function for more details.

x2i

see below and the documentation of the escalc function for more details.

t1i

see below and the documentation of the escalc function for more details.

t2i

see below and the documentation of the escalc function for more details.

m1i

see below and the documentation of the escalc function for more details.

m2i

see below and the documentation of the escalc function for more details.

sd1i

see below and the documentation of the escalc function for more details.

sd2i

see below and the documentation of the escalc function for more details.

xi

see below and the documentation of the escalc function for more details.

mi

see below and the documentation of the escalc function for more details.

ri

see below and the documentation of the escalc function for more details.

ti

see below and the documentation of the escalc function for more details.

sdi

see below and the documentation of the escalc function for more details.

r2i

see below and the documentation of the escalc function for more details.

ni

see below and the documentation of the escalc function for more details.

mods

optional argument to include one or more moderators in the model. A single moderator can be given as a vector of length \(k\) specifying the values of the moderator. Multiple moderators are specified by giving a matrix with \(k\) rows and as many columns as there are moderator variables. Alternatively, a model formula can be used to specify the model. See ‘Details’.

measure

character string indicating the type of data supplied to the function. When measure="GEN" (default), the observed effect sizes or outcomes and corresponding sampling variances (or standard errors) should be supplied to the function via the yi, vi, and sei arguments (only one of the two, vi or sei, needs to be specified). Alternatively, one can set measure to one of the effect size or outcome measures described under the documentation for the escalc function and specify the needed data via the appropriate arguments.

intercept

logical indicating whether an intercept should be added to the model (the default is TRUE). Ignored when mods is a formula.

slab

optional vector with labels for the \(k\) studies.

subset

optional vector indicating the subset of studies that should be used for the analysis. This can be a logical vector of length \(k\) or a numeric vector indicating the indices of the observations to include.

add

see the documentation of the escalc function.

to

see the documentation of the escalc function.

drop00

see the documentation of the escalc function.

vtype

see the documentation of the escalc function.

method

character string specifying whether a fixed- or a random/mixed-effects model should be fitted. A fixed-effects model (with or without moderators) is fitted when using method="FE". Random/mixed-effects models are fitted by setting method equal to one of the following: "DL", "HE", "SJ", "ML", "REML", "EB", "HS", or "GENQ". Default is "REML". See ‘Details’.

weighted

logical indicating whether weighted (default) or unweighted estimation should be used to fit the model.

test

character string specifying how test statistics and confidence intervals for the fixed effects should be computed. By default (test="z"), Wald-type tests and CIs are obtained, which are based on a standard normal distribution. When test="knha", the method by Knapp and Hartung (2003) is used for adjusting test statistics and confidence intervals. See ‘Details’.

digits

integer specifying the number of decimal places to which the printed results should be rounded (if unspecified, the default is 4).

btt

optional vector of indices specifying which coefficients to include in the omnibus test of moderators. See ‘Details’.

verbose

logical indicating whether output should be generated on the progress of the model fitting (the default is FALSE). Can also be an integer. Values > 1 generate more verbose output. See ‘Note’.

control

optional list of control values for the iterative estimation algorithms. If unspecified, default values are defined inside the function. See ‘Note’.

Examples

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

# let's create a dataframe
df_results <-
  structure(
    .Data = list(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
    ), t.value = c(
      8.20590677855356, 23.6444603038067, 11.7300588415607,
      11.6187818146078, 15.3734833553524
    ), conf.low = c(
      0.290515146096969,
      0.715841986960399, 0.354354575031406, 0.46379116008131, 0.827446138277154
    ), conf.high = c(
      0.473580060546444, 0.845724236068931, 0.496860572498711,
      0.652939922388847, 1.08550155858277
    ), p.value = c(
      3.28679518728519e-15,
      4.04778497135963e-75, 7.59757330804449e-29, 5.45155840151592e-26,
      2.99171217913312e-13
    ), df.residual = c(
      394L, 358L, 622L, 298L,
      22L
    )),
    row.names = c(NA, -5L),
    class = c("tbl_df", "tbl", "data.frame")
  )

# making subtitle
expr_meta_parametric(
  data = df_results,
  k = 3,
  messages = FALSE
)

# getting tidy data frame with coefficients
expr_meta_parametric(
  data = df_results,
  messages = FALSE,
  output = "tidy"
)

# making caption
expr_meta_parametric(
  data = df_results,
  k = 2,
  messages = FALSE,
  output = "caption"
)

# getting dataframe with model summary
expr_meta_parametric(
  data = df_results,
  messages = FALSE,
  output = "glance"
)
# }

Run the code above in your browser using DataCamp Workspace