View source: R/bayes_assurance.R
assurance_nd_na | R Documentation |
Takes in a set of parameters and returns the exact Bayesian assurance based on a closed-formed solution.
assurance_nd_na(n, n_a, n_d, theta_0, theta_1, sigsq, alt, alpha = 0.05)
n |
sample size (either scalar or vector) |
n_a |
sample size at analysis stage that quantifies the amount of prior information we have for parameter θ. This should be a single scalar value. |
n_d |
sample size at design stage that quantifies the amount of prior information we have for where the data is being generated from. This should be a single scalar value. |
theta_0 |
parameter value that is known a priori (typically provided by the client) |
theta_1 |
alternative parameter value that will be tested in comparison to theta_0. See alt for specification options. |
sigsq |
known variance σ^2. |
alt |
specifies alternative test case, where |
alpha |
significance level |
objects corresponding to the assurance
assurance_table: table of sample sizes and corresponding assurance values.
assurance_plot: assurance curve that is only returned if n is a vector. This curve covers a wider range of sample sizes than the inputted values specified for n, where specific assurance values are marked in red.
## Assign the following fixed parameters to determine the Bayesian assurance ## for the given vector of sample sizes. n <- seq(10, 250, 5) n_a <- 1e-8 n_d <- 1e+8 theta_0 <- 0.15 theta_1 <- 0.25 sigsq <- 0.104 assur_vals <- assurance_nd_na(n = n, n_a = n_a, n_d = n_d, theta_0 = theta_0, theta_1 = theta_1, sigsq = sigsq, alt = "two.sided", alpha = 0.05) assur_vals$assurance_plot
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.