PPC_binom_bound: Predictive Probability Criterion: Binomial Model

View source: R/PPC_binom_bound.R

PPC_binom_boundR Documentation

Predictive Probability Criterion: Binomial Model

Description

\loadmathjax

Implements the predictive probability criterion in the binomial model using the upper bound of the \mjseqn\ell_1 Wasserstein distance of order one.

Usage

PPC_binom_bound(
  n,
  alpha_1,
  beta_1,
  alpha_2,
  beta_2,
  alpha_D,
  beta_D,
  xi,
  v,
  plot = FALSE
)

Arguments

n

The sample size. Must be a vector of positive integers arranged in ascending order.

alpha_1, beta_1

The parameters of the first beta prior. Must be non-negative values.

alpha_2, beta_2

The parameters of the second beta prior. Must be non-negative values.

alpha_D, beta_D

The parameters of the design beta prior. Must be positive values.

xi

A constant used to compute the predictive probability. Must be a positive value.

v

A constant used to determine the optimal sample size. Must be a value in \mjseqn(0, 1).

plot

Logical. If TRUE, a plot shows the behavior of the predictive probability as a function of the sample size.

Details

Users can use non-informative improper priors for the first and second beta priors, whereas the design beta prior must be proper.

If the first and second beta priors are equal, the function stops with an error.

Value

A list with the following components:

p_n

The predictive probability.

t_opt

The optimal threshold.

n_opt

The optimal sample size.

Author(s)

Michele Cianfriglia michele.cianfriglia@uniroma1.it

References

Cianfriglia, M., Padellini, T., and Brutti, P. (2023). Wasserstein consensus for Bayesian sample size determination.

See Also

PPC_binom()

Examples

# Parameters of the first beta prior
prior_1 <- c(51, 42)

# Parameters of the second beta prior
prior_2 <- c(55, 29)

# Parameters of the design beta prior
prior_D <- c(23, 15)

output <- PPC_binom_bound(n = 1:200,
                          alpha_1 = prior_1[1], beta_1 = prior_1[2],
                          alpha_2 = prior_2[1], beta_2 = prior_2[2],
                          alpha_D = prior_D[1], beta_D = prior_D[2],
                          xi = 0.05, v = 0.1)

michelecianfriglia/SampleSizeWass documentation built on Feb. 28, 2023, 8:56 a.m.