print.bayes_ctd_array {BayesCTDesign} | R Documentation |
Print Data from Two Arm Bayesian Clinical Trial Simulation.
Description
print.bayes_ctd_array()
takes an S3 object of class bayes_ctd_array
, and
prints a two dimensional slice from the data generated by a clinical trial simulation
using historic_sim()
or simple_sim()
.
Usage
## S3 method for class 'bayes_ctd_array'
print(
x = NULL,
measure = "power",
tab_type = "WX|YZ",
subj_per_arm_val = NULL,
a0_val = NULL,
effect_val = NULL,
rand_control_diff_val = NULL,
print_chg_warn = 1,
...
)
Arguments
x |
Name of object of class |
measure |
Must be equal to |
tab_type |
A character string that must equal |
subj_per_arm_val |
Must be non-missing, if |
a0_val |
Must be non-missing, if |
effect_val |
Must be non-missing, if |
rand_control_diff_val |
Must be non-missing, if |
print_chg_warn |
A parameter not used by the user, but is used by
|
... |
further arguments passed to or from other methods. |
Details
If the object of class bayes_ctd_array
is created by historic_sim()
,
then the function print()
allows the user to print user-specified 1- and 2-
dimensional slices of the simulation results based on slicing code described
below. If the object of class bayes_ctd_array
is created by
simple_sim()
, a basic table of characteristic by sample size and effect is created.
If the object of class bayes_ctd_array
is created by simple_sim()
, then
all four trial characteristics (subj_per_arm_val
, a0_vals
,
effect_val
, and rand_control_diff_val
) can be ignored, as can the
parameter defining what type of table to print, tab_type
. A call to
print()
will require the user to specify a measure (power, est, var, bias,
or mse).
If the object of class bayes_ctd_array
is created by historic_sim()
,
a call to print()
will require the user to specify a measure
(power, est, var, bias, or mse) and may require the user to specify a table type.
A table type, tab_type
, will be required if 3 of the 4 trial characteristics
are equal to a vector of 2 or more values. The table type specification
uses the letters W, X, Y, and Z. The letter W represents the subject per arm
dimension. The letter X represents the a0 dimension. The letter Y represents
the effect dimension. The letter Z represents the control difference dimension.
To define a slice of the 4-dimensional array, these letters are put into an AB|CD
pattern. The two letters to the right of the vertical bar define which variables
are held constant. The two letters to the left of the vertical bar define which
variables are going to show up in the rows (first letter) and in the columns (second
letter). For example if tab_type equals WX|YZ
, then effect and control
differences will be held constant, while sample size will be represented by the rows
in the generated table and a0 values will be represented by the columns. The actual
values that are printed in the tables depend on what measure is requested in the
parameter measure
.
-
tab_type='WX|YZ'
, Sample Size by a0 -
tab_type='WY|XZ'
, Sample Size by Effect -
tab_type='WZ|XY'
, Sample Size by Control Differences -
tab_type='XY|WZ'
, a0 by Effect -
tab_type='XZ|WY'
, a0 by Control Differences -
tab_type='YZ|WX'
, Effect by Control Differences -
tab_type='ZX|WY'
, Control Differences by a0 -
tab_type='XW|YZ'
, a0 by Sample Size -
tab_type='YW|XZ'
, Effect by Sample Size -
tab_type='YX|WZ'
, Effect by a0 -
tab_type='ZW|XY'
, Control Differences by Sample Size -
tab_type='ZY|WX'
, Control Differences by Effect
It is very important to populate the values of subj_per_arm_val
,
a0_vals
, effect_val
, and rand_control_diff_val
correctly given
the value of tab_type, when the object of class bayes_ctd_array
is created by
historic_sim()
and at least 3 of the four parameters have more than one
value. On the other hand, if 2 or more of the four parameters have only one value,
then subj_per_arm_val
, a0_vals
, effect_val
,
rand_control_diff_val
, as well as tab_type
can be ignored. If the last
two letters are YZ
, then effect_val
and rand_control_diff_val
must be populated. If the last two letters are XZ
, then a0_vals
and
rand_control_diff_val
must be populated. If the last two letters are
XY
, then a0_vals
and effect_val
must be populated. If the last
two letters are WZ
, then sample_val
and rand_control_diff_val
must be populated. If the last two letters are WY
, then sample_size_val
and effect_val
must be populated. If the last two letters are WX
, then
sample_size_val
and a0_vals
must be populated.
If the object of class bayes_ctd_array
is created by simple_sim()
, the
parameters tab_type
, subj_per_arm_val
, a0_vals
, effect_val
,
and rand_control_diff_val
are ignored.
Value
print()
returns a two dimensional array of simulation results.
Examples
#Run a Weibull simulation, using simple_sim().
#For meaningful results, trial_reps needs to be much larger than 2.
weibull_test <- simple_sim(trial_reps = 2, outcome_type = "weibull",
subj_per_arm = c(50, 100, 150, 200),
effect_vals = c(0.6, 1, 1.4),
control_parms = c(2.82487,3),
time_vec = NULL, censor_value = NULL,
alpha = 0.05, get_var = TRUE,
get_bias = TRUE, get_mse = TRUE,
seedval=123, quietly=TRUE)
#Tabulate the simulation results for power.
test_table <- print(x=weibull_test, measure="power",
tab_type=NULL, subj_per_arm_val=NULL, a0_val=NULL,
effect_val=NULL, rand_control_diff_val=NULL)
print(test_table)
#Tabulate the simulation results for estimates.
print(x=weibull_test, measure="est")
#Tabulate the simulation results for variance.
print(x=weibull_test, measure="var")
#Tabulate the simulation results for bias.
print(x=weibull_test, measure="bias")
#Tabulate the simulation results for mse.
print(x=weibull_test, measure="mse")
#Run another weibull simulation, using historic_sim().
#Note: historic_sim() can take a while to run.
#Generate a sample of historical data for use in example.
set.seed(2250)
SampleHistData <- genweibulldata(sample_size=60, scale1=2.82487,
hazard_ratio=0.6, common_shape=3,
censor_value=3)
histdata <- subset(SampleHistData, subset=(treatment==0))
histdata$id <- histdata$id+10000
#For meaningful results, trial_reps needs to be larger than 100.
weibull_test2 <- historic_sim(trial_reps = 100, outcome_type = "weibull",
subj_per_arm = c(50, 100, 150, 200, 250),
a0_vals = c(0, 0.33, 0.67, 1),
effect_vals = c(0.6, 1, 1.4),
rand_control_diff = c(0.8, 1, 1.2),
hist_control_data = histdata, time_vec = NULL,
censor_value = 3, alpha = 0.05, get_var = TRUE,
get_bias = TRUE, get_mse = TRUE, seedval=123,
quietly=TRUE)
#Tabulate the simulation results for power.
test_table <- print(x=weibull_test2, measure="power",
tab_type="WX|YZ", effect_val=0.6,
rand_control_diff_val=1.0)
print(test_table)
#Tabulate the simulation results for estimates.
print(x=weibull_test2, measure="est", tab_type="WX|YZ",
effect_val=0.6, rand_control_diff_val=1.0)
#Tabulate the simulation results for variance.
print(x=weibull_test2, measure="var", tab_type="WX|YZ",
effect_val=0.6, rand_control_diff_val=1.0)
#Tabulate the simulation results for bias.
print(x=weibull_test2, measure="bias", tab_type="WX|YZ",
effect_val=0.6, rand_control_diff_val=1.0)
#Tabulate the simulation results for mse.
print(x=weibull_test2, measure="mse", tab_type="WX|YZ",
effect_val=0.6, rand_control_diff_val=1.0)
#Run a Bernoulli simulation, using historic_sim().
#Generate a sample of historical Bernoulli data for use in example.
set.seed(2250)
samplehistdata <- genbernoullidata(sample_size=60, prob1=0.6, odds_ratio=0.6)
histdata <- subset(samplehistdata, subset=(treatment==0))
histdata$id <- histdata$id+10000
#For meaningful results, trial_reps needs to be larger than 100.
bernoulli_test <- historic_sim(trial_reps = 100, outcome_type = "bernoulli",
subj_per_arm = c(150),
a0_vals = c(1.0),
effect_vals = c(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0),
rand_control_diff = c(1.8),
hist_control_data = histdata, time_vec = NULL,
censor_value = 3, alpha = 0.05, get_var = TRUE,
get_bias = TRUE, get_mse = TRUE, seedval=123,
quietly=TRUE)
test_table <- print(x=bernoulli_test, measure="power",
tab_type=NULL, effect_val=NULL,
subj_per_arm_val=NULL)
print(test_table)
#If only one or two of the subj_per_arm, a0_vals, effect_vals, or
#rand_control_diff parameters have length greater than 1, then
#only bayes_ctd_array and measure parameters are needed.
#Tabulate the simulation results for estimates.
print(x=bernoulli_test, measure="est")
#Tabulate the simulation results for variance.
print(x=bernoulli_test, measure="var")
#Tabulate the simulation results for bias.
print(x=bernoulli_test, measure="bias")
#Tabulate the simulation results for mse.
print(x=bernoulli_test, measure="mse")