Title: | Bayesian Evidence Combination |
---|---|
Description: | Combine diverse evidence across multiple studies to test a high level scientific theory. The methods can also be used as an alternative to a standard meta-analysis. |
Authors: | Bruno Contrino, Stanley E. Lazic |
Maintainer: | Stanley E. Lazic <[email protected]> |
License: | GPL-3 |
Version: | 1.0 |
Built: | 2024-11-16 04:34:53 UTC |
Source: | https://github.com/stanlazic/bayescombo |
Not called directly by user.
calc.post.beta(beta, se.beta, beta0, se0) calc.post.se(se.beta, se0) prior.se(beta, se.beta, ci)
calc.post.beta(beta, se.beta, beta0, se0) calc.post.se(se.beta, se0) prior.se(beta, se.beta, ci)
beta |
Effect size. |
se.beta |
Standard error of the effect. |
beta0 |
Prior for the effect size. |
se0 |
Prior standard error. |
ci |
A numeric value that is used to calculate the prior standard error. |
The function takes multiple effect sizes and a their standard errors and calculates the posterior probability for each hypothesis (H<: the effect size is less than 0, H0: the effect size is zero, or H>: the effect size is greater than zero).
ev.combo(beta, se.beta, beta0 = 0, ci = 99, H0 = c(0, 0), scale = FALSE, H.priors = rep(1/3, 3), se.mult = 1, adjust = FALSE, epsilon = 1e-06, adj.factor = 1e-04, ...)
ev.combo(beta, se.beta, beta0 = 0, ci = 99, H0 = c(0, 0), scale = FALSE, H.priors = rep(1/3, 3), se.mult = 1, adjust = FALSE, epsilon = 1e-06, adj.factor = 1e-04, ...)
beta |
Effect size. |
se.beta |
Standard error for the effect. |
beta0 |
A prior value for the effect size. Default is zero. |
ci |
Is used to calculate the prior standard error if |
H0 |
A vector of length two that defines the null hypothesis. If the
values are identical (e.g. |
scale |
Logical. Whether to scale the effect size by its standard error. Standardising has no effect on the calculations but standardised effect sizes may be easier to compare in a forest plot. |
H.priors |
Prior hypothesis probabilities; default is an equal
probability of 1/3, and they are specified in the following order:
|
se.mult |
Standard error multiplier used to increase or decrease the
prior SE and used in conjunction with |
adjust |
Logical. Whether to adjust very small posterior hypothesis probabilities. Adjusting prevents a single study from having too much influence on the results when combining multiple studies. For example, if the probability for a hypothesis from one study is zero, then additional studies cannot alter this probability (multiplying anything by zero is still zero). |
epsilon |
A small value that a posterior hypothesis probability must
fall below before an adjustment is made. Ignored if |
adj.factor |
A small number added to each posterior hypothesis
probability if |
... |
Options to be passed to |
This function calls pph()
once for each study to be combined,
where the posterior probabilities for one study are used as the priors for
the next study. One exeption is that values for se0
are ignored as
they are calculated automatically.
Object of class EV
which contains a matrix of posterior
probabilities for each updated step and other calculated values.
x <- ev.combo(beta = c(0.0126, 5.0052, 1.2976, 0.0005), se.beta = c(0.050, 2.581, 2.054, 0.003) ) x plot(x)
x <- ev.combo(beta = c(0.0126, 5.0052, 1.2976, 0.0005), se.beta = c(0.050, 2.581, 2.054, 0.003) ) x plot(x)
Plots the effect sizes and standard errors for a set of studies as a standard forest plot. Also shown are the priors for each study.
forestplot(x, range = NULL, xlab = "Effect size", ylab = "Study", ..., labels = NULL)
forestplot(x, range = NULL, xlab = "Effect size", ylab = "Study", ..., labels = NULL)
x |
An object of the class |
range |
A numeric vector of length two that sets the range of the
x-axis. Values are passed to |
xlab , ylab
|
Text for the x and y axes labels. |
... |
Other options passed to |
labels |
Names for studies to be plotted on the y-axis. If |
This function plots results from the ev.combo()
function. The
results may be hard to visualise if the effect sizes differ greatly, and it
may be preferable to standardise the effect sizes by setting scale =
TRUE
in the ev.combo()
function.
A forest plot.
x <- ev.combo( beta = c(0.0126, 5.0052, 1.2976, 0.0005), se.beta = c(0.050, 2.581, 2.054, 0.003) ) forestplot(x)
x <- ev.combo( beta = c(0.0126, 5.0052, 1.2976, 0.0005), se.beta = c(0.050, 2.581, 2.054, 0.003) ) forestplot(x)
Shows how the posterior probabilities evolve as each study is added to the analysis.
## S3 method for class 'EV' plot(x, leg.loc = "topleft", lty = 1, ...)
## S3 method for class 'EV' plot(x, leg.loc = "topleft", lty = 1, ...)
x |
An object of the class |
leg.loc |
Location of the legend; default is top left. See the
|
lty |
An vector of integers that specifies the line types. See the
|
... |
Other options passed to |
Each line in the graph is a hypothesis and the lines start at the prior hypothesis probabilities (usually 1/3).
Plot of posterior probabilities for each hypothesis.
x <- ev.combo(beta = c(0.0126, 5.0052, 1.2976, 0.0005), se.beta = c(0.050, 2.581, 2.054, 0.003) ) plot(x)
x <- ev.combo(beta = c(0.0126, 5.0052, 1.2976, 0.0005), se.beta = c(0.050, 2.581, 2.054, 0.003) ) plot(x)
Plots the prior, likelihood, and posterior distribution from a single study.
## S3 method for class 'PPH' plot(x, range = NULL, n = 200, leg.loc = "topleft", xlab = "Effect size", ylab = "", ...)
## S3 method for class 'PPH' plot(x, range = NULL, n = 200, leg.loc = "topleft", xlab = "Effect size", ylab = "", ...)
x |
A |
range |
A numeric vector of length two that sets the range of the
x-axis. Values are passed to |
n |
An integer that specifies the number of x-values to use when plotting the distributions. |
leg.loc |
Location of the legend; default is top left. See the
|
xlab , ylab
|
Text for the x and y axes labels. |
... |
Other options passed to |
Plots the prior, likelihood (data), and posterior distribution
calculated from the pph()
function for a single study.
Plot of distributions.
x <- pph(beta = 5.005, se.beta = 2.05) plot(x)
x <- pph(beta = 5.005, se.beta = 2.05) plot(x)
The function takes a single effect size and its standard error and calculates the posterior probability of each hypothesis (H<: the effect size is less than 0, H0: the effect size is zero, or H>: the effect size is greater than zero).
pph(beta, se.beta, beta0 = 0, se0 = NULL, ci = 99, se.mult = 1, H0 = c(0, 0), H.priors = rep(1/3, 3), scale = FALSE, adjust = FALSE, epsilon = 1e-06, adj.factor = 1e-04)
pph(beta, se.beta, beta0 = 0, se0 = NULL, ci = 99, se.mult = 1, H0 = c(0, 0), H.priors = rep(1/3, 3), scale = FALSE, adjust = FALSE, epsilon = 1e-06, adj.factor = 1e-04)
beta |
Effect size. |
se.beta |
Standard error for the effect. |
beta0 |
A prior value for the effect size. Default is zero. |
se0 |
A prior standard error for the effect size. Default is |
ci |
Is used to calculate the prior standard error if |
se.mult |
Standard error multiplier used to increase or decrease the
prior SE and used in conjunction with |
H0 |
A vector of length two that defines the null hypothesis. If the
values are identical (e.g. |
H.priors |
Prior hypothesis probabilities; default is an equal
probability of 1/3, and they are specified in the following order:
|
scale |
Logical. Whether to scale the effect size by its standard error. Standardising has no effect on the calculations but standardised effect sizes may be easier to compare in a forest plot. |
adjust |
Logical. Whether to adjust very small posterior hypothesis probabilities. Adjusting prevents a single study from having too much influence on the results when combining multiple studies. For example, if the probability for a hypothesis from one study is zero, then additional studies cannot alter this probability (multiplying anything by zero is still zero). |
epsilon |
A small value that a posterior hypothesis probability must
fall below before an adjustment is made. Ignored if |
adj.factor |
A small number added to each posterior hypothesis
probability if |
Effect sizes could be a mean difference between groups, regression slope, odds ratio, or other values provided by statistical models. The standard errors represent the uncertainty in the effect size and are provided by most statistical software.
Two types of priors need to be specified. The first is the prior for the effect size, which is given by a mean (usually zero) and standard error, which can be specified by the user or calculated automatically. Second, prior probabilities for each hypothesis need to be provided, and an equal probability of 1/3 is used by default.
The null hypothesis (usually effect size = 0) can be specified as either a point null or as a range. A point null tests if the effect size is exactly zero while the range null tests if the effect size close enough to zero for practical purposes. 'Close enough' is defined by the user as a range on either size of zero.
To combine multiple effect sizes use the ev.combo
function.
Object of class pph
which contains the posterior hypothesis
probabilities and other calculated values.
# library(labstats) # need to install from CRAN # plot(time.immob ~ dose, data=fluoxetine) # summary(lm(time.immob ~ dose, data=fluoxetine)) x <- pph(beta=-0.25200, se.beta=0.09913) # dose effect from above output x
# library(labstats) # need to install from CRAN # plot(time.immob ~ dose, data=fluoxetine) # summary(lm(time.immob ~ dose, data=fluoxetine)) x <- pph(beta=-0.25200, se.beta=0.09913) # dose effect from above output x
Print and summary methods for PPH and EV objects.
## S3 method for class 'PPH' summary(x, digits = 4) ## S3 method for class 'PPH' print(x, digits = 4) ## S3 method for class 'EV' summary(x, digits = 4) ## S3 method for class 'EV' print(x, digits = 4)
## S3 method for class 'PPH' summary(x, digits = 4) ## S3 method for class 'PPH' print(x, digits = 4) ## S3 method for class 'EV' summary(x, digits = 4) ## S3 method for class 'EV' print(x, digits = 4)
x |
A |
digits |
Number of digits to show. |
A list of posterior hypothesis probabilities and other calculated values.