plot_robustness: Plot Bayes Factor Robustness Check

Description Usage Arguments Details Value Author(s) Examples

View source: R/plot_robustness.R

Description

Function for plotting Bayes factor robustness check results (i.e., prior sensitivity analysis).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
plot_robustness(
  x,
  bftype = "BF10",
  log = FALSE,
  mu_range = c(0, 0.3),
  sigma_range = c(0.25, 1),
  mu_steps = 40,
  sigma_steps = 40,
  cores = 1,
  ...
)

Arguments

x

object of class "ab".

bftype

character that specifies which Bayes factor is plotted. Either "BF10", "BF01", "BF+0", "BF0+", "BF-0", or "BF0-".

log

Boolean that specifies whether the log Bayes factor is plotted.

mu_range

numeric vector of length two that specifies the range of mu_psi values to consider.

sigma_range

numeric vector of length two that specifies the range of sigma_psi values to consider.

mu_steps

numeric value that specifies in how many discrete steps the interval mu_range is partitioned.

sigma_steps

numeric value that specifies in how many discrete steps the interval sigma_range is partitioned.

cores

number of cores used for the computations.

...

further arguments passed to filled.contour.

Details

The plot shows how the Bayes factor changes as a function of the normal prior location parameter mu_psi and the normal prior scale parameter sigma_psi (i.e., a prior sensitivity analysis with respect to the normal prior on the test-relevant log odds ratio).

Value

Returns a data.frame with the mu_psi values, sigma_psi values, and corresponding (log) Bayes factors.

Author(s)

Quentin F. Gronau

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
# synthetic data
data <- list(y1 = 10, n1 = 28, y2 = 14, n2 = 26)

# Bayesian A/B test with default settings
ab <- ab_test(data = data)

# plot robustness check (i.e., prior sensitivity analysis)
p <- plot_robustness(ab)

# returned object contains the Bayes factors for the different prior settings
head(p)

## End(Not run)

abtest documentation built on Nov. 22, 2021, 9:07 a.m.