PEC_binom | R Documentation |
Implements the predictive expectation criterion in the binomial model using the \mjseqn\ell_1 Wasserstein distance of order \mjseqnq.
PEC_binom( n, alpha_1, beta_1, alpha_2, beta_2, alpha_D, beta_D, v, q = 1, M = 1500, 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). |
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 |
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 PEC_binom_bound()
function should be used when \mjseqnq = 1.
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_bound()
## 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 <- PEC_binom(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) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.