Prints contents of the first input x
in a human-friendly way, see
Details for more information.
Usage
# S3 method for trial_spec
print(x, prob_digits = 3, ...)
# S3 method for trial_result
print(x, prob_digits = 3, ...)
# S3 method for trial_performance
print(x, digits = 3, ...)
# S3 method for trial_results
print(
x,
select_strategy = "control if available",
select_last_arm = FALSE,
select_preferences = NULL,
te_comp = NULL,
raw_ests = FALSE,
final_ests = NULL,
restrict = NULL,
digits = 1,
cores = NULL,
...
)
# S3 method for trial_results_summary
print(x, digits = 1, ...)
# S3 method for trial_calibration
print(x, ...)
Arguments
- x
object to print, see Details.
- prob_digits
single integer (default is
3
), the number of digits used when printing probabilities, allocation probabilities and softening powers (with2
extra digits added for stopping rule probability thresholds in trial specifications and for outcome rates in summarised results from multiple simulations).- ...
additional arguments, not used.
- digits
single integer, the number of digits used when printing the numeric results. Default is
3
for outputs fromcheck_performance()
and1
for outputs fromrun_trials()
and the accompanyingsummary()
method.- select_strategy
single character string. If a trial was not stopped due to superiority (or had only 1 arm remaining, if
select_last_arm
is set toTRUE
in trial designs with a commoncontrol
arm; see below), this parameter specifies which arm will be considered selected when calculating trial design performance metrics, as described below; this corresponds to the consequence of an inconclusive trial, i.e., which arm would then be used in practice.
The following options are available and must be written exactly as below (case sensitive, cannot be abbreviated):"control if available"
(default): selects the firstcontrol
arm for trials with a commoncontrol
arm if this arm is active at end-of-trial, otherwise no arm will be selected. For trial designs without a commoncontrol
, no arm will be selected."none"
: selects no arm in trials not ending with superiority."control"
: similar to"control if available"
, but will throw an error if used for trial designs without a commoncontrol
arm."final control"
: selects the finalcontrol
arm regardless of whether the trial was stopped for practical equivalence, futility, or at the maximum sample size; this strategy can only be specified for trial designs with a commoncontrol
arm."control or best"
: selects the firstcontrol
arm if still active at end-of-trial, otherwise selects the best remaining arm (defined as the remaining arm with the highest probability of being the best in the last adaptive analysis conducted). Only works for trial designs with a commoncontrol
arm."best"
: selects the best remaining arm (as described under"control or best"
)."list or best"
: selects the first remaining arm from a specified list (specified usingselect_preferences
, technically a character vector). If none of these arms are are active at end-of-trial, the best remaining arm will be selected (as described above)."list"
: as specified above, but if no arms on the provided list remain active at end-of-trial, no arm is selected.
- select_last_arm
single logical, defaults to
FALSE
. IfTRUE
, the only remaining active arm (the lastcontrol
) will be selected in trials with a commoncontrol
arm ending withequivalence
orfutility
, before considering the options specified inselect_strategy
. Must beFALSE
for trial designs without a commoncontrol
arm.- select_preferences
character vector specifying a number of arms used for selection if one of the
"list or best"
or"list"
options are specified forselect_strategy
. Can only contain validarms
available in the trial.- te_comp
character string, treatment-effect comparator. Can be either
NULL
(the default) in which case the firstcontrol
arm is used for trial designs with a common control arm, or a string naming a single trialarm
. Will be used when calculatingerr_te
andsq_err_te
(the error and the squared error of the treatment effect comparing the selected arm to the comparator arm, as described below).- raw_ests
single logical. If
FALSE
(default), the posterior estimates (post_ests
orpost_ests_all
, seesetup_trial()
andrun_trial()
) will be used to calculateerr
andsq_err
(the error and the squared error of the estimated compared to the specified effect in the selected arm) anderr_te
andsq_err_te
(the error and the squared error of the treatment effect comparing the selected arm to the comparator arm, as described forte_comp
and below). IfTRUE
, the raw estimates (raw_ests
orraw_ests_all
, seesetup_trial()
andrun_trial()
) will be used instead of the posterior estimates.- final_ests
single logical. If
TRUE
(recommended) the final estimates calculated using outcome data from all patients randomised when trials are stopped are used (post_ests_all
orraw_ests_all
, seesetup_trial()
andrun_trial()
); ifFALSE
, the estimates calculated for each arm when an arm is stopped (or at the last adaptive analysis if not before) using data from patients having reach followed up at this time point and not all patients randomised are used (post_ests
orraw_ests
, seesetup_trial()
andrun_trial()
). IfNULL
(the default), this argument will be set toFALSE
if outcome data are available immediate after randomisation for all patients (for backwards compatibility, as final posterior estimates may vary slightly in this situation, even if using the same data); otherwise it will be said toTRUE
. Seesetup_trial()
for more details on how these estimates are calculated.- restrict
single character string or
NULL
. IfNULL
(default), results are summarised for all simulations; if"superior"
, results are summarised for simulations ending with superiority only; if"selected"
, results are summarised for simulations ending with a selected arm only (according to the specified arm selection strategy for simulations not ending with superiority). Some summary measures (e.g.,prob_conclusive
) have substantially different interpretations if restricted, but are calculated nonetheless.- cores
NULL
or single integer. IfNULL
, a default value set bysetup_cluster()
will be used to control whether extractions of simulation results are done in parallel on a default cluster or sequentially in the main process; if a value has not been specified bysetup_cluster()
,cores
will then be set to the value stored in the global"mc.cores"
option (if previously set byoptions(mc.cores = <number of cores>
), and1
if that option has not been specified.
Ifcores = 1
, computations will be run sequentially in the primary process, and ifcores > 1
, a new parallel cluster will be setup using theparallel
library and removed once the function completes. Seesetup_cluster()
for details.
Details
The behaviour depends on the class of x
:
trial_spec
: prints a trial specification setup bysetup_trial()
,setup_trial_binom()
orsetup_trial_norm()
.
trial_result
: prints the results of a single trial simulated byrun_trial()
. More details are saved in thetrial_result
object and thus printed if thesparse
argument inrun_trial()
orrun_trials()
is set toFALSE
; ifTRUE
, fewer details are printed, but the omitted details are available by printing thetrial_spec
object created bysetup_trial()
,setup_trial_binom()
orsetup_trial_norm()
.
trial_results
: prints the results of multiple simulations generated usingrun_trials()
. Further documentation on how multiple trials are summarised before printing can be found in thesummary()
function documentation.
trial_results_summary
: print method for summary of multiple simulations of the same trial specification, generated by using thesummary()
function on an object generated byrun_trials()
.
Methods (by class)
print(trial_spec)
: Trial specificationprint(trial_result)
: Single trial resultprint(trial_performance)
: Trial performance metricsprint(trial_results)
: Multiple trial resultsprint(trial_results_summary)
: Summary of multiple trial resultsprint(trial_calibration)
: Trial calibration