View source: R/PEC_binom_bound.R
PEC_binom_bound | R Documentation |
Implements the predictive expectation criterion in the binomial model using the upper bound of the \mjseqn\ell_1 Wasserstein distance of order one.
PEC_binom_bound( n, alpha_1, beta_1, alpha_2, beta_2, alpha_D, beta_D, v, plot = FALSE )
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 |
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.
A list with the following components:
e_n |
The predictive expectation. |
t_opt |
The optimal threshold. |
n_opt |
The optimal sample size. |
Michele Cianfriglia michele.cianfriglia@uniroma1.it
Cianfriglia, M., Padellini, T., and Brutti, P. (2023). Wasserstein consensus for Bayesian sample size determination.
PEC_binom()
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.