Skip to content

Commit

Permalink
Merge branch 'cran'
Browse files Browse the repository at this point in the history
  • Loading branch information
karissawhiting committed Nov 28, 2023
2 parents 959e26a + 57ac68d commit 2898a0d
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 9 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 6 additions & 0 deletions R/toxbdry.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
5 changes: 3 additions & 2 deletions man/calogrank.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
11 changes: 10 additions & 1 deletion man/clinfun-internal.Rd
Original file line number Diff line number Diff line change
@@ -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.
}
Expand Down
25 changes: 20 additions & 5 deletions man/gsdesign.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -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.}
Expand All @@ -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}

0 comments on commit 2898a0d

Please sign in to comment.