plot_RA_fits: Reference analysis plot based on bayesmeta fits: Plot...

View source: R/plot_RA_fits.R

plot_RA_fitsR Documentation

Reference analysis plot based on bayesmeta fits: Plot heterogeneity benchmark priors and the corresponding marginal posteriors

Description

Plots the benchmark heterogeneity priors inducing the specified model fits fits.bm and the corresponding marginal benchmark posteriors for different parameters in the NNHM. Also displays the actual heterogeneity priors inducing the specified actual model fits fits.actual and the corresponding marginal posteriors. All bayesmeta fits should be based on the same data set.

Usage

plot_RA_fits(fits.actual, fits.bm, type="pri.tau", xlim, ylim,
             legend=FALSE, pos.legend="topright",
             legend.tau.prior=c(), bty="o",
             col.actual=c("red","lightpink3","darkgreen","green",
                          "violetred")[1:length(fits.actual)],
             col.bm=c("cyan","black","blue","darkgray",
                      "dodgerblue")[1:length(fits.bm)],
             lty.actual=rep(2, times=length(col.actual)),
             lty.bm=rep(1, times=length(col.bm)),
             lwd.actual=rep(2, times=length(col.actual)),
             lwd.bm=rep(2, times=length(col.bm)))

Arguments

fits.actual

a list of model fits (max. 5 fits) of class bayesmeta, computed with the bayesmeta function in the package bayesmeta.

fits.bm

a list of model fits (max. 5 fits) of class bayesmeta, computed with the bayesmeta function in the package bayesmeta. To be used as benchmarks.

type

specifies if heterogeneity priors or marginal posterior densities for a given parameter should be plotted. Options are "pri.tau" for heterogeneity priors, "post.mu" for the marg. posterior of the main effect mu, "post.tau" for the marg. posterior of the heterogeneity tau and "post.theta.new" for the marg. posterior of the predicted effect theta_new in a new study.

xlim

a vector of two real numbers. Limits of the x-axis. (First number >= 0 for densities for tau.)

ylim

a vector of two real non-negative numbers. Limits of the y-axis.

legend

logical. Specifies if a legend should be added to the plot. Defaults to FALSE.

pos.legend

a character string specifing the position of the legend in the plot. Options are all the keywords accepted by the legend function in the graphics package, i.e. "bottomright", "bottom", "bottomleft", "left", "topleft", "top", "topright", "right" and "center".

legend.tau.prior

a vector of character strings or expressions with one entry for each fit in fits.actual and fits.bm (i.e. a vector of length length(fits.actual)+length(fits.bm)). Determines the legend entries corresponding to the actual und benchmark fits specified, in the same order as in the list c(fits.actual, fits.bm).

bty

the type of box to be drawn around the legend. The allowed values are "o" (the default) and "n".

col.actual

vector of color specifications for the lines representing the actual fits in fits.actual, in the same order as in that list. Vector of minimum length length(fits.actual).

col.bm

vector of color specifications for the lines representing the benchmark fits in fits.bm, in the same order as in that list. Vector of minimum length length(fits.bm).

lty.actual

vector of line type specifications for the lines representing the actual fits in fits.actual, in the same order as in that list. Vector of minimum length length(fits.actual).

lty.bm

vector of line type specifications for the lines representing the benchmark fits in fits.bm, in the same order as in that list. Vector of minimum length length(fits.bm).

lwd.actual

numeric vector specifying the width of the lines representing the actual fits in fits.actual, in the same order as in that list. Vector of minimum length length(fits.actual).

lwd.bm

numeric vector specifying the width of the lines representing the benchmark fits in fits.bm, in the same order as in that list. Vector of minimum length length(fits.bm).

Details

Two alternative suggestions for posterior benchmarks are provided in Ott et al. (2021, Section 3.4) and its Supplementary Material (Section 2.5) and they can be computed using the functions fit_models_RA and fit_models_RA_5bm, respectively.

Value

No return value, produces graphical output only.

References

Ott, M., Plummer, M., Roos, M. (2021). How vague is vague? How informative is informative? Reference analysis for Bayesian meta-analysis. Statistics in Medicine 40, 4505–4521. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1002/sim.9076")}

Ott, M., Plummer, M., Roos, M. (2021). Supplementary Material: How vague is vague? How informative is informative? Reference analysis for Bayesian meta-analysis. Statistics in Medicine. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1002/sim.9076")}

See Also

bayesmeta in the package bayesmeta, fit_models_RA, plot_RA

Examples

# for aurigular acupuncture (AA) data set with two
# actual half-normal and half-Cauchy heterogeneity priors
data(aa)
  
# compute the model fits
fits <- fit_models_RA(df=aa, tau.prior=list(function(t)dhalfnormal(t, scale=1),
                                            function(t)dhalfcauchy(t, scale=1)))
# plot the HN0 benchmark prior (do not show the improper J benchmark)
fits.bm.pri <- fits[1]
# benchmark fits under HN0 and J priors
fits.bm.post <- fits[1:2]
fits.actual <- fits[3:4]

# prior densities
plot_RA_fits(fits.actual=fits.actual, fits.bm=fits.bm.pri,
             type="pri.tau", xlim=c(0, 2), ylim=c(0, 3),
             legend=TRUE,
             legend.tau.prior=c("HN(1)", "HC(1)", "HN0"))

# marginal posterior for the effect mu
plot_RA_fits(fits.actual=fits.actual, fits.bm=fits.bm.post,
             type="post.mu", xlim=c(-1.5, 1.5), ylim=c(0, 3),
             legend=TRUE,
             legend.tau.prior=c("HN(1)", "HC(1)",
             "HN0", "J"))
             

ra4bayesmeta documentation built on Oct. 7, 2023, 1:07 a.m.