Title: | Design and Analysis of Locally or Globally Efficient Adaptive Designs |
---|---|
Description: | Provides the functions for planning and conducting a clinical trial with adaptive sample size determination. Maximal statistical efficiency will be exploited even when dramatic or multiple adaptations are made. Such a trial consists of adaptive determination of sample size at an interim analysis and implementation of frequentist statistical test at the interim and final analysis with a prefixed significance level. The required assumptions for the stage-wise test statistics are independent and stationary increments and normality. Predetermination of adaptation rule is not required. |
Authors: | Kosuke Kashiwabara [aut, cre] |
Maintainer: | Kosuke Kashiwabara <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.1.2 |
Built: | 2025-03-07 04:49:34 UTC |
Source: | https://github.com/ca4wa/r-adpss |
This package provides the functions for conducting a trial with adaptive sample size determination. Such a trial consists of adaptive determination of sample size at an interim analysis and implementation of frequentist statistical test of a prefixed significance level. The required assumptions for the stochastic process of the test statistics is Brownian motion. Predetermination of adaptation rule is not required, i.e., adaptations can be made with full flexibility.
adaptive_analysis_norm_global
performs an globally efficient adaptive test,
a Frequentist adaptive test with the specified significance level
with full flexibility.
Normality with known variance is assumed for the test statistic
(more accurately, the test statistic is assumed to follow Brownian motion.)
Null hypothesis is fixed at 0 without loss of generality.
Exact p-value, median unbiased estimate and confidence limits proposed by Gao et al. (2013) can also be calculated.
For detailed illustration, see vignette("adpss_ex")
.
adaptive_analysis_norm_global( initial_test = 0, times = 0, stats = 0, costs = 0, final_analysis = TRUE, estimate = TRUE, ci_coef = 0.95, tol_est = 1e-08, input_check = TRUE )
adaptive_analysis_norm_global( initial_test = 0, times = 0, stats = 0, costs = 0, final_analysis = TRUE, estimate = TRUE, ci_coef = 0.95, tol_est = 1e-08, input_check = TRUE )
initial_test |
Designate the initial working test generated by |
times |
The sequence of times (sample size or information level) at which analyses were conducted. |
stats |
The sequence of test statistics. |
costs |
The sequence of loss required to construct working tests. Specification is optional. Partial specification is allowed, in which non-specification may be represented by |
final_analysis |
If |
estimate |
If |
ci_coef |
The confidence coefficient. Default is 0.95. |
tol_est |
The precision of the calculated results. |
input_check |
Indicate whether or not the arguments input by user contain invalid values. |
It returns whether or not the result was statistically significant, a p-value and an exact confidence limits.
Kashiwabara, K., Matsuyama, Y. An efficient adaptive design approximating fixed sample size designs. In preparation. Gao, P., Liu, L., Mehta, C. (2013) Exact inference for adaptive group sequential designs. Stat Med 32: 3991-4005.
work_test_norm_global
and sample_size_norm_global
.
# Construct an initial working test # Note: cost_type_1_err will be automatically calculated when 0 is specified. init_work_test <- work_test_norm_global(min_effect_size = -log(0.65), cost_type_1_err=1683.458) # Sample size calculation sample_size_norm_global( initial_test = init_work_test, effect_size = 11.11 / 20.02, # needs not be MLE time = 20.02, target_power = 0.75, sample_size = TRUE )
# Construct an initial working test # Note: cost_type_1_err will be automatically calculated when 0 is specified. init_work_test <- work_test_norm_global(min_effect_size = -log(0.65), cost_type_1_err=1683.458) # Sample size calculation sample_size_norm_global( initial_test = init_work_test, effect_size = 11.11 / 20.02, # needs not be MLE time = 20.02, target_power = 0.75, sample_size = TRUE )
adaptive_analysis_norm_local
performs an locally efficient adaptive test,
a Frequentist adaptive test with the specified significance level
with full flexibility.
Normality with known variance is assumed for the test statistic
(more accurately, the test statistic is assumed to follow Brownian motion.)
Null hypothesis is fixed at 0 without loss of generality.
No procedure to calculate p-value or confidence intervals is employed.
For detailed illustration, see vignette("adpss_ex")
.
adaptive_analysis_norm_local( overall_sig_level = 0.025, min_effect_size = 1, times = 0, stats = 0, final_analysis = TRUE, estimate = FALSE, ci_coef = 0.95, input_check = TRUE )
adaptive_analysis_norm_local( overall_sig_level = 0.025, min_effect_size = 1, times = 0, stats = 0, final_analysis = TRUE, estimate = FALSE, ci_coef = 0.95, input_check = TRUE )
overall_sig_level |
Overall significance level in (0, 1). Default is 0.025. |
min_effect_size |
The minimum effect size. It should be positive. The working test will be constructed to have the power of |
times |
The sequence of times (sample size or information level) at which analyses were conducted. |
stats |
The sequence of test statistics. |
final_analysis |
If |
estimate |
If |
ci_coef |
The confidence coefficient. Default is 0.95. |
input_check |
Indicate whether or not the arguments input by user contain invalid values. |
List of results including the conditional Type I error probability.
Kashiwabara, K., Matsuyama, Y. An efficient adaptive design approximating fixed sample size designs. In preparation.
# Sample size calculation sample_size_norm_local( overall_sig_level = 0.025, min_effect_size = -log(0.65), effect_size = 11.11 / 20.02, # needs not be MLE time = 20.02, target_power = 0.75, sample_size = TRUE )
# Sample size calculation sample_size_norm_local( overall_sig_level = 0.025, min_effect_size = -log(0.65), effect_size = 11.11 / 20.02, # needs not be MLE time = 20.02, target_power = 0.75, sample_size = TRUE )
sample_size_norm_global
calculates the power if the time of the final
analysis is given and otherwise the sample size.
The computed power for effect_size
is an approximate lower bound.
Sample size is also calculated on the basis of the bound.
exp_sample_size_norm_global( initial_test = 0, effect_size = 0, time = 0, final_time = 0, input_check = TRUE )
exp_sample_size_norm_global( initial_test = 0, effect_size = 0, time = 0, final_time = 0, input_check = TRUE )
initial_test |
Designate the initial working test generated by |
effect_size |
The effect size, on the basis of which the power or sample size calculation will be performed. In globally efficient designs, any real value is allowed. |
time |
The time of the current analysis. |
final_time |
The time of the final analysis. |
input_check |
Indicate whether or not the arguments input by user contain invalid values. |
It returns the expected sample size when 'effect size' is the truth.
adaptive_analysis_norm_global
for example of this function.
sample_size_norm_global
calculates the power if the time of the final
analysis is given and otherwise the sample size.
The computed power for effect_size
is an approximate lower bound.
Sample size is also calculated on the basis of the bound.
sample_size_norm_global( initial_test = 0, sample_size = TRUE, effect_size = 0, time = 0, target_power = 0.8, final_time = 0, tol_sample_size = 1e-05, input_check = TRUE )
sample_size_norm_global( initial_test = 0, sample_size = TRUE, effect_size = 0, time = 0, target_power = 0.8, final_time = 0, tol_sample_size = 1e-05, input_check = TRUE )
initial_test |
Designate the initial working test generated by |
sample_size |
If |
effect_size |
The effect size, on the basis of which the power or sample size calculation will be performed. In globally efficient designs, any real value is allowed. |
time |
The time of the current analysis. |
target_power |
The power, on the basis of which the sample size calculation will be performed. |
final_time |
The time of the final analysis. |
tol_sample_size |
The precision in calculation of the sample size. |
input_check |
Indicate whether or not the arguments input by user contain invalid values. |
It returns the sample size (when sample_size = TRUE
) or the power (when sample_size = FALSE
).
adaptive_analysis_norm_global
for example of this function.
sample_size_norm_local
calculates the power if the time of the final
analysis is given and otherwise the sample size.
The computed power for effect_size
is an approximate lower bound.
Sample size is also calculated on the basis of the bound.
sample_size_norm_local( overall_sig_level = 0.025, min_effect_size = 1, sample_size = TRUE, effect_size = 1, time = 0, target_power = 0.8, final_time = 0, tol_sample_size = 1e-08, input_check = TRUE )
sample_size_norm_local( overall_sig_level = 0.025, min_effect_size = 1, sample_size = TRUE, effect_size = 1, time = 0, target_power = 0.8, final_time = 0, tol_sample_size = 1e-08, input_check = TRUE )
overall_sig_level |
Overall significance level in (0, 1). Default is 0.025. |
min_effect_size |
The minimum effect size. It should be positive. The working test will be constructed to have the power of |
sample_size |
If |
effect_size |
The effect size, on the basis of which the power or sample size calculation will be performed. In locally efficient adaptive designs, any real value no less than |
time |
The time of the current analysis. |
target_power |
The power, on the basis of which the sample size calculation will be performed. |
final_time |
The time of the final analysis. |
tol_sample_size |
The precision in calculation of the sample size. |
input_check |
Indicate whether or not the arguments input by user contain invalid values. |
It returns the sample size (when sample_size = TRUE
) or the power (when sample_size = FALSE
).
adaptive_analysis_norm_local
for example of this function.
This function is used as a routine by adaptive_analysis_norm_global
and sample_size_norm_global
.
work_test_norm_global( overall_sig_level = 0.025, work_beta = 0.05, cond_alpha = overall_sig_level, cost_type_1_err = 0, cost_type_2_err = 0, prev_cost = 0, min_effect_size = 1, effect_size = 0, basic_schedule_num = 50, basic_schedule_power = 2, basic_schedule = 0, prior_dist = 0, prev_time = 0, time = 0, next_time = 0, stat = 0, input_check = TRUE, out_process = FALSE, simpson_div = 6, tol_boundary = 1e-08, tol_cost = 1e-08 )
work_test_norm_global( overall_sig_level = 0.025, work_beta = 0.05, cond_alpha = overall_sig_level, cost_type_1_err = 0, cost_type_2_err = 0, prev_cost = 0, min_effect_size = 1, effect_size = 0, basic_schedule_num = 50, basic_schedule_power = 2, basic_schedule = 0, prior_dist = 0, prev_time = 0, time = 0, next_time = 0, stat = 0, input_check = TRUE, out_process = FALSE, simpson_div = 6, tol_boundary = 1e-08, tol_cost = 1e-08 )
overall_sig_level |
Overall significance level in (0, 1). Default is 0.025. |
work_beta |
Type II error probability of the working test. Default is 0.05. |
cond_alpha |
Conditional Type I error probability in (0, 1). Default is 0.025. |
cost_type_1_err |
The loss caused by erroneously rejecting the null hypothesis. If 0 is specified, the loss leading to the working test with its Type I error probability being |
cost_type_2_err |
The loss caused by erroneously accepting the null hypothesis. If 0 is specified, the loss will be set to the value of the maximum of the basic analysis schedule. Default is 0. |
prev_cost |
The value of |
min_effect_size |
The minimum effect size. It should be positive. The working test will be constructed to have the power of |
effect_size |
The effect size for which the probability of rejecting the null hypothesis will be calculated. If |
basic_schedule_num |
The number of analysis of the working test. Default is 50. |
basic_schedule_power |
Determine the intervals between analyses. Default is 2. |
basic_schedule |
The basic analysis schedule arbitrarily specified by user. |
prior_dist |
Prior distribution for effect sizes of |
prev_time |
The time of the analysis just before the current analysis. Either |
time |
The time of the current analysis. |
next_time |
The time of the next analysis. Either |
stat |
The value of the current test statistic. The value of |
input_check |
Indicate whether or not the arguments input by user contain invalid values. |
out_process |
The values used in calculation will be output in addition to the main output. Default is FALSE. |
simpson_div |
The precision determining the precision of numerical integration. The default value is 6. |
tol_boundary |
The precision in calculation of the stopping boundary of the working test. |
tol_cost |
The precision in calculation of the loss, |
List of values of the parameters specified, information of the working test, and the conditional probability of rejecting the null hypothesis.
adaptive_analysis_norm_global
for example of this function.