bayes_sim_unbalanced {bayesassurance} | R Documentation |
Unbalanced Bayesian Simulation in Conjugate Linear Model Framework
Description
Approximates the Bayesian assurance of attaining u'\beta > C
for unbalanced study designs through Monte Carlo sampling.
See Argument descriptions for more detail.
Usage
bayes_sim_unbalanced(
n1,
n2,
repeats = 1,
u,
C,
Xn = NULL,
Vn = NULL,
Vbeta_d,
Vbeta_a_inv,
sigsq,
mu_beta_d,
mu_beta_a,
alt,
alpha,
mc_iter,
surface_plot = TRUE
)
Arguments
n1 |
first sample size (vector or scalar). |
n2 |
second sample size (vector or scalar). |
repeats |
an positive integer specifying number of times to repeat
|
u |
a scalar or vector to evaluate
where |
C |
constant value to be compared to when evaluating |
Xn |
design matrix that characterizes where the data is to be generated from. This is specifically designed under the normal linear regression model
When set to |
Vn |
a correlation matrix for the marginal distribution of the
sample data |
Vbeta_d |
correlation matrix that helps describe the prior
information on |
Vbeta_a_inv |
inverse-correlation matrix that helps describe the prior
information on |
sigsq |
a known and fixed constant preceding all correlation matrices
|
mu_beta_d |
design stage mean |
mu_beta_a |
analysis stage mean |
alt |
specifies alternative test case, where alt = "greater" tests if
|
alpha |
significance level |
mc_iter |
number of MC samples evaluated under the analysis objective |
surface_plot |
when set to |
Value
a list of objects corresponding to the assurance approximations
assurance_table: table of sample size and corresponding assurance values
contourplot: contour map of assurance values
mc_samples: number of Monte Carlo samples that were generated and evaluated
Examples
## Example 1
## Sample size vectors are passed in for n1 and n2 to evaluate
## assurance.
n1 <- seq(20, 75, 5)
n2 <- seq(50, 160, 10)
assur_out <- bayes_sim_unbalanced(n1 = n1, n2 = n2, repeats = 1, u = c(1, -1),
C = 0, Xn = NULL, Vbeta_d = matrix(c(50, 0, 0, 10),nrow = 2, ncol = 2),
Vbeta_a_inv = matrix(rep(0, 4), nrow = 2, ncol = 2),
Vn = NULL, sigsq = 100, mu_beta_d = c(1.17, 1.25),
mu_beta_a = c(0, 0), alt = "two.sided", alpha = 0.05, mc_iter = 1000,
surface_plot = FALSE)
assur_out$assurance_table
## Example 2
## We can produce a contour plot that evaluates unique combinations of n1
## and n2 simply by setting `surfaceplot = TRUE`.
n1 <- seq(20, 75, 5)
n2 <- seq(50, 160, 10)
assur_out <- bayes_sim_unbalanced(n1 = n1, n2 = n2, repeats = 1,
u = c(1, -1), C = 0, Xn = NULL, Vbeta_d = matrix(c(50, 0, 0, 10),
nrow = 2, ncol = 2), Vbeta_a_inv = matrix(rep(0, 4), nrow = 2, ncol = 2),
Vn = NULL, sigsq = 100, mu_beta_d = c(1.17, 1.25),
mu_beta_a = c(0, 0), alt = "two.sided", alpha = 0.05, mc_iter = 1000,
surface_plot = TRUE)
assur_out$assurance_table
assur_out$contourplot