estimates: Extract results from meta-analysis object

View source: R/estimates.R

estimates.metaR Documentation

Extract results from meta-analysis object

Description

Extract study and meta-analysis results from meta-analysis object which can be stored in an Excel file.

Usage

## S3 method for class 'meta'
estimates(
  x,
  sortvar,
  study.results = TRUE,
  common = x$common,
  random = x$random,
  prediction = x$prediction,
  overall = x$overall,
  subgroup,
  prediction.subgroup = x$prediction.subgroup,
  se = FALSE,
  ci = TRUE,
  statistic = FALSE,
  pval = FALSE,
  n = TRUE,
  backtransf = x$backtransf,
  digits = gs("digits"),
  digits.se = gs("digits.se"),
  digits.stat = gs("digits.stat"),
  digits.pval = gs("digits.pval"),
  writexl = !missing(path),
  path = "estimates.xlsx",
  overwrite = FALSE,
  ...
)

estimates(x, ...)

## S3 method for class 'estimates.meta'
print(
  x,
  digits.tau = gs("digits.tau"),
  text.tau2 = gs("text.tau2"),
  text.tau = gs("text.tau"),
  big.mark = gs("big.mark"),
  details = TRUE,
  ...
)

Arguments

x

A meta-analysis object of class meta.

sortvar

An optional vector used to sort the individual studies (must be of same length as x$TE).

study.results

A logical indicating whether study results should be extracted.

common

A logical indicating whether results of common effect meta-analysis should be extracted.

random

A logical indicating whether results of random effects meta-analysis should be extracted.

prediction

A logical indicating whether prediction interval should be extracted.

overall

A logical indicating whether overall summaries should be extracted. This argument is useful in a meta-analysis with subgroups if overall results should not be extracted.

subgroup

A logical indicating whether subgroup results should be extracted.

prediction.subgroup

A single logical or logical vector indicating whether / which prediction intervals should be extracted for subgroups.

se

A logical indicating whether standard errors should be extracted.

ci

A logical indicating whether confidence / prediction interval should be extracted.

statistic

A logical indicating whether to extract statistic of test for overall effect.

pval

A logical indicating whether to extract p-value of test for overall effect.

n

A logical indicating whether sample sizes should be extracted (if available).

backtransf

A logical indicating whether extracted results should be back transformed.

digits

Minimal number of significant digits, see print.default.

digits.se

Minimal number of significant digits for standard errors, see print.default.

digits.stat

Minimal number of significant digits for z- or t-statistic for test of overall effect, see print.default.

digits.pval

Minimal number of significant digits for p-value of overall treatment effect, see print.default.

writexl

A logical indicating whether an Excel file should be created (R package writexl must be available).

path

A character string specifying the filename of the Excel file.

overwrite

A logical indicating whether an existing Excel file should be overwritten.

...

Additional arguments passed on to prmatrix.

digits.tau

Minimal number of significant digits for square root of between-study variance, see print.default.

text.tau2

Text printed to identify between-study variance \tau^2.

text.tau

Text printed to identify \tau, the square root of the between-study variance \tau^2.

big.mark

A character used as thousands separator.

details

A logical specifying whether details on statistical methods should be printed.

Details

Extract study and meta-analysis results from meta-analysis object. By default, a data frame with the results is generated. Alternatively, an Excel file is created if argument writexl = TRUE.

The following information is extracted.

Variable Content
studlab Study label / descriptor of meta-analysis result
estimate (Back transformed) estimate for individual studies / meta-analysis
se Standard error
lower Lower (back transformed) confidence / prediction interval limit
upper Upper (back transformed) confidence / prediction interval limit
k Number of studies
df Degrees of freedom for confidence / prediction intervals
statistic Statistic for test of effect
pval P-value for test of effect
n Total sample size
n.e Sample size in first (experimental) group
n.c Sample size in second (control) group

Some variables are only extracted if the corresponding logical argument se, ci, statistic or n is TRUE. Furthermore, (group) sample sizes are only extracted if available in the meta-analysis object.

The variables estimate, lower and upper contain the back transformed effects and confidence interval limits, e.g., odds ratio (argument sm = "OR" in metabin or metagen) or correlation (sm = "ZCOR" in metacor or metagen), if argument backtransf is TRUE. Otherwise, these variables contain the transformed values, e.g., log odds ratio (sm = "OR") or Fisher's Z transformed correlations (sm = "ZCOR"). See meta-sm for available summary measures and meta-transf for the corresponding transformations and back transformations.

Value

A data frame with additional class 'extract.meta' or an Excel file.

Author(s)

Guido Schwarzer guido.schwarzer@uniklinik-freiburg.de

See Also

meta-transf, meta-sm, as.data.frame.meta

Examples


m1 <- metacor(c(0.85, 0.7, 0.95), c(20, 40, 10))
summary(m1)
estimates(m1)
estimates(m1, backtransf = FALSE)
estimates(update(m1, common = FALSE, random = FALSE))
estimates(update(m1, prediction = TRUE))
estimates(update(m1, prediction = TRUE,
  level.ma = 0.99, level.predict = 0.9))

## Not run: 
# Create Excel file with extracted results
# (if R package writexl is available)
#
fname1 <- tempfile(fileext = ".xlsx")
estimates(m1, path = fname1)
# An existing Excel file is not overwritten but a warning is printed
estimates(m1, path = fname1)
# Overwrite an existing Excel file
estimates(m1, path = fname1, overwrite = TRUE)
# Suppress message on file creation and overwrite existing file
suppressMessages(estimates(m1, path = fname1, overwrite = TRUE))

# Save the extracted results in a text file
fname2 <- tempfile(fileext = ".csv")
fname2
write.csv(estimates(m1), file = fname2, row.names = FALSE)

## End(Not run)


guido-s/meta documentation built on April 18, 2024, 7:11 p.m.