Learn R Programming

bayesassurance (version 0.1.0)

assurance_nd_na: Bayesian Assurance Computation

Description

Takes in a set of parameters and returns the exact Bayesian assurance based on a closed-formed solution.

Usage

assurance_nd_na(n, n_a, n_d, theta_0, theta_1, sigsq, alt, alpha = 0.05)

Arguments

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 \(\theta\). 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 \(\sigma^2\).

alt

specifies alternative test case, where alt = "greater" tests if \(\theta_1 > \theta_0\), alt = "less" tests if \(\theta_1 < \theta_0\), and alt = "two.sided" performs a two-sided test. alt = "greater" by default.

alpha

significance level

Value

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.

Examples

Run this code
# NOT RUN {
## 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
# }

Run the code above in your browser using DataLab