plotMetaAnalysisForest {EvidenceSynthesis}R Documentation

Create a forest plot

Description

Creates a forest plot of effect size estimates, including the summary estimate.

Usage

plotMetaAnalysisForest(
  data,
  labels,
  estimate,
  xLabel = "Relative risk",
  summaryLabel = "Summary",
  limits = c(0.1, 10),
  alpha = 0.05,
  fileName = NULL
)

Arguments

data

A data frame containing either normal, skew-normal, custom parametric, or grid likelihood data. One row per database.

labels

A vector of labels for the data sources.

estimate

The meta-analytic estimate as created using either ['computeFixedEffectMetaAnalysis()⁠] or [⁠computeBayesianMetaAnalysis()'] function.

xLabel

The label on the x-axis: the name of the effect estimate.

summaryLabel

The label for the meta-analytic estimate.

limits

The limits of the effect size axis.

alpha

The alpha (expected type I error).

fileName

Name of the file where the plot should be saved, for example 'plot.png'. See the function ggplot2::ggsave ifor supported file formats.

Details

Creates a forest plot of effect size estimates, including a meta-analysis estimate.

Value

A Ggplot object. Use the ggplot2::ggsave function to save to file.

Examples

# Simulate some data for this example:
populations <- simulatePopulations()
labels <- paste("Data site", LETTERS[1:length(populations)])

# Fit a Cox regression at each data site, and approximate likelihood function:
fitModelInDatabase <- function(population) {
  cyclopsData <- Cyclops::createCyclopsData(Surv(time, y) ~ x + strata(stratumId),
                                            data = population,
                                            modelType = "cox")
  cyclopsFit <- Cyclops::fitCyclopsModel(cyclopsData)
  approximation <- approximateLikelihood(cyclopsFit, parameter = "x", approximation = "custom")
  return(approximation)
}
approximations <- lapply(populations, fitModelInDatabase)
approximations <- do.call("rbind", approximations)

# At study coordinating center, perform meta-analysis using per-site approximations:
estimate <- computeBayesianMetaAnalysis(approximations)
plotMetaAnalysisForest(approximations, labels, estimate)

# (Estimates in this example will vary due to the random simulation)


[Package EvidenceSynthesis version 0.3.0 Index]