diff --git a/DESCRIPTION b/DESCRIPTION index ba4e829..531531d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: clinfun Title: Clinical Trial Design and Data Analysis Functions -Version: 1.1.3.990 +Version: 1.1.5 Depends: R (>= 3.0.0), graphics, stats Imports: mvtnorm Suggests: knitr, rmarkdown, survival diff --git a/NEWS.md b/NEWS.md index d98034b..04f6ae5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,12 @@ +# clinfun 1.1.5 (10/19/2023) + +* clarified one-sided vs two-sided futility boundary for gsdesign functions + +# clinfun 1.1.4 (10/12/2023) + +* added check for n; since it is for stopping early at least two values should be given +* addressed the warning in the example for calogrank; status had both death and transplant + # clinfun 1.1.3 (07/11/2023) * fixed the bug in ph2simon/twostage.admissible when minimax is also optimal diff --git a/R/toxbdry.R b/R/toxbdry.R index 5c4ec18..b5f7bfd 100644 --- a/R/toxbdry.R +++ b/R/toxbdry.R @@ -113,6 +113,9 @@ bdrycross.prob <- function(n, r, ptox) { # P(cross bdry | low non-response rate) = cP0 -> response not promising -> 1-power # since size under null needs to be met priority choice should be "alt" futilbdry <- function(rLo, rHi, n, size=0.1, power=0.9, ngrid=3, niter=10, delta=0.5) { + # stop if length(n) is 1; check that values in n are increasing + if (length(n) == 1) stop("n should have at least two values to be able to stop early") + if (min(diff(n)) < 1) stop("n should be in increasing order") # setup toxbdry parameters pLo = 1-rHi pHi = 1-rLo @@ -138,6 +141,9 @@ futilbdry <- function(rLo, rHi, n, size=0.1, power=0.9, ngrid=3, niter=10, delta # toxicity boundary toxbdry <- function(pLo, pHi, n, cP0=0.1, cP1=0.9, ngrid=6, niter=10, delta=0, priority=c("null","alt")) { +# stop if length(n) is 1; check that values in n are increasing + if (length(n) == 1) stop("n should have at least two values to be able to stop early") + if (min(diff(n)) < 1) stop("n should be in increasing order") # decide whether to prioritize the type I (null) or the type II (alt) error. priority <- match.arg(priority) priorityNull= priority=="null" diff --git a/man/calogrank.Rd b/man/calogrank.Rd index 0e37aa2..4b73e4d 100644 --- a/man/calogrank.Rd +++ b/man/calogrank.Rd @@ -25,8 +25,9 @@ pbc1 <- pbc pbc1$trt[pbc1$trt == -9] <- NA pbc1$copper[pbc1$copper == -9] <- NA - calogrank(pbc1$time, pbc1$status, pbc1$trt, pbc1[,c("copper")]) - calogrank(pbc1$time, pbc1$status, pbc1$trt, + # only death (2) is considered; transplant(1) is censored + calogrank(pbc1$time, pbc1$status==2, pbc1$trt, pbc1[,c("copper")]) + calogrank(pbc1$time, pbc1$status==2, pbc1$trt, pbc1[,c("protime", "copper")])} } \references{ diff --git a/man/clinfun-internal.Rd b/man/clinfun-internal.Rd index e125ca3..796cff8 100644 --- a/man/clinfun-internal.Rd +++ b/man/clinfun-internal.Rd @@ -1,8 +1,17 @@ \name{clinfun-internal} \title{Internal clinfun functions} -\alias{compareROC} +\alias{compareROC.paired} +\alias{compareROC.unpaired} \alias{exactNull} +\alias{getBoundary} +\alias{gsd.bdryconstant} +\alias{gsd.drift.efficacy} +\alias{gsd.drift.both} \alias{gsd.drift} +\alias{mrcobj} +\alias{smmrcobj} +\alias{rocauc} +\alias{smrocauc} \description{ Internal functions used by the functions in the package. } diff --git a/man/gsdesign.Rd b/man/gsdesign.Rd index 855e2da..2963136 100644 --- a/man/gsdesign.Rd +++ b/man/gsdesign.Rd @@ -49,8 +49,10 @@ gsdesign.survival(ifrac, haz.ratio, r = 1, sig.level = 0.05, } \value{ a list with ifrac, sig.level, power, alternative, delta.eb, delta.fb and: - \item{efbdry}{the critical value to use at the different looks.} - \item{futbdry}{the critical value to use at the different looks.} + \item{efbdry}{the critical value to use at the different looks. For + two-sided alternative the absolute test statistic should exceed this.} + \item{futbdry}{the critical value to use at the different looks. For + two-sided alternative the absolute test statistic should be below this.} \item{sample.size}{the sample size per arm for binomial/normal data.} \item{num.events}{the total number of failures which should be converted to number of subjects using censoring proportion.} @@ -59,11 +61,24 @@ gsdesign.survival(ifrac, haz.ratio, r = 1, sig.level = 0.05, The futility boundary is not returned when delta.fb is not specified i.e. stopping for futility is not requested. The futility boundary is non-binding. That is the significance level is not adjusted to account - for early stopping for utility. This makes the test a bit conservative + for early stopping for futility. This makes the test a bit conservative in that the true size is less than the nominal level. + If the alternative is two-sided by default the futility boundary will + also be two-sided i.e. continuation region is wedge shaped. However, + if the goal is to show the superiority of the experimental treatment + then futility boundary should be one sided. This can be achieved by + deriving the boundaries for one-sided alternative and significance + level set at half of the value used for two sided alternative. See the + examples section for a representative design for which the trial + cannot be stopped at the first look for futility. + The Casagrande-Pike-Smith type continuity correction is obtained using - the formula n*{1 + sqrt{1+4/{abs(pC-pE)*n}}}^2 where n is the - uncorrected sample size. + the formula \deqn{n*[1 + \sqrt{1+4/(|pC-pE|*n)}]^2} where n is + the uncorrected sample size. +} +\examples{ + gsdesign.normal(1:4/4, 0.25, sig.level=0.05, alt="t", delta.fb=0.5) + gsdesign.normal(1:4/4, 0.25, sig.level=0.025, alt="o", delta.fb=0.5) } \keyword{design}