ExtractMAStatistics: ExtractMAStatistics

View source: R/NPSimulation.R View source: R/MetaAnalysisForFamiliesOfExperimentsSR.R

ExtractMAStatisticsR Documentation

ExtractMAStatistics

Description

This function extracts summary statistics from meta-analysis results obtained from the rma function of the metafor R package. If required the function transform back to standardized mean difference (effect size type 'd' i.e. Hg) or point biserial correlations (effect size type 'r'). Warning: the ‘ExtractMAStatistics' function works with 'metafor' version 2.0-0, but changes to metafor’s method of providing access to its individual results may introduce errors into the function.

This function extracts summary statistics from meta-analysis results obtained from the rma function of the metafor R package. If required the function transform back to standardized mean difference (effect size type 'd' i.e. Hg) or point biserial correlations (effect size type 'r'). Warning: the ‘ExtractMAStatistics' function works with 'metafor' version 2.0-0, but changes to metafor’s method of providing access to its individual results may introduce errors into the function.

Usage

ExtractMAStatistics(
  maresults,
  Nc,
  Nt,
  Transform = TRUE,
  type = "d",
  sig = 4,
  returnse = FALSE
)

ExtractMAStatistics(
  maresults,
  Nc,
  Nt,
  Transform = TRUE,
  type = "d",
  sig = 4,
  returnse = FALSE
)

Arguments

maresults

is the output from the rma function.

Nc

is the number of participants in the control condition group.

Nt

is the number of participants in the treatment condition group.

Transform

is a boolean value indicating whether the outcome values need to be transformed back to standardized mean difference ('d' i.e. Hg or d) or point biserial correlations ('r'). It is defaulted to TRUE. If this parameter is set to FALSE, no transformation will be applied.

type

this indicates the type of transformation required - it defaults to 'd' which requests transformation from Zr to Hg, using 'r' requests transformation from Zr to r.

sig

indicates the number of significant digits requested in the output, the default is 4; it rounds the values of mean, pvalue, upper and lower bound to the specified number of significant digits.

returnse

if set to TRUE returns the standard error of the effect size (default: returnse=FALSE)

Value

data frame incl. summary statistics from meta-analysis results: overall mean value for the effect sizes, the p-value of the mean, the upper and lower confidence interval bounds (UB and LB), QE which is the heterogeneity test statistic and QEp which the the p-value of the heterogeneity statistic

data frame incl. summary statistics from meta-analysis results: overall mean value for the effect sizes, the p-value of the mean, the upper and lower confidence interval bounds (UB and LB), QE which is the heterogeneity test statistic and QEp which the the p-value of the heterogeneity statistic

Author(s)

Barbara Kitchenham and Lech Madeyski

Examples

ExpData <- reproducer::KitchenhamMadeyskiBrereton.ExpData
# Extract the experiment basic statics
S1data <- subset(ExpData, ExpData == "S1")
# Use the descriptive data to construct effect size
S1EffectSizes <- reproducer::PrepareForMetaAnalysisGtoR(
  S1data$Mc, S1data$Mt, S1data$SDc, S1data$SDt, S1data$Nc, S1data$Nt
)
# Do a random effect meta-analysis of the transformed r_pbs effect size
S1MA <- metafor::rma(S1EffectSizes$zr, S1EffectSizes$vi)
# Extract summary statistics from meta-analysis results and transform back to Hg scale
S1MAStats <- reproducer::ExtractMAStatistics(S1MA, sum(S1data$Nc), sum(S1data$Nt), TRUE, "d", 4)
#    mean   pvalue    UB     LB QE  QEp
# 1 0.6658 0.002069 1.122 0.2384  4 0.41
ExpData <- reproducer::KitchenhamMadeyskiBrereton.ExpData
# Extract the experiment basic statics
S1data <- subset(ExpData, ExpData == "S1")
# Use the descriptive data to construct effect size
S1EffectSizes <- reproducer::PrepareForMetaAnalysisGtoR(
  S1data$Mc, S1data$Mt, S1data$SDc, S1data$SDt, S1data$Nc, S1data$Nt
)
# Do a random effect meta-analysis of the transformed r_pbs effect size
S1MA <- metafor::rma(S1EffectSizes$zr, S1EffectSizes$vi)
# Extract summary statistics from meta-analysis results and transform back to Hg scale
ExtractMAStatistics(S1MA, sum(S1data$Nc), sum(S1data$Nt), TRUE, "d", 4)
#     mean   pvalue    UB     LB QE  QEp
# 1 0.6658 0.002069 1.122 0.2384  4 0.41
ExtractMAStatistics(S1MA, sum(S1data$Nc), sum(S1data$Nt), FALSE, "d", 4)
# A tibble: 1 x 6
#   mean  pvalue    UB    LB    QE   QEp
#  <dbl>   <dbl> <dbl> <dbl> <dbl> <dbl>
# 1 0.327 0.00207 0.535 0.119     4  0.41


reproducer documentation built on Oct. 18, 2023, 5:10 p.m.