PEC_binom_bound: Predictive Expectation Criterion: Binomial Model

View source: R/PEC_binom_bound.R

PEC_binom_boundR Documentation

Predictive Expectation Criterion: Binomial Model

Description

\loadmathjax

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

Usage

PEC_binom_bound(
  n,
  alpha_1,
  beta_1,
  alpha_2,
  beta_2,
  alpha_D,
  beta_D,
  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.

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 expectation 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:

e_n

The predictive expectation.

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

PEC_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 <- PEC_binom_bound(n = 1:1000,
                          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],
                          v = 0.1)

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