The object bayes_ctd_array has 6 elements: a list containing simulation
results (data), copies of the 4 function arguments subj_per_arm,
a0_vals, effect_vals, and rand_control_diff, and finally
a objtype value indicating that simple_sim() was used. Each element of
data is a four-dimensional array, where each dimension is determined by the
length of parameters subj_per_arm, a0_vals, effect_vals, and
rand_control_diff. The size of data depends on which results are
requested by the user. At a minimum, at least one of subj_per_arm,
a0_vals, effect_vals, or rand_control_diff must contain at
least 2 values, while the other three must contain at least 1 value. The data
list will always contain two elements: an array of power results (power) and
an array of estimation results (est). In addition to power and
est, data may also contain elements var, bias, or
mse, depending on the values of get_var, get_bias, and
get_mse. The values returned in est are in the form of hazard ratios,
mean ratios, odds ratios, or mean differences depending on the value of
outcome_type. For a Gaussian outcome, the estimation results are
differences in group means (experimental group minus control group). For a
logistic outcome, the estimation results are odds ratios (experimental group over
control group). For lognormal and Poisson outcomes, the estimation results are mean
ratios (experimental group over control group). For a piecewise exponential or a
Weibull outcome, the estimation results are hazard ratios (experimental group over
control group). The values returned in bias, var, and mse are
on the scale of the values returned in est.
The object bayes_ctd_array has two primary methods, print() and
plot(), for printing and plotting slices of the arrays contained in
bayes_ctd_array$data.
As dimensions of the four dimensional array increases, the time required to complete
the simulation will increase; however, it will be faster than a similar simulation
based on repeated calls to MCMC routines to analyze each simulated trial.
The meaning of the estimation results, and the test used to generate power results,
depends on the outcome used. In all cases, power is based on a two-sided test
involving a (1-alpha)100% credible interval, where the interval is used to determine
if the null hypothesis should be rejected (null value outside of the interval) or
not rejected (null value inside the interval). For a Gaussian outcome, the 95%
credible interval is an interval for the difference in group means
(experimental group minus control group), and the test determines if 0 is in or
outside of the interval. For a Bernoulli outcome, the 95% credible interval
is an interval for the odds ratio (experimental group over control group),
and the test determines if 1 is in or outside of the interval. For a lognormal or
a Poisson outcome, the 95% credible interval is an interval for the mean ratio
(experimental group over control group), and the test determines if 1 is in or
outside of the interval. Finally, for a piecewise exponential or a Weibull outcome,
the 95% credible interval is an interval for the hazard ratio (experimental group
over control group), and the test determines if 1 is in or outside of the interval.
For a Gaussian outcome, the control_parms values should be (mean, sd),
where mean is the mean parameter for the control group used in a call to rnorm(),
and sd is the common sd parameter for both groups used in a call torlnorm().
For a Bernoulli outcome, the control_parms values should be (prob), where
prob is the event probability for the control group used in a call to rbinom().
For a lognormal outcome, the control_parms values should be (meanlog, sdlog),
where meanlog is the meanlog parameter for the control group used in a call to
rlnorm(), and sdlog is the common sdlog parameter for both groups used in
a call to rlnorm().
For a Poisson outcome, the control_parms value should be (lambda), where
lambda is the lambda parameter for the control group used in a call to rpois() and
is equal to the mean of a Poisson distribution.
For a Weibull outcome, the control_parms values should be (scale, shape),
where scale is the scale parameter for the control group used in a call to
rweibull(), and shape is the common shape parameter for both groups used in
a call to rweibull().
For a piecewise exponential outcome, the control_parms values should be a vector
of lambdas used in a call to eha::rpch(). Each element in control_parms
is a hazard for an interval defined by the time_vec parameter.
Please refer to the examples for illustration of package use.