PPC_binom: Predictive Probability Criterion: Binomial Model

View source: R/PPC_binom.R

PPC_binomR Documentation

Predictive Probability Criterion: Binomial Model

Description

\loadmathjax

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

Usage

PPC_binom(
  n,
  alpha_1,
  beta_1,
  alpha_2,
  beta_2,
  alpha_D,
  beta_D,
  xi,
  v,
  q = 1,
  M = 3000,
  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).

q

The order of the Wasserstein distance. Must be a value in \mjseqn[1, \infty).

M

The number of Monte Carlo replications. Must be a positive integer.

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.

The PPC_binom_bound() function should be used when \mjseqnq = 1.

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_bound()

Examples

## Not run: 
# 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)

# Seed
set.seed(1234)

output <- PPC_binom(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)
## End(Not run)

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