PPC_norm | R Documentation |
Implements the predictive probability criterion in the normal model using the \mjseqn\ell_2 Wasserstein distance of order two.
PPC_norm( n, theta_1, n_1, theta_2, n_2, theta_D, n_D, sigma, xi, v, plot = FALSE )
n |
The sample size. Must be a vector of positive integers arranged in ascending order. |
theta_1, n_1 |
The parameters of the first normal prior. Must be a finite value and a non-negative value, respectively. |
theta_2, n_2 |
The parameters of the second normal prior. Must be a finite value and a non-negative value, respectively. |
theta_D, n_D |
The parameters of the design normal prior. Must be a finite value and a positive value, respectively. |
sigma |
A constant used to define the variance of the priors. Must be a positive value. |
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 |
Users can use non-informative improper priors for the first and second normal priors, whereas the design normal prior must be proper.
If the first and second normal priors are equal, the function stops with an error.
The prior variances are given by sigma
squared over the prior sample sizes, that is n_1
, n_2
, and n_D
.
A list with the following components:
p_n |
The predictive probability. |
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.
# Parameters of the first normal prior prior_1 <- c(15, 25) # Parameters of the second normal prior prior_2 <- c(10, 15) # Parameters of the design normal prior prior_D <- c(13, 10) output <- PPC_norm(n = 1:800, theta_1 = prior_1[1], n_1 = prior_1[2], theta_2 = prior_2[1], n_2 = prior_2[2], theta_D = prior_D[1], n_D = prior_D[2], sigma = 2, xi = 0.05, v = 0.1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.