Skip to contents

Function to generate plots for the prior and posterior distribution of a Bayesian meta-analysis.

Usage

# S3 method for valmeta
dplot(x, par, distr_type, plot_type = "dens", ...)

Arguments

x

An object of class "valmeta"

par

Character string to specify for which parameter a plot should be generated. Options are "mu" (mean of the random effects model) and "tau" (standard deviation of the random effects model).

distr_type

Character string to specify whether the prior distribution ("prior") or posterior distribution ("posterior") should be displayed.

plot_type

Character string to specify whether a density plot ("dens") or histogram ("hist") should be displayed.

...

Additional arguments which are currently not used

Value

A ggplot object.

An object of class ggplot

Author

Thomas Debray <thomas.debray@gmail.com>

Examples

if (FALSE) {
data(EuroSCORE)

# Meta-analysis of the concordance statistic
fit <- valmeta(cstat=c.index, cstat.se=se.c.index, cstat.cilb=c.index.95CIl,
               cstat.ciub=c.index.95CIu, N=n, O=n.events, 
               data=EuroSCORE, method="BAYES", slab=Study)
dplot(fit)
dplot(fit, distr_type = "posterior")
dplot(fit, par = "tau", distr_type = "prior")

# Meta-analysis of the O:E ratio
EuroSCORE.new <- EuroSCORE
EuroSCORE.new$n[c(1, 2, 5, 10, 20)] <-  NA
pars <- list(hp.tau.dist="dhalft",   # Prior for the between-study standard deviation
             hp.tau.sigma=1.5,       # Standard deviation for 'hp.tau.dist'
             hp.tau.df=3,            # Degrees of freedom for 'hp.tau.dist'
             hp.tau.max=10)          # Maximum value for the between-study standard deviation
fit2 <- valmeta(measure="OE", O=n.events, E=e.events, N=n, data=EuroSCORE.new,
                method="BAYES", slab=Study, pars=pars)
dplot(fit2, plot_type = "hist")
}