Title: | Blinded Sample Size Recalculation |
---|---|
Description: | Computation of key characteristics and plots for blinded sample size recalculation. Continuous as well as binary endpoints are supported in superiority and non-inferiority trials. See Baumann, Pilz, Kieser (2022) <doi:10.32614/RJ-2022-001> for a detailed description. The implemented methods include the approaches by Lu, K. (2019) <doi:10.1002/pst.1737>, Kieser, M. and Friede, T. (2000) <doi:10.1002/(SICI)1097-0258(20000415)19:7%3C901::AID-SIM405%3E3.0.CO;2-L>, Friede, T. and Kieser, M. (2004) <doi:10.1002/pst.140>, Friede, T., Mitchell, C., Mueller-Veltern, G. (2007) <doi:10.1002/bimj.200610373>, and Friede, T. and Kieser, M. (2011) <doi:10.3414/ME09-01-0063>. |
Authors: | Lukas Baumann [aut, cre] |
Maintainer: | Lukas Baumann <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.1 |
Built: | 2025-03-07 04:04:05 UTC |
Source: | https://github.com/imbi-heidelberg/blindrecalc |
This method returns an adjusted significance level that can be used such that the actual type I error rate is preserved.
adjusted_alpha(design, n1, nuisance, ...)
adjusted_alpha(design, n1, nuisance, ...)
design |
object of class |
n1 |
total number of patients that are recruited before the sample size is recalculated |
nuisance |
nuisance parameter that is estimated at the interim analysis |
... |
Further optional arguments. |
The method is only vectorized in either nuisance
or n1
.
The method is implemented for the classes Student
,
ChiSquare
, and FarringtonManning
.
Check the class-specific documentation for further parameters that have
to be specified.
Value of the adjusted significance level for every nuisance parameter and every value of n1.
d <- setupStudent(alpha = .025, beta = .2, r = 1, delta = 0, delta_NI = 1.5, n_max = 848) sigma <- c(2, 5.5, 9) adjusted_alpha(design = d, n1 = 20, nuisance = sigma, tol = 1e-4, iters = 1e3)
d <- setupStudent(alpha = .025, beta = .2, r = 1, delta = 0, delta_NI = 1.5, n_max = 848) sigma <- c(2, 5.5, 9) adjusted_alpha(design = d, n1 = 20, nuisance = sigma, tol = 1e-4, iters = 1e3)
This method returns an adjusted significance level that can be used such that the actual type I error rate is preserved.
## S4 method for signature 'ChiSquare' adjusted_alpha( design, n1, nuisance, nuis_ass, precision = 0.001, gamma = 0, recalculation, allocation = c("exact", "approximate"), ... )
## S4 method for signature 'ChiSquare' adjusted_alpha( design, n1, nuisance, nuis_ass, precision = 0.001, gamma = 0, recalculation, allocation = c("exact", "approximate"), ... )
design |
Object of class |
n1 |
Either the sample size of the first stage (if
|
nuisance |
Value of the nuisance parameter in (0,1). For the Chi-Squared test this is the overall response rate. |
nuis_ass |
If |
precision |
Value by which the nominal type 1 error rate is reduced in each iteration until the nominal type 1 error rate is preserved. |
gamma |
If |
recalculation |
Should the sample size be recalculated after n1 n1 patients are recruited? |
allocation |
Whether the allocation ratio should be preserved
exactly ( |
... |
Further optional arguments. |
The method is only vectorized in either nuisance
or n1
.
Value of the adjusted significance level for every nuisance parameter and every value of n1.
d <- setupChiSquare(alpha = 0.025, beta = 0.2, r = 1, delta = 0.2) adjusted_alpha(d, n1 = 10, nuisance = 0.3, gamma = 0.001, nuis_ass = 0.3, precision = 0.001, recalculation = TRUE)
d <- setupChiSquare(alpha = 0.025, beta = 0.2, r = 1, delta = 0.2) adjusted_alpha(d, n1 = 10, nuisance = 0.3, gamma = 0.001, nuis_ass = 0.3, precision = 0.001, recalculation = TRUE)
This method returns an adjusted significance level that can be used such that the actual type I error rate is preserved.
## S4 method for signature 'FarringtonManning' adjusted_alpha( design, n1, nuisance, nuis_ass, precision = 0.001, gamma = 0, recalculation, allocation = c("exact", "approximate"), ... )
## S4 method for signature 'FarringtonManning' adjusted_alpha( design, n1, nuisance, nuis_ass, precision = 0.001, gamma = 0, recalculation, allocation = c("exact", "approximate"), ... )
design |
Object of class |
n1 |
Either the sample size of the first stage (if
|
nuisance |
Value of the nuisance parameter in (0,1). For the Farrington-Manning test this is the overall response rate. |
nuis_ass |
If |
precision |
Value by which the nominal type 1 error rate is reduced in each iteration until the nominal type 1 error rate is preserved. |
gamma |
If |
recalculation |
Should the sample size be recalculated after n1 n1 patients are recruited? |
allocation |
Whether the allocation ratio should be preserved
exactly ( |
... |
Further optional arguments. |
The method is only vectorized in either nuisance
or n1
.
Value of the adjusted significance level for every nuisance parameter and every value of n1.
d <- setupFarringtonManning(alpha = 0.025, beta = 0.2, r = 1, delta = 0, delta_NI = 0.25) adjusted_alpha(d, n1 = 20, nuisance = 0.5, recalculation = TRUE)
d <- setupFarringtonManning(alpha = 0.025, beta = 0.2, r = 1, delta = 0, delta_NI = 0.25) adjusted_alpha(d, n1 = 20, nuisance = 0.5, recalculation = TRUE)
This method returns an adjusted significance level that can be used such that the actual type I error rate is preserved.
## S4 method for signature 'Student' adjusted_alpha(design, n1, nuisance, tol, iters = 10000, seed = NULL, ...)
## S4 method for signature 'Student' adjusted_alpha(design, n1, nuisance, tol, iters = 10000, seed = NULL, ...)
design |
Object of class |
n1 |
Either the sample size of the first stage (if
|
nuisance |
Value of the nuisance parameter. For the Student's t-test this is the variance. |
tol |
desired absolute tolerance |
iters |
Number of simulation iterations. |
seed |
Random seed for simulation. |
... |
Further optional arguments. |
The method is only vectorized in either nuisance
or n1
.
In the case of the Student's t-test, the adjusted alpha is calculated using the algorithm by Kieser and Friede (2000): "Re-calculating the sample size in internal pilot study designs with control of the type I error rate". Statistics in Medicine 19: 901-911.
Value of the adjusted significance level for every nuisance parameter and every value of n1.
d <- setupStudent(alpha = .025, beta = .2, r = 1, delta = 0, delta_NI = 1.5, n_max = 848) sigma <- c(2, 5.5, 9) adjusted_alpha(design = d, n1 = 20, nuisance = sigma, tol = 1e-4, iters = 1e3)
d <- setupStudent(alpha = .025, beta = .2, r = 1, delta = 0, delta_NI = 1.5, n_max = 848) sigma <- c(2, 5.5, 9) adjusted_alpha(design = d, n1 = 20, nuisance = sigma, tol = 1e-4, iters = 1e3)
The package blindrecalc provides characteristics and plots of trial designs with blinded sample size recalculation where a nuisance parameter is estimated at an blinded interim analysis.
Currently, for continuous outcomes, a t-test is implemented for superiority and non-inferiority trials. For superiority trials with binary endpoint, the chi^2-test is implemented. The Farrington Manning test covers non-inferiority trials with binary endpoint.
This class implements a chi-squared test for superiority trials. A trial
with binary outcomes in two groups E
and C
is assumed. If
alternative == "greater"
the null and alternative hypotheses for the
difference in response probabilities are
If alternative == "smaller"
, the direction of the effect is changed.
The function setupChiSquare
creates an object of class
ChiSquare
.
setupChiSquare( alpha, beta, r = 1, delta, alternative = c("greater", "smaller"), n_max = Inf, ... )
setupChiSquare( alpha, beta, r = 1, delta, alternative = c("greater", "smaller"), n_max = Inf, ... )
alpha |
One-sided type I error rate. |
beta |
Type II error rate. |
r |
Allocation ratio between experimental and control group. |
delta |
Difference of effect size between alternative and null hypothesis. |
alternative |
Does the alternative hypothesis contain greater
( |
n_max |
Maximal overall sample size. If the recalculated sample size
is greater than |
... |
Further optional arguments. |
The nuisance parameter is the overall response probability .
In the blinded sample size #' recalculation procedure it is blindly estimated
by:
where and
are the numbers of
responses and
and
are the sample sizes
of the respective group after the first stage. The event rates in both
groups under the alternative hypothesis can then be blindly estimated as:
where is the difference in response probabilities under the
alternative hypothesis and r is the allocation ratio of the sample sizes
in the two groups.
These blinded estimates can then be used to re-estimate the sample size.
The following methods are available for this class:
toer
, pow
, n_dist
,
adjusted_alpha
, and n_fix
.
Check the design specific documentation for details.
For non-inferiority trials use the function setupFarringtonManning
.
An object of class ChiSquare
.
Friede, T., & Kieser, M. (2004). Sample size recalculation for binary data
in internal pilot study designs. Pharmaceutical Statistics:
The Journal of Applied Statistics in the Pharmaceutical Industry,
3(4), 269-279.
Kieser, M. (2020). Methods and applications of sample size calculation and
recalculation in clinical trials. Springer.
design <- setupChiSquare(alpha = .025, beta = .2, r = 1, delta = 0.2, alternative = "greater")
design <- setupChiSquare(alpha = .025, beta = .2, r = 1, delta = 0.2, alternative = "greater")
This class implements a Farrington-Manning test for non-inferiority
trials. A trial with binary outcomes in two groups E
and
C
is assumed. The null and alternative hypotheses for the
non-inferiority of response probabilities are:
where denotes the non-inferiority margin.
The function setupFarringtonManning
creates an object of
FarringtonManning
.
setupFarringtonManning(alpha, beta, r = 1, delta, delta_NI, n_max = Inf, ...)
setupFarringtonManning(alpha, beta, r = 1, delta, delta_NI, n_max = Inf, ...)
alpha |
One-sided type I error rate. |
beta |
Type II error rate. |
r |
Allocation ratio between experimental and control group. |
delta |
Difference of effect size between alternative and null hypothesis. |
delta_NI |
Non-inferiority margin. |
n_max |
Maximal overall sample size. If the recalculated sample size
is greater than |
... |
Further optional arguments. |
The nuisance parameter is the overall response probability .
In the blinded sample size recalculation procedure it is blindly estimated
by:
where
and
are the numbers of responses and
and
are the sample sizes of the respective group after the first stage.
The event rates in both groups under the alternative hypothesis can then be
blindly estimated as:
where is the difference in
response probabilities under the alternative hypothesis and r is the
allocation ratio of the sample sizes in the two groups.
These blinded estimates can then be used to re-estimate the sample
size.
An object of class FarringtonManning
.
Friede, T., Mitchell, C., & Mueller-Velten, G. (2007). Blinded sample size
reestimation in non-inferiority trials with binary endpoints.
Biometrical Journal, 49(6), 903-916.
Kieser, M. (2020). Methods and applications of sample size calculation and
recalculation in clinical trials. Springer.
design <- setupFarringtonManning(alpha = .025, beta = .2, r = 1, delta = 0, delta_NI = .15)
design <- setupFarringtonManning(alpha = .025, beta = .2, r = 1, delta = 0, delta_NI = .15)
Calculates the distribution of the total sample sizes of designs with blinded sample size recalculation for different values of the nuisance parameter or of n1.
n_dist(design, n1, nuisance, summary = TRUE, plot = FALSE, ...)
n_dist(design, n1, nuisance, summary = TRUE, plot = FALSE, ...)
design |
object of class |
n1 |
total number of patients that are recruited before the sample size is recalculated |
nuisance |
nuisance parameter that is estimated at the interim analysis |
summary |
logical - is a summary of the sample size distribution desired? Otherwise, a vector with sample sizes is returned. |
plot |
Should a plot of the sample size distribution be drawn? |
... |
Further optional arguments. |
The method is only vectorized in either nuisance
or n1
.
The method is implemented for the classes Student
,
ChiSquare
, and FarringtonManning
.
Summary and/or plot of the sample size distribution for every nuisance parameter and every value of n1.
d <- setupStudent(alpha = .025, beta = .2, r = 1, delta = 3.5, delta_NI = 0, alternative = "greater", n_max = 156) n_dist(d, n1 = 20, nuisance = 5.5, summary = TRUE, plot = FALSE, seed = 2020)
d <- setupStudent(alpha = .025, beta = .2, r = 1, delta = 3.5, delta_NI = 0, alternative = "greater", n_max = 156) n_dist(d, n1 = 20, nuisance = 5.5, summary = TRUE, plot = FALSE, seed = 2020)
Calculates the distribution of the total sample sizes of designs with blinded sample size recalculation for different values of the nuisance parameter or of n1.
## S4 method for signature 'ChiSquare' n_dist( design, n1, nuisance, summary = TRUE, plot = FALSE, allocation = c("exact", "approximate"), ... )
## S4 method for signature 'ChiSquare' n_dist( design, n1, nuisance, summary = TRUE, plot = FALSE, allocation = c("exact", "approximate"), ... )
design |
Object of class |
n1 |
Either the sample size of the first stage (if
|
nuisance |
Value of the nuisance parameter in (0,1). For the Chi-Squared test this is the overall response rate. |
summary |
Is a summary of the sample size distribution desired? Otherwise, a vector with sample sizes is returned. |
plot |
Should a plot of the sample size distribution be drawn? |
allocation |
Whether the allocation ratio should be preserved
exactly ( |
... |
Further optional arguments. |
Only sample sizes that occur with a probability of at least 0.01 are considered.
The method is only vectorized in either nuisance
or n1
.
Summary and/or plot of the sample size distribution for every nuisance parameter and every value of n1.
d <- setupChiSquare(alpha = 0.025, beta = 0.2, r = 1, delta = 0.2) n_dist(d, n1 = 20, nuisance = 0.25, summary = TRUE, plot = FALSE)
d <- setupChiSquare(alpha = 0.025, beta = 0.2, r = 1, delta = 0.2) n_dist(d, n1 = 20, nuisance = 0.25, summary = TRUE, plot = FALSE)
Calculates the distribution of the total sample sizes of designs with blinded sample size recalculation for different values of the nuisance parameter or of n1.
## S4 method for signature 'FarringtonManning' n_dist( design, n1, nuisance, summary, plot, allocation = c("exact", "approximate"), ... )
## S4 method for signature 'FarringtonManning' n_dist( design, n1, nuisance, summary, plot, allocation = c("exact", "approximate"), ... )
design |
Object of class |
n1 |
Either the sample size of the first stage (if
|
nuisance |
Value of the nuisance parameter in (0,1). For the Farrington-Manning test this is the overall response rate. |
summary |
Is a summary of the sample size distribution desired? Otherwise, a vector with sample sizes is returned. |
plot |
Should a plot of the sample size distribution be drawn? |
allocation |
Whether the allocation ratio should be preserved
exactly ( |
... |
Further optional arguments. |
Only sample sizes that occur with a probability of at least 0.01 are considered.
The method is only vectorized in either nuisance
or n1
.
Summary and/or plot of the sample size distribution for each nuisance parameter and every value of n1.
d <- setupFarringtonManning(alpha = 0.025, beta = 0.2, r = 1, delta = 0, delta_NI = 0.25) n_dist(d, n1 = 30, nuisance = 0.2, summary = TRUE, plot = FALSE)
d <- setupFarringtonManning(alpha = 0.025, beta = 0.2, r = 1, delta = 0, delta_NI = 0.25) n_dist(d, n1 = 30, nuisance = 0.2, summary = TRUE, plot = FALSE)
Calculates the distribution of the total sample sizes of designs with blinded sample size recalculation for different values of the nuisance parameter or of n1.
## S4 method for signature 'Student' n_dist( design, n1, nuisance, summary = TRUE, plot = FALSE, iters = 10000, seed = NULL, range = 0, allocation = c("approximate", "exact"), ... )
## S4 method for signature 'Student' n_dist( design, n1, nuisance, summary = TRUE, plot = FALSE, iters = 10000, seed = NULL, range = 0, allocation = c("approximate", "exact"), ... )
design |
Object of class |
n1 |
Either the sample size of the first stage (if
|
nuisance |
Value of the nuisance parameter. For the Student's t-test this is the variance. |
summary |
Is a summary of the sample size distribution desired? Otherwise, a vector with sample sizes is returned. |
plot |
Should a plot of the sample size distribution be drawn? |
iters |
Number of simulation iterations. |
seed |
Random seed for simulation. |
range |
determines how far the plot whiskers extend out from the box. If range is positive, the whiskers extend to the most extreme data point which is no more than range times the interquartile range from the box. A value of zero causes the whiskers to extend to the data extremes. |
allocation |
Whether the allocation ratio should be preserved
exactly ( |
... |
Further optional arguments. |
The method is only vectorized in either nuisance
or n1
.
Summary and/or plot of the sample size distribution for every nuisance parameter and every value of n1.
d <- setupStudent(alpha = .025, beta = .2, r = 1, delta = 3.5, delta_NI = 0, alternative = "greater", n_max = 156) n_dist(d, n1 = 20, nuisance = 5.5, summary = TRUE, plot = FALSE, seed = 2020)
d <- setupStudent(alpha = .025, beta = .2, r = 1, delta = 3.5, delta_NI = 0, alternative = "greater", n_max = 156) n_dist(d, n1 = 20, nuisance = 5.5, summary = TRUE, plot = FALSE, seed = 2020)
Returns the total sample size of a fixed design without sample size recalculation.
n_fix(design, nuisance, ...)
n_fix(design, nuisance, ...)
design |
test statistic object created by |
nuisance |
nuisance parameter for the respective test problem |
... |
Further optional arguments. |
The method is only vectorized in either nuisance
or n1
.
The method is implemented for the classes Student
,
ChiSquare
, and FarringtonManning
.
One value of the fixed sample size for every nuisance parameter and every value of n1.
d <- setupStudent(alpha = .025, beta = .2, r = 1, delta = 3.5, delta_NI = 0, alternative = "greater", n_max = 156) n_fix(design = d, nuisance = 5.5)
d <- setupStudent(alpha = .025, beta = .2, r = 1, delta = 3.5, delta_NI = 0, alternative = "greater", n_max = 156) n_fix(design = d, nuisance = 5.5)
Returns the sample size of a fixed design without sample size recalculation.
## S4 method for signature 'ChiSquare' n_fix( design, nuisance, variance = c("heterogeneous", "homogeneous"), rounded = TRUE, ... )
## S4 method for signature 'ChiSquare' n_fix( design, nuisance, variance = c("heterogeneous", "homogeneous"), rounded = TRUE, ... )
design |
Object of class |
nuisance |
Value of the nuisance parameter. For the Chi-Squared test this is the overall response rate. |
variance |
A character string indicating whether the " |
rounded |
Whether the calculated sample size should be rounded up such that the allocation ratio is preserved. |
... |
Further optional arguments. |
The method is only vectorized in either nuisance
or n1
.
One value of the fixed sample size for every nuisance parameter and every value of n1.
design1 <- setupChiSquare(alpha = 0.025, beta = 0.2, r = 1, delta = 0.2) n_fix(design1, nuisance = c(0.2, 0.3))
design1 <- setupChiSquare(alpha = 0.025, beta = 0.2, r = 1, delta = 0.2) n_fix(design1, nuisance = c(0.2, 0.3))
Returns the sample size of a fixed design without sample size recalculation.
## S4 method for signature 'FarringtonManning' n_fix(design, nuisance, rounded = TRUE, ...)
## S4 method for signature 'FarringtonManning' n_fix(design, nuisance, rounded = TRUE, ...)
design |
Object of class |
nuisance |
Value of the nuisance parameter. For the Farrington-Manning test this is the overall response rate. |
rounded |
Whether the calculated sample size should be rounded up such that the allocation ratio is preserved. |
... |
Further optional arguments. |
The method is only vectorized in either nuisance
or n1
.
One value of the fixed sample size for every nuisance parameter and every value of n1.
d <- setupFarringtonManning(alpha = 0.025, beta = 0.2, r = 1, delta = 0, delta_NI = 0.25) n_fix(d, nuisance = 0.3)
d <- setupFarringtonManning(alpha = 0.025, beta = 0.2, r = 1, delta = 0, delta_NI = 0.25) n_fix(d, nuisance = 0.3)
Returns the sample size of a fixed design without sample size recalculation.
## S4 method for signature 'Student' n_fix(design, nuisance, ...)
## S4 method for signature 'Student' n_fix(design, nuisance, ...)
design |
test statistic object |
nuisance |
nuisance parameter |
... |
Further optional arguments. |
The method is only vectorized in either nuisance
or n1
.
One value of the fixed sample size for every nuisance parameter and every value of n1.
d <- setupStudent(alpha = .025, beta = .2, r = 1, delta = 3.5, delta_NI = 0, alternative = "greater", n_max = 156) n_fix(design = d, nuisance = 5.5)
d <- setupStudent(alpha = .025, beta = .2, r = 1, delta = 3.5, delta_NI = 0, alternative = "greater", n_max = 156) n_fix(design = d, nuisance = 5.5)
Calculates the power of designs with blinded sample size recalculation or of fixed designs for one or several values of the nuisance parameter.
pow(design, n1, nuisance, recalculation, ...)
pow(design, n1, nuisance, recalculation, ...)
design |
object of class |
n1 |
total number of patients that are recruited before the sample size is recalculated |
nuisance |
nuisance parameter that is estimated at the interim analysis |
recalculation |
Should the sample size be recalculated after n1 n1 patients are recruited? |
... |
Further optional arguments. |
The method is only vectorized in either nuisance
or n1
.
The method is implemented for the classes Student
,
ChiSquare
, and FarringtonManning
.
One power value for every nuisance parameter and every value of n1.
d <- setupStudent(alpha = .025, beta = .2, r = 1, delta = 3.5, delta_NI = 0, alternative = "greater", n_max = 156) pow(d, n1 = 20, nuisance = 5.5, recalculation = TRUE)
d <- setupStudent(alpha = .025, beta = .2, r = 1, delta = 3.5, delta_NI = 0, alternative = "greater", n_max = 156) pow(d, n1 = 20, nuisance = 5.5, recalculation = TRUE)
Calculates the power of designs with blinded sample size recalculation or of fixed designs for one or several values of the nuisance parameter.
## S4 method for signature 'ChiSquare' pow( design, n1, nuisance, recalculation, allocation = c("exact", "approximate", "kf_approx"), ... )
## S4 method for signature 'ChiSquare' pow( design, n1, nuisance, recalculation, allocation = c("exact", "approximate", "kf_approx"), ... )
design |
Object of class |
n1 |
Either the sample size of the first stage (if
|
nuisance |
Value of the nuisance parameter in (0,1). For the Chi-Squared test this is the overall response rate. |
recalculation |
Should the sample size be recalculated after n1 n1 patients are recruited? |
allocation |
Whether the allocation ratio should be preserved
exactly ( |
... |
Further optional arguments. |
The method is only vectorized in either nuisance
or n1
.
One power value for every nuisance parameter and every value of n1.
d <- setupChiSquare(alpha = 0.025, beta = 0.2, r = 1, delta = 0.2) pow(d, n1 = 20, nuisance = c(0.2, 0.4), recalculation = TRUE)
d <- setupChiSquare(alpha = 0.025, beta = 0.2, r = 1, delta = 0.2) pow(d, n1 = 20, nuisance = c(0.2, 0.4), recalculation = TRUE)
Calculates the power of designs with blinded sample size recalculation or of fixed designs for one or several values of the nuisance parameter.
## S4 method for signature 'FarringtonManning' pow( design, n1, nuisance, recalculation, allocation = c("exact", "approximate"), ... )
## S4 method for signature 'FarringtonManning' pow( design, n1, nuisance, recalculation, allocation = c("exact", "approximate"), ... )
design |
Object of class |
n1 |
Either the sample size of the first stage (if
|
nuisance |
Value of the nuisance parameter in (0,1). For the Farrington-Manning test this is the overall response rate. |
recalculation |
Should the sample size be recalculated after n1 n1 patients are recruited? |
allocation |
Whether the allocation ratio should be preserved
exactly ( |
... |
Further optional arguments. |
The method is only vectorized in either nuisance
or n1
.
One power value for every nuisance parameter and every value of n1.
d <- setupFarringtonManning(alpha = 0.025, beta = 0.2, r = 1, delta = 0, delta_NI = 0.25) pow(d, n1 = 30, nuisance = 0.4, allocation = "approximate", recalculation = TRUE)
d <- setupFarringtonManning(alpha = 0.025, beta = 0.2, r = 1, delta = 0, delta_NI = 0.25) pow(d, n1 = 30, nuisance = 0.4, allocation = "approximate", recalculation = TRUE)
Calculates the power of designs with blinded sample size recalculation or of fixed designs for one or several values of the nuisance parameter.
## S4 method for signature 'Student' pow( design, n1, nuisance, recalculation = TRUE, iters = 10000, seed = NULL, allocation = c("approximate", "exact"), ... )
## S4 method for signature 'Student' pow( design, n1, nuisance, recalculation = TRUE, iters = 10000, seed = NULL, allocation = c("approximate", "exact"), ... )
design |
Object of class |
n1 |
Either the sample size of the first stage (if
|
nuisance |
Value of the nuisance parameter. For the Student's t-test this is the variance. |
recalculation |
Should the sample size be recalculated after n1 n1 patients are recruited? |
iters |
Number of simulation iterations. |
seed |
Random seed for simulation. |
allocation |
Whether the allocation ratio should be preserved
exactly ( |
... |
Further optional arguments. |
The method is only vectorized in either nuisance
or n1
.
One power value for every nuisance parameter and every value of n1.
d <- setupStudent(alpha = .025, beta = .2, r = 1, delta = 3.5, delta_NI = 0, alternative = "greater", n_max = 156) pow(d, n1 = 20, nuisance = 5.5, recalculation = TRUE)
d <- setupStudent(alpha = .025, beta = .2, r = 1, delta = 3.5, delta_NI = 0, alternative = "greater", n_max = 156) pow(d, n1 = 20, nuisance = 5.5, recalculation = TRUE)
This function simulates the probability that a test defined by
setupStudent
rejects the null hypothesis.
Note that here the nuisance parameter nuisance
is the variance
of the outcome variable sigma^2.
simulation( design, n1, nuisance, recalculation = TRUE, delta_true, iters = 1000, seed = NULL, allocation = c("approximate", "exact"), ... )
simulation( design, n1, nuisance, recalculation = TRUE, delta_true, iters = 1000, seed = NULL, allocation = c("approximate", "exact"), ... )
design |
Object of class |
n1 |
Either the sample size of the first stage (if
|
nuisance |
Value of the nuisance parameter. For the Student's t-test this is the variance. |
recalculation |
Should the sample size be recalculated after n1 n1 patients are recruited? |
delta_true |
effect measure under which the rejection probabilities are computed |
iters |
Number of simulation iterations. |
seed |
Random seed for simulation. |
allocation |
Whether the allocation ratio should be preserved
exactly ( |
... |
Further optional arguments. |
The implementation follows the algorithm in Lu (2019):
Distribution of the two-sample t-test statistic following blinded
sample size re-estimation.
Pharmaceutical Statistics 15: 208-215.
Since Lu (2019) assumes negative non-inferiority margins, the non-inferiority
margin of design
is multiplied with -1 internally.
Simulated rejection probabilities and sample sizes for each nuisance parameter.
d <- setupStudent(alpha = .025, beta = .2, r = 1, delta = 3.5, delta_NI = 0, alternative = "greater", n_max = 156) simulation(d, n1 = 20, nuisance = 5.5, recalculation = TRUE, delta_true = 3.5)
d <- setupStudent(alpha = .025, beta = .2, r = 1, delta = 3.5, delta_NI = 0, alternative = "greater", n_max = 156) simulation(d, n1 = 20, nuisance = 5.5, recalculation = TRUE, delta_true = 3.5)
This class implements Student's t-test for superiority and non-inferiority
tests.
A trial with continuous outcomes of the two groups E
and C
is assumed.
If alternative == "greater"
the null hypothesis for the
mean difference is
Here, denotes the non-inferiority margin.
For superiority trials,
can be set to zero (default).
If
alternative=="smaller"
, the direction of the effect is changed.
The function setupStudent
creates an object of class
Student
that can be used for sample size recalculation.
setupStudent( alpha, beta, r = 1, delta, delta_NI = 0, alternative = c("greater", "smaller"), n_max = Inf, ... )
setupStudent( alpha, beta, r = 1, delta, delta_NI = 0, alternative = c("greater", "smaller"), n_max = Inf, ... )
alpha |
One-sided type I error rate. |
beta |
Type II error rate. |
r |
Allocation ratio between experimental and control group. |
delta |
Difference of effect size between alternative and null hypothesis. |
delta_NI |
Non-inferiority margin. |
alternative |
Does the alternative hypothesis contain greater
( |
n_max |
Maximal overall sample size. If the recalculated sample size
is greater than |
... |
Further optional arguments. |
The nuisance parameter is the variance .
Within the blinded sample size recalculation procedure, it is re-estimated by
the one-sample variance estimator that is defined by
where is the outcome of patient
in group
,
denotes the first-stage sample size in group
and
equals the mean over all
observations.
The following methods are available for this class:
toer
, pow
, n_dist
,
adjusted_alpha
, and n_fix
.
Check the design specific documentation for details.
An object of class Student
.
Lu, K. (2019). Distribution of the two-sample t-test statistic following blinded sample size re-estimation. Pharmaceutical Statistics 15(3): 208-215.
d <- setupStudent(alpha = .025, beta = .2, r = 1, delta = 3.5, delta_NI = 0, alternative = "greater", n_max = 156)
d <- setupStudent(alpha = .025, beta = .2, r = 1, delta = 3.5, delta_NI = 0, alternative = "greater", n_max = 156)
Computes the type I error rate of designs with blinded sample size recalculation or of fixed designs for one or several values of the nuisance parameter.
toer(design, n1, nuisance, recalculation, ...)
toer(design, n1, nuisance, recalculation, ...)
design |
object of class |
n1 |
total number of patients that are recruited before the sample size is recalculated |
nuisance |
nuisance parameter that is estimated at the interim analysis |
recalculation |
Should the sample size be recalculated after n1 n1 patients are recruited? |
... |
Further optional arguments. |
The method is only vectorized in either nuisance
or n1
.
The method is implemented for the classes Student
,
ChiSquare
, and FarringtonManning
.
One type I error rate value for every nuisance parameter and every value of n1.
d <- setupStudent(alpha = .025, beta = .2, r = 1, delta = 3.5, delta_NI = 0, alternative = "greater", n_max = 156) toer(d, n1 = 20, nuisance = 5.5, recalculation = TRUE)
d <- setupStudent(alpha = .025, beta = .2, r = 1, delta = 3.5, delta_NI = 0, alternative = "greater", n_max = 156) toer(d, n1 = 20, nuisance = 5.5, recalculation = TRUE)
Computes the type I error rate of designs with blinded sample size recalculation or of fixed designs for one or several values of the nuisance parameter.
## S4 method for signature 'ChiSquare' toer( design, n1, nuisance, recalculation, allocation = c("exact", "approximate", "kf_approx"), ... )
## S4 method for signature 'ChiSquare' toer( design, n1, nuisance, recalculation, allocation = c("exact", "approximate", "kf_approx"), ... )
design |
Object of class |
n1 |
Either the sample size of the first stage (if
|
nuisance |
Value of the nuisance parameter in (0,1). For the Chi-Squared test this is the overall response rate. |
recalculation |
Should the sample size be recalculated after n1 n1 patients are recruited? |
allocation |
Whether the allocation ratio should be preserved
exactly ( |
... |
Further optional arguments. |
The method is only vectorized in either nuisance
or n1
.
One type I error rate value for every nuisance parameter and every value of n1.
d <- setupChiSquare(alpha = 0.025, beta = 0.2, r = 1, delta = 0.2) toer(d, n1 = c(10, 20), nuisance = 0.25, recalculation = TRUE)
d <- setupChiSquare(alpha = 0.025, beta = 0.2, r = 1, delta = 0.2) toer(d, n1 = c(10, 20), nuisance = 0.25, recalculation = TRUE)
Computes the type I error rate of designs with blinded sample size recalculation or of fixed designs for one or several values of the nuisance parameter.
## S4 method for signature 'FarringtonManning' toer( design, n1, nuisance, recalculation, allocation = c("exact", "approximate"), ... )
## S4 method for signature 'FarringtonManning' toer( design, n1, nuisance, recalculation, allocation = c("exact", "approximate"), ... )
design |
Object of class |
n1 |
Either the sample size of the first stage (if
|
nuisance |
Value of the nuisance parameter in (0,1). For the Farrington-Manning test this is the overall response rate. |
recalculation |
Should the sample size be recalculated after n1 n1 patients are recruited? |
allocation |
Whether the allocation ratio should be preserved
exactly ( |
... |
Further optional arguments. |
The method is only vectorized in either nuisance
or n1
.
One type I error rate value for every nuisance parameter and every value of n1.
d <- setupFarringtonManning(alpha = 0.025, beta = 0.2, r = 1, delta = 0, delta_NI = 0.2) toer(d, n1 = 20, nuisance = 0.25, recalculation = TRUE, allocation = "approximate")
d <- setupFarringtonManning(alpha = 0.025, beta = 0.2, r = 1, delta = 0, delta_NI = 0.2) toer(d, n1 = 20, nuisance = 0.25, recalculation = TRUE, allocation = "approximate")
Computes the type I error rate of designs with blinded sample size recalculation or of fixed designs for one or several values of the nuisance parameter.
## S4 method for signature 'Student' toer( design, n1, nuisance, recalculation = TRUE, iters = 10000, seed = NULL, allocation = c("approximate", "exact"), ... )
## S4 method for signature 'Student' toer( design, n1, nuisance, recalculation = TRUE, iters = 10000, seed = NULL, allocation = c("approximate", "exact"), ... )
design |
Object of class |
n1 |
Either the sample size of the first stage (if
|
nuisance |
Value of the nuisance parameter. For the Student's t-test this is the variance. |
recalculation |
Should the sample size be recalculated after n1 n1 patients are recruited? |
iters |
Number of simulation iterations. |
seed |
Random seed for simulation. |
allocation |
Whether the allocation ratio should be preserved
exactly ( |
... |
Further optional arguments. |
The method is only vectorized in either nuisance
or n1
.
One type I error rate value for every nuisance parameter and every value of n1.
d <- setupStudent(alpha = .025, beta = .2, r = 1, delta = 3.5, delta_NI = 0, alternative = "greater", n_max = 156) toer(d, n1 = 20, nuisance = 5.5, recalculation = TRUE)
d <- setupStudent(alpha = .025, beta = .2, r = 1, delta = 3.5, delta_NI = 0, alternative = "greater", n_max = 156) toer(d, n1 = 20, nuisance = 5.5, recalculation = TRUE)