From noreply at r-forge.r-project.org Sat May 24 11:53:14 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 24 May 2014 11:53:14 +0200 (CEST) Subject: [Gsdesign-commits] r367 - pkg/gsDesign/R Message-ID: <20140524095314.8F163186CBC@r-forge.r-project.org> Author: keaven Date: 2014-05-24 11:53:13 +0200 (Sat, 24 May 2014) New Revision: 367 Modified: pkg/gsDesign/R/nEvents.R Log: nEvents table output changed to data.frame class Modified: pkg/gsDesign/R/nEvents.R =================================================================== --- pkg/gsDesign/R/nEvents.R 2014-02-24 00:19:38 UTC (rev 366) +++ pkg/gsDesign/R/nEvents.R 2014-05-24 09:53:13 UTC (rev 367) @@ -4,16 +4,18 @@ delta <- -c * (log(hr) - log(hr0)) if (n[1] == 0) { n <- (qnorm(1-alpha/sided)+qnorm(1-beta))^2/delta^2 - if (tbl) n <- cbind(hr = hr, n = ceiling(n), alpha = alpha, sided=sided, beta = beta, + if (tbl) n <- data.frame(cbind(hr = hr, n = ceiling(n), alpha = alpha, + sided=sided, beta = beta, Power = 1-beta, delta = delta, ratio = ratio, - hr0 = hr0, se = 1/c/sqrt(ceiling(n))) + hr0 = hr0, se = 1/c/sqrt(ceiling(n)))) return(n) } else { pwr <- pnorm(-(qnorm(1-alpha/sided)-sqrt(n) * delta)) - if (tbl) pwr <- cbind(hr = hr, n = n, alpha = alpha, sided=sided, beta = 1-pwr, + if (tbl) pwr <- data.frame(cbind(hr = hr, n = n, alpha = alpha, + sided=sided, beta = 1-pwr, Power = pwr, delta = delta, ratio = ratio, - hr0 = hr0, se = sqrt(1/n)/c) + hr0 = hr0, se = sqrt(1/n)/c)) return(pwr) } } From noreply at r-forge.r-project.org Sat May 24 14:44:13 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 24 May 2014 14:44:13 +0200 (CEST) Subject: [Gsdesign-commits] r368 - pkg/gsDesign/R Message-ID: <20140524124413.C89361849A4@r-forge.r-project.org> Author: keaven Date: 2014-05-24 14:44:12 +0200 (Sat, 24 May 2014) New Revision: 368 Modified: pkg/gsDesign/R/gsCP.R pkg/gsDesign/R/gsDesign.R pkg/gsDesign/R/nNormal.R Log: Modified: pkg/gsDesign/R/gsCP.R =================================================================== --- pkg/gsDesign/R/gsCP.R 2014-05-24 09:53:13 UTC (rev 367) +++ pkg/gsDesign/R/gsCP.R 2014-05-24 12:44:12 UTC (rev 368) @@ -156,9 +156,8 @@ checkVector(prior$gridwgts, "numeric", c(0, Inf), c(TRUE, FALSE)) checkVector(prior$density, "numeric", c(0, Inf), c(TRUE, FALSE)) checkVector(prior$z, "numeric", c(-Inf,Inf), c(FALSE, FALSE)) - cl <- class(x) - if (cl != "gsDesign" && cl != "gsProbability") - stop("gsPosterior: x must have class gsDesign or gsProbability") + if (!(is(x, "gsProbability") || is(x, "gsDesign"))) + stop("gsPosterior: x must have class gsDesign or gsProbability") test.type <- ifelse(is(x, "gsProbability"), 3, x$test.type) checkScalar(i, "integer", c(1, x$k-1)) if (is.null(zi)) zi <- c(x$lower$bound[i],x$upper$bound[i]) Modified: pkg/gsDesign/R/gsDesign.R =================================================================== --- pkg/gsDesign/R/gsDesign.R 2014-05-24 09:53:13 UTC (rev 367) +++ pkg/gsDesign/R/gsDesign.R 2014-05-24 12:44:12 UTC (rev 368) @@ -124,14 +124,14 @@ "gsDesign"<-function(k=3, test.type=4, alpha=0.025, beta=0.1, astar=0, delta=0, n.fix=1, timing=1, sfu=sfHSD, sfupar=-4, sfl=sfHSD, sflpar=-2, tol=0.000001, r=18, n.I=0, maxn.IPlan=0, - nFixSurv=0, endpoint=NULL, delta1=1, delta0=0) + nFixSurv=0, endpoint=NULL, delta1=1, delta0=0, overrun=0) { # Derive a group sequential design and return in a gsDesign structure # set up class variable x for gsDesign being requested x <- list(k=k, test.type=test.type, alpha=alpha, beta=beta, astar=astar, delta=delta, n.fix=n.fix, timing=timing, tol=tol, r=r, n.I=n.I, maxn.IPlan=maxn.IPlan, - nFixSurv=nFixSurv, nSurv=0, endpoint=endpoint, delta1=delta1, delta0=delta0) + nFixSurv=nFixSurv, nSurv=0, endpoint=endpoint, delta1=delta1, delta0=delta0, overrun=overrun) class(x) <- "gsDesign" @@ -210,14 +210,14 @@ x } -"gsProbability" <- function(k=0, theta, n.I, a, b, r=18, d=NULL) +"gsProbability" <- function(k=0, theta, n.I, a, b, r=18, d=NULL, overrun=0) { # compute boundary crossing probabilities and return in a gsProbability structure # check input arguments checkScalar(k, "integer", c(0,30)) checkVector(theta, "numeric") - + if (k == 0) { if (!is(d,"gsDesign")) @@ -228,6 +228,7 @@ } # check remaingin input arguments + checkVector(overrrun,length=k-1,interval=c(0,Inf),include=c(TRUE,FALSE)) checkScalar(r, "integer", c(1,80)) checkLengths(n.I, a, b) if (k != length(a)) @@ -248,9 +249,11 @@ phi <- matrix(xx[[8]], k, ntheta) powr <- as.vector(array(1, k) %*% phi) futile <- array(1, k) %*% plo - en <- as.vector(n.I %*% (plo + phi) + n.I[k] * (t(array(1, ntheta)) - powr - futile)) + nOver <- c(n.I[1:(k-1)]+overrun,n.I[k]) + nOver[nOver>n.I[k]] <- n.I[k] + en <- as.vector(nOver %*% (plo + phi) + n.I[k] * (t(array(1, ntheta)) - powr - futile)) x <- list(k=xx[[1]], theta=xx[[3]], n.I=xx[[4]], lower=list(bound=xx[[5]], prob=plo), - upper=list(bound=xx[[6]], prob=phi), en=en, r=r) + upper=list(bound=xx[[6]], prob=phi), en=en, r=r, overrun=overrun) class(x) <- "gsProbability" @@ -345,7 +348,7 @@ # add boundary crossing probabilities for theta to x x$theta <- c(0,x$delta) - y <- gsprob(x$theta, x$n.I, a, x$upper$bound, r=x$r) + y <- gsprob(x$theta, x$n.I, a, x$upper$bound, r=x$r, overrun=x$overrun) x$upper$prob <- y$probhi x$en <- as.vector(y$en) @@ -426,7 +429,7 @@ } x$theta <- c(0, x$delta) - y <- gsprob(x$theta, x$n.I, x$lower$bound, x$upper$bound, r=x$r) + y <- gsprob(x$theta, x$n.I, x$lower$bound, x$upper$bound, r=x$r, overrun=overrun) x$upper$prob <- y$probhi x$lower$prob <- y$problo x$en <- as.vector(y$en) @@ -522,7 +525,7 @@ # add boundary crossing probabilities for theta to x x$theta <- c(0, x$delta) - x4 <- gsprob(x$theta, x2$I, x2$a, x2$b) + x4 <- gsprob(x$theta, x2$I, x2$a, x2$b, overrun=x$overrun) x$upper$prob <- x4$probhi x$lower$prob <- x4$problo x$en <- as.vector(x4$en) @@ -633,7 +636,7 @@ # add boundary crossing probabilities for theta to x x$theta <- c(0,x$delta) - x4 <- gsprob(x$theta,x$n.I,x$lower$bound,x$upper$bound) + x4 <- gsprob(x$theta,x$n.I,x$lower$bound,x$upper$bound,overrun=overrun) x$upper$prob <- x4$probhi x$lower$prob <- x4$problo x$en <- as.vector(x4$en) @@ -680,7 +683,7 @@ # add boundary crossing probabilities for theta to x x$theta <- c(0, x$delta) - x4 <- gsprob(x$theta, x$n.I, -x2$b, x1$b) + x4 <- gsprob(x$theta, x$n.I, -x2$b, x1$b, overrun=overrun) x$upper$prob <- x4$probhi x$lower$prob <- x4$problo x$en <- as.vector(x4$en) @@ -720,7 +723,7 @@ # compute additional error rates needed and add to x x$theta <- c(0, x$delta) x$falseposnb <- as.vector(gsprob(0, xx$I, array(-20, x$k), x0$b, r=x$r)$probhi) - x3 <- gsprob(x$theta, xx$I, xx$a, x0$b, r=x$r) + x3 <- gsprob(x$theta, xx$I, xx$a, x0$b, r=x$r, overrun=x$overrun) x$upper$prob <- x3$probhi x$lower$prob <- x3$problo x$en <- as.vector(x3$en) @@ -797,7 +800,7 @@ # compute error rates needed and add to x x$theta <- c(0,x$delta) x$falseposnb <- as.vector(gsprob(0, x$n.I, array(-20, x$k), x$upper$bound,r =x$r)$probhi) - x3 <- gsprob(x$theta, x$n.I, x$lower$bound, x$upper$bound, r=x$r) + x3 <- gsprob(x$theta, x$n.I, x$lower$bound, x$upper$bound, r=x$r, overrun=overrun) x$upper$prob <- x3$probhi x$lower$prob <- x3$problo x$en <- as.vector(x3$en) @@ -877,7 +880,7 @@ x } -"gsprob" <- function(theta, I, a, b, r=18) +"gsprob" <- function(theta, I, a, b, r=18, overrun=0) { # gsprob: use call to C routine to compute upper and lower boundary crossing probabilities # given theta, interim sample sizes (information: I), lower bound (a) and upper bound (b) @@ -892,7 +895,9 @@ phi <- matrix(xx[[8]], nanal, ntheta) powr <- array(1, nanal)%*%phi futile <- array(1, nanal)%*%plo - en <- I %*% (plo+phi) + I[nanal] * (t(array(1, ntheta)) - powr - futile) + IOver <- c(I[1:(nanal-1)]+overrun,I[nanal]) + IOver[IOver>I[nanal]]<-nanal + en <- IOver %*% (plo+phi) + I[nanal] * (t(array(1, ntheta)) - powr - futile) list(k=xx[[1]], theta=xx[[3]], I=xx[[4]], a=xx[[5]], b=xx[[6]], problo=plo, probhi=phi, powr=powr, en=en, r=r) } @@ -1040,5 +1045,8 @@ x$test.type <- as.integer(x$test.type) x$r <- as.integer(x$r) + # check overrun vector + checkVector(x$overrun,length(x$k-1),interval=c(0,Inf),inclusion=c(TRUE,FALSE)) + x } Modified: pkg/gsDesign/R/nNormal.R =================================================================== --- pkg/gsDesign/R/nNormal.R 2014-05-24 09:53:13 UTC (rev 367) +++ pkg/gsDesign/R/nNormal.R 2014-05-24 12:44:12 UTC (rev 368) @@ -1,11 +1,42 @@ -"nNormal" <- function(delta1=1, sigma=1.7, sigalt=NULL, alpha=.025, - beta=.1, ratio=1, sided=1, n=NULL, delta0=0) -{ xi <- ratio/(1+ratio) - if (is.null(sigalt)) sigalt <- sigma - v <- sigalt^2/xi + sigma^2/(1-xi) - theta1 <- (delta1-delta0)/sqrt(v) - if (is.null(n)) - return(((qnorm(alpha/sided)+qnorm(beta))/theta1)^2) - else - return(pnorm(sqrt(n)*theta1-qnorm(1-alpha/sided))) +"nNormal" <- function(delta1=1, sd=1.7, sd2=NULL, alpha=.025, + beta=.1, ratio=1, sided=1, n=NULL, delta0=0, outtype=1) +{ # check input arguments + checkVector(delta1, "numeric", c(-Inf, Inf), c(FALSE, FALSE)) + checkVector(sd, "numeric", c(0, Inf), c(FALSE, FALSE)) + checkScalar(sided, "integer", c(1, 2)) + checkScalar(alpha, "numeric", c(0, 1 / sided), c(FALSE, FALSE)) + checkVector(beta, "numeric", c(0, 1 - alpha / sided), c(FALSE, FALSE)) + checkVector(delta0, "numeric", c(-Inf, Inf), c(FALSE, FALSE)) + checkVector(ratio, "numeric", c(0, Inf), c(FALSE, FALSE)) + checkScalar(outtype, "integer", c(1, 3)) + checkLengths(delta1, delta0, sd, sd2, alpha, beta, ratio, allowSingle=TRUE) + + xi <- ratio/(1+ratio) + if (is.null(sd2)) sd2 <- sd + se <- sqrt(sd2^2/xi + sd^2/(1-xi)) + theta1 <- (delta1-delta0)/se + if (max(abs(theta1) == 0)) stop("delta1 may not equal delta0") + if (is.null(n)){ + n <-((qnorm(alpha/sided)+qnorm(beta))/theta1)^2 + if (outtype == 2) + { + return(data.frame(cbind(n1=n / (ratio + 1), n2=ratio * n / (ratio + 1)))) + } + else if (outtype == 3) + { + return(data.frame(cbind(n=n, n1=n / (ratio + 1), n2=ratio * n / (ratio + 1), + alpha = alpha, sided=sided, beta = beta, Power = 1-beta, + sd=sd, sd2=sd2, delta1=delta1, delta0=delta0, se=se/sqrt(n)))) + } + else return(n=n) + }else{ + powr <- pnorm(sqrt(n)*theta1-qnorm(1-alpha/sided)) + if (outtype == 2) return(data.frame(cbind(n1=n / (ratio + 1), n2=ratio * n / (ratio + 1), Power=powr))) + else if (outtype == 3){ + return(data.frame(cbind(n=n, n1=n / (ratio + 1), n2=ratio * n / (ratio + 1), + alpha = alpha, sided=sided, beta = 1-powr, Power = powr, + sd=sd, sd2=sd2, delta1=delta1, delta0=delta0, se=se/sqrt(n)))) + } + else(return(Power=powr)) + } } From noreply at r-forge.r-project.org Mon May 26 03:52:08 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 26 May 2014 03:52:08 +0200 (CEST) Subject: [Gsdesign-commits] r369 - in pkg/gsDesign: . R man Message-ID: <20140526015209.01664186EC5@r-forge.r-project.org> Author: keaven Date: 2014-05-26 03:52:07 +0200 (Mon, 26 May 2014) New Revision: 369 Modified: pkg/gsDesign/DESCRIPTION pkg/gsDesign/NAMESPACE pkg/gsDesign/R/gsCP.R pkg/gsDesign/R/gsDesign.R pkg/gsDesign/man/gsDesign.Rd pkg/gsDesign/man/gsProbability.Rd Log: Added overrun computations to expected sample size; updated help files for gsDesign, gsProbability Modified: pkg/gsDesign/DESCRIPTION =================================================================== --- pkg/gsDesign/DESCRIPTION 2014-05-24 12:44:12 UTC (rev 368) +++ pkg/gsDesign/DESCRIPTION 2014-05-26 01:52:07 UTC (rev 369) @@ -1,5 +1,5 @@ Package: gsDesign -Version: 2.8-9 +Version: 2.9 Title: Group Sequential Design Author: Keaven Anderson Maintainer: Keaven Anderson Modified: pkg/gsDesign/NAMESPACE =================================================================== --- pkg/gsDesign/NAMESPACE 2014-05-24 12:44:12 UTC (rev 368) +++ pkg/gsDesign/NAMESPACE 2014-05-26 01:52:07 UTC (rev 369) @@ -1,4 +1,5 @@ useDynLib(gsDesign) +import(RUnit,ggplot2,plyr,stringr,xtable) export(gsBoundCP, gsCP, gsPP, gsPI, gsPOS, gsCPOS, gsDensity, gsPosterior) export(gsCPz, gsHR, gsDelta, gsBValue, gsRR, hrn2z, hrz2n, zn2hr) export(gsBound, gsBound1, gsDesign, gsProbability) Modified: pkg/gsDesign/R/gsCP.R =================================================================== --- pkg/gsDesign/R/gsCP.R 2014-05-24 12:44:12 UTC (rev 368) +++ pkg/gsDesign/R/gsCP.R 2014-05-26 01:52:07 UTC (rev 369) @@ -71,7 +71,7 @@ anew <- array(-20, knew) } - gsProbability(k=knew, theta=theta, n.I=Inew, a=anew, b=bnew, r=r) + gsProbability(k=knew, theta=theta, n.I=Inew, a=anew, b=bnew, r=r, overrun=0) } gsPP <- function(x, i=1, zi=0, theta=c(0,3), wgts=c(.5,.5), r=18, total=TRUE) Modified: pkg/gsDesign/R/gsDesign.R =================================================================== --- pkg/gsDesign/R/gsDesign.R 2014-05-24 12:44:12 UTC (rev 368) +++ pkg/gsDesign/R/gsDesign.R 2014-05-26 01:52:07 UTC (rev 369) @@ -227,8 +227,9 @@ return(gsDProb(theta=theta, d=d)) } - # check remaingin input arguments - checkVector(overrrun,length=k-1,interval=c(0,Inf),include=c(TRUE,FALSE)) + # check remaining input arguments + checkVector(x=overrun,isType="numeric",interval=c(0,Inf),inclusion=c(TRUE,FALSE)) + if(length(overrun)!= 1 && length(overrun)!= k-1) stop(paste("overrun length should be 1 or ",as.character(k-1))) checkScalar(r, "integer", c(1,80)) checkLengths(n.I, a, b) if (k != length(a)) @@ -249,7 +250,9 @@ phi <- matrix(xx[[8]], k, ntheta) powr <- as.vector(array(1, k) %*% phi) futile <- array(1, k) %*% plo - nOver <- c(n.I[1:(k-1)]+overrun,n.I[k]) + if(k==1){nOver <- n.I[k]}else{ + nOver <- c(n.I[1:(k-1)]+overrun,n.I[k]) + } nOver[nOver>n.I[k]] <- n.I[k] en <- as.vector(nOver %*% (plo + phi) + n.I[k] * (t(array(1, ntheta)) - powr - futile)) x <- list(k=xx[[1]], theta=xx[[3]], n.I=xx[[4]], lower=list(bound=xx[[5]], prob=plo), @@ -429,7 +432,7 @@ } x$theta <- c(0, x$delta) - y <- gsprob(x$theta, x$n.I, x$lower$bound, x$upper$bound, r=x$r, overrun=overrun) + y <- gsprob(x$theta, x$n.I, x$lower$bound, x$upper$bound, r=x$r, overrun=x$overrun) x$upper$prob <- y$probhi x$lower$prob <- y$problo x$en <- as.vector(y$en) @@ -636,7 +639,7 @@ # add boundary crossing probabilities for theta to x x$theta <- c(0,x$delta) - x4 <- gsprob(x$theta,x$n.I,x$lower$bound,x$upper$bound,overrun=overrun) + x4 <- gsprob(x$theta,x$n.I,x$lower$bound,x$upper$bound,overrun=x$overrun) x$upper$prob <- x4$probhi x$lower$prob <- x4$problo x$en <- as.vector(x4$en) @@ -683,7 +686,7 @@ # add boundary crossing probabilities for theta to x x$theta <- c(0, x$delta) - x4 <- gsprob(x$theta, x$n.I, -x2$b, x1$b, overrun=overrun) + x4 <- gsprob(x$theta, x$n.I, -x2$b, x1$b, overrun=x$overrun) x$upper$prob <- x4$probhi x$lower$prob <- x4$problo x$en <- as.vector(x4$en) @@ -800,7 +803,7 @@ # compute error rates needed and add to x x$theta <- c(0,x$delta) x$falseposnb <- as.vector(gsprob(0, x$n.I, array(-20, x$k), x$upper$bound,r =x$r)$probhi) - x3 <- gsprob(x$theta, x$n.I, x$lower$bound, x$upper$bound, r=x$r, overrun=overrun) + x3 <- gsprob(x$theta, x$n.I, x$lower$bound, x$upper$bound, r=x$r, overrun=x$overrun) x$upper$prob <- x3$probhi x$lower$prob <- x3$problo x$en <- as.vector(x3$en) @@ -896,8 +899,8 @@ powr <- array(1, nanal)%*%phi futile <- array(1, nanal)%*%plo IOver <- c(I[1:(nanal-1)]+overrun,I[nanal]) - IOver[IOver>I[nanal]]<-nanal - en <- IOver %*% (plo+phi) + I[nanal] * (t(array(1, ntheta)) - powr - futile) + IOver[IOver>I[nanal]]<-I[nanal] + en <- as.vector(IOver %*% (plo+phi) + I[nanal] * (t(array(1, ntheta)) - powr - futile)) list(k=xx[[1]], theta=xx[[3]], I=xx[[4]], a=xx[[5]], b=xx[[6]], problo=plo, probhi=phi, powr=powr, en=en, r=r) } @@ -921,7 +924,12 @@ phi <- matrix(xx[[8]], k, ntheta) powr <- as.vector(array(1, k) %*% phi) futile <- array(1, k) %*% plo - en <- as.vector(n.I %*% (plo + phi) + n.I[k] * (t(array(1, ntheta)) - powr - futile)) + if (k==1){IOver <- n.I}else{ + IOver <- c(n.I[1:(k-1)]+d$overrun,n.I[k]) + } + IOver[IOver>n.I[k]]<-n.I[k] + en <- as.vector(IOver %*% (plo+phi) + n.I[k] * (t(array(1, ntheta)) - powr - futile)) + d$en <- en d$theta <- theta d$upper$prob <- phi @@ -1046,7 +1054,8 @@ x$r <- as.integer(x$r) # check overrun vector - checkVector(x$overrun,length(x$k-1),interval=c(0,Inf),inclusion=c(TRUE,FALSE)) + checkVector(x$overrun,interval=c(0,Inf),inclusion=c(TRUE,FALSE)) + if(length(x$overrun)!= 1 && length(x$overrun)!= x$k-1) stop(paste("overrun length should be 1 or ",as.character(x$k-1))) x } Modified: pkg/gsDesign/man/gsDesign.Rd =================================================================== --- pkg/gsDesign/man/gsDesign.Rd 2014-05-24 12:44:12 UTC (rev 368) +++ pkg/gsDesign/man/gsDesign.Rd 2014-05-26 01:52:07 UTC (rev 369) @@ -6,7 +6,7 @@ gsDesign(k=3, test.type=4, alpha=0.025, beta=0.1, astar=0, delta=0, n.fix=1, timing=1, sfu=sfHSD, sfupar=-4, sfl=sfHSD, sflpar=-2, tol=0.000001, r=18, n.I = 0, - maxn.IPlan = 0, nFixSurv=0, endpoint=NULL, delta1=1, delta0=0) + maxn.IPlan = 0, nFixSurv=0, endpoint=NULL, delta1=1, delta0=0,overrun=0) } \arguments{ \item{k}{Number of analyses planned, including interim and final.} @@ -60,6 +60,7 @@ \item{delta1}{\code{delta1} and \code{delta0} may be used to store information about the natural parameter scale compared to \code{delta} that is a standardized effect size. \code{delta1} is the alternative hypothesis parameter value on the natural parameter scale (e.g., the difference in two binomial rates).} \item{delta0}{\code{delta0} is the null hypothesis parameter value on the natural parameter scale.} + \item{overrun}{Scalar or vector of length \code{k-1} with patients enrolled that are not included in each interim analysis.} } \value{ An object of the class \code{gsDesign}. This class has the following elements and upon return from @@ -77,21 +78,27 @@ \item{timing}{A vector of length \code{k} containing the portion of the total planned information or sample size at each analysis.} \item{tol}{As input.} \item{r}{As input.} -\item{upper}{Upper bound spending function, boundary and boundary crossing probabilities under the NULL and -alternate hypotheses. See \link{Spending function overview} and manual for further details.} -\item{lower}{Lower bound spending function, boundary and boundary crossing probabilities at each analysis. -Lower spending is under alternative hypothesis (beta spending) for \code{test.type=3} or \code{4}. -For \code{test.type=2}, \code{5} or \code{6}, lower spending is under the null hypothesis. -For \code{test.type=1}, output value is \code{NULL}. See \link{Spending function overview} and manual.} \item{n.I}{Vector of length \code{k}. If values are input, same values are output. Otherwise, \code{n.I} will contain the sample size required at each analysis to achieve desired \code{timing} and \code{beta} for the output value of \code{delta}. If \code{delta=0} was input, then this is the sample size required for the specified group sequential design when a fixed design requires a sample size of \code{n.fix}. If \code{delta=0} and \code{n.fix=1} then this is the relative sample size compared to a fixed design; see details and examples.} \item{maxn.IPlan}{As input.} +\item{nFixSurv}{As input.} +\item{nSurv}{Sample size for Lachin and Foulkes method when \code{nSurvival} is used for fixed design input. If \code{nSurvival} is used to compute \code{n.fix}, then \code{nFixSurv} is inflated by the same amount as \code{n.fix} and stored in \code{nSurv}. Note that if you use \code{gsSurv} for time-to-event sample size, this is not needed and a more complete output summary is given.} \item{endpoint}{As input.} \item{delta1}{As input.} \item{delta0}{As input.} +\item{overrun}{As input.} +\item{upper}{Upper bound spending function, boundary and boundary crossing probabilities under the NULL and +alternate hypotheses. See \link{Spending function overview} and manual for further details.} +\item{lower}{Lower bound spending function, boundary and boundary crossing probabilities at each analysis. +Lower spending is under alternative hypothesis (beta spending) for \code{test.type=3} or \code{4}. +For \code{test.type=2}, \code{5} or \code{6}, lower spending is under the null hypothesis. +For \code{test.type=1}, output value is \code{NULL}. See \link{Spending function overview} and manual.} +\item{theta}{Standarized effect size under null (0) and alternate hypothesis. If \code{delta} is input, \code{theta[1]=delta}. If \code{n.fix} is input, \code{theta[1]} is computed using a standard sample size formula (pseudocode): \code{((Zalpha+Zbeta)/theta[1])^2=n.fix}.} +\item{falseprobnb}{For \code{test.type=4} or \code{6}, this contains false positive probabilities under the null hypothesis assuming that crossing a futility bound does not stop the trial.} +\item{en}{Expected sample size accounting for early stopping. For time-to-event outcomes, this would be the expected number of events (although \code{gsSurv} will give expected sample size). For information-based-design, this would give the expected information when the trial stops. If \code{overrun} is specified, the expected sample size includes the overrun at each interim.} } \details{ Many parameters normally take on default values and thus do not require explicit specification. Modified: pkg/gsDesign/man/gsProbability.Rd =================================================================== --- pkg/gsDesign/man/gsProbability.Rd 2014-05-24 12:44:12 UTC (rev 368) +++ pkg/gsDesign/man/gsProbability.Rd 2014-05-26 01:52:07 UTC (rev 369) @@ -8,7 +8,7 @@ } \usage{ -gsProbability(k=0, theta, n.I, a, b, r=18, d=NULL) +gsProbability(k=0, theta, n.I, a, b, r=18, d=NULL, overrun=0) \method{print}{gsProbability}(x,\dots) } \details{Depending on the calling sequence, an object of class \code{gsProbability} or class \code{gsDesign} is returned. @@ -34,6 +34,7 @@ When this is specified, the values of \code{k}, \code{n.I}, \code{a}, \code{b}, and \code{r} will be obtained from \code{d} and only \code{theta} needs to be specified by the user.} \item{x}{An item of class \code{gsProbability}.} + \item{overrun}{Scalar or vector of length \code{k-1} with patients enrolled that are not included in each interim analysis.} \item{\dots}{Not implemented (here for compatibility with generic print input).} } \value{ From noreply at r-forge.r-project.org Thu May 29 21:50:08 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 29 May 2014 21:50:08 +0200 (CEST) Subject: [Gsdesign-commits] r370 - pkg/gsDesign/man Message-ID: <20140529195008.35790186DEF@r-forge.r-project.org> Author: keaven Date: 2014-05-29 21:50:07 +0200 (Thu, 29 May 2014) New Revision: 370 Modified: pkg/gsDesign/man/gsbound.Rd pkg/gsDesign/man/nNormal.Rd Log: Documentation fix Modified: pkg/gsDesign/man/gsbound.Rd =================================================================== --- pkg/gsDesign/man/gsbound.Rd 2014-05-26 01:52:07 UTC (rev 369) +++ pkg/gsDesign/man/gsbound.Rd 2014-05-29 19:50:07 UTC (rev 370) @@ -2,7 +2,7 @@ \alias{gsBound} \alias{gsBound1} -\title{2.6: Boundary derivation - low level} +\title{2.7: Boundary derivation - low level} \description{\code{gsBound()} and \code{gsBound1()} are lower-level functions used to find boundaries for a group sequential design. They are not recommended (especially \code{gsBound1()}) for casual users. These functions do not adjust sample size as \code{gsDesign()} does to ensure appropriate power for a design. Modified: pkg/gsDesign/man/nNormal.Rd =================================================================== --- pkg/gsDesign/man/nNormal.Rd 2014-05-26 01:52:07 UTC (rev 369) +++ pkg/gsDesign/man/nNormal.Rd 2014-05-29 19:50:07 UTC (rev 370) @@ -6,25 +6,43 @@ Note that you may wish to investigate other R packages such as the \code{pwr} package which uses the t-distr } \usage{ -nNormal(delta1=1,sigma=1.7,sigalt=NULL,alpha=.025,beta=.1,ratio=1, sided=1, -n=NULL,delta0=0) +nNormal(delta1=1,sd=1.7,sd2=NULL,alpha=.025,beta=.1,ratio=1, sided=1, +n=NULL,delta0=0,outtype=1) } \arguments{ \item{delta1}{difference between sample means under the alternate hypothesis.} \item{delta0}{difference between sample means under the null hypothesis; normally this will be left as the default of 0.} \item{ratio}{randomization ratio of experimental group compared to control.} \item{sided}{1 for 1-sided test (default), 2 for 2-sided test.} -\item{sigma}{Standard deviation for the control arm.} -\item{sigalt}{Standard deviation of experimental arm; this will be set to be the same as the control arm with the default of \code{NULL}.} +\item{sd}{Standard deviation for the control arm.} +\item{sd2}{Standard deviation of experimental arm; this will be set to be the same as the control arm with the default of \code{NULL}.} \item{alpha}{type I error rate. Default is 0.025 since 1-sided testing is default.} \item{beta}{type II error rate. Default is 0.10 (90\% power). Not needed if \code{n} is provided.} \item{n}{Sample size; may be input to compute power rather than sample size. If \code{NULL} (default) then sample size is computed.} +\code{delta0}{default value of 0 is set to test for superiority; negative values used for non-inferiority (assuming \code{delta1>0}).} +\item{outtype}{controls output; see value section below.} } \details{ \code{nNormal()} computes sample size for comparing two normal means when the variance for observations in } \value{ -If \code{n} is \code{NULL} (default), total sample size (2 arms combined) is computed. Otherwise, power is c +If \code{n} is \code{NULL} (default), total sample size (2 arms combined) is computed. Otherwise, power is computed. +If \code{outtype=1} (default), the computed value (sample size or power) is returned in a scalar or vector. +If \code{outtype=2}, a data frame with sample sizes for each arm (\code{n1}, \code{n2})is returned; if \code{n} is not input as \code{NULL}, a third variable, \code{Power}, is added to the output data frame. +If \code{outtype=3}, a data frame with is returned with the following columns: + \item{n}{A vector with total samples size required for each event rate comparison specified} + \item{n1}{A vector of sample sizes for group 1 for each event rate comparison specified} + \item{n2}{A vector of sample sizes for group 2 for each event rate comparison specified} + \item{alpha}{As input} + \item{sided}{As input} + \item{beta}{As input; if \code{n} is input, this is computed} + \item{Power}{If \code{n=NULL} on input, this is \code{1-beta}; otherwise, the power is computed for each sample size input} + \item{sd}{As input} + \item{sd2}{As input} + \item{delta1}{As input} + \item{delta0}{As input} + \item{se}{standard error for estimate of difference in treatment group means} + } \seealso{\link{gsDesign package overview}} \author{Keaven Anderson \email{keaven_anderson at merck.com}} @@ -39,12 +57,12 @@ \examples{ # EXAMPLES # equal variances -nNormal(delta1=.5,sigma=1.1,alpha=.025,beta=.2) +nNormal(delta1=.5,sd=1.1,alpha=.025,beta=.2) # unequal variances -nNormal(delta1=.5,sigma=1.1,sigalt=2,alpha=.025,beta=.2) +nNormal(delta1=.5,sd=1.1,sd2=2,alpha=.025,beta=.2) # unequal sample sizes -nNormal(delta1=.5,sigma=1.1,alpha=.025,beta=.2, ratio=2) +nNormal(delta1=.5,sd=1.1,alpha=.025,beta=.2, ratio=2) # non-inferiority assuming a better effect than null -nNormal(delta1=.5,delta0=-.1,sigma=1.2) +nNormal(delta1=.5,delta0=-.1,sd=1.2) } \keyword{design}