Learn R Programming

bayesmeta (version 3.4)

weightsplot: Illustrate the posterior mean weights for a bayesmeta object.

Description

Generates a bar plot showing individual estimates' posterior mean weights, either for the overall mean estimate, or for a shrinkage estimate.

Usage

weightsplot(x, ...)
  # S3 method for bayesmeta
weightsplot(x, individual=FALSE, ordered=TRUE,
            extramargin=4, priorlabel="prior mean", main, xlim, ...)

Arguments

x

a bayesmeta object.

individual

this argument allows to request weights for individual shrinkage estimates. If FALSE (the default), weights for the overall mean are returned. Otherwise, it may be an integer number (1,...,k) giving the index, or a character string giving the label.

ordered

a logical flag indicating whether to sort weights by their magnitude.

extramargin

an additional margin to be added to the left side of the plot, in order to accomodate the estimates' labels. The value will be added to the 2nd element of the margin settings given by ‘par("mar")’. In case study labels still extend beyond the figure margin, try increasing this number. See also the par() function's help.

priorlabel

the label for the effect prior's weight. Only relevant for proper effect priors.

main

the plot's main title.

xlim

the x-axis range.

...

other arguments passed on to the barplot() function.

Details

The individual estimates' contributions to the overall mean estimate are commonly illustrated in terms of weights, as the resulting overall estimate may be expressed as a weighted average of the estimates contributing to the analysis. The notion of “study weights” may also be extended to the Bayesian setting, where these result as posterior mean weights. Analogous weights may also be derived for shrinkage estimates (Roever and Friede, 2021).

This function generates a simple bar plot illustrating the posterior mean weights. The actual numbers are taken from the bayesmeta object's “$weights” or “$weights.theta” elements.

References

C. Roever, T. Friede. Bounds for the weight of external data in shrinkage estimation. Biometrical Journal, 65(5):1131-1143, 2021. tools:::Rd_expr_doi("10.1002/bimj.202000227").

See Also

bayesmeta.

Examples

Run this code
# load example data:
data("Peto1980")
if (FALSE) {
# compute effect sizes (log odds ratios) from count data:
require("metafor")
peto.es <- escalc(measure="OR",
                  ai=treat.events,   n1i=treat.cases,
                  ci=control.events, n2i=control.cases,
                  slab=publication, data=Peto1980)

# perform meta-analysis:
ma01 <- bayesmeta(peto.es)
# show data and results:
forestplot(ma01)

# check out weights:
ma01$weights
ma01$weights.theta

# illustrate weights:
weightsplot(ma01)
weightsplot(ma01, ordered=FALSE)
weightsplot(ma01, ordered=FALSE, individual="BrMedJ1974")
}

Run the code above in your browser using DataLab