From noreply at r-forge.r-project.org Wed Jan 20 13:58:25 2016 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 20 Jan 2016 13:58:25 +0100 (CET) Subject: [Gsdesign-commits] r379 - in pkg/gsDesign: . R man Message-ID: <20160120125825.4870818755C@r-forge.r-project.org> Author: keaven Date: 2016-01-20 13:58:24 +0100 (Wed, 20 Jan 2016) New Revision: 379 Modified: pkg/gsDesign/DESCRIPTION pkg/gsDesign/NAMESPACE pkg/gsDesign/NEWS pkg/gsDesign/R/gsSurv.R pkg/gsDesign/R/gsqplot.R pkg/gsDesign/man/nSurv.Rd pkg/gsDesign/man/sflogistic.Rd Log: Minor updates related to xtable update Modified: pkg/gsDesign/DESCRIPTION =================================================================== --- pkg/gsDesign/DESCRIPTION 2015-08-29 15:45:14 UTC (rev 378) +++ pkg/gsDesign/DESCRIPTION 2016-01-20 12:58:24 UTC (rev 379) @@ -1,12 +1,13 @@ Package: gsDesign -Version: 2.9-4 +Version: 3.0-0 Title: Group Sequential Design Author: Keaven Anderson Maintainer: Keaven Anderson -Depends: R (>= 3.0.0), ggplot2, xtable, stringr, RUnit, plyr +Depends: R (>= 3.0.0), xtable, ggplot2 +Imports: plyr Suggests: knitr, scales VignetteBuilder: knitr -Description: Derives group sequential designs and describes their properties +Description: Derives group sequential designs and describes their properties. License: GPL (>= 2) Copyright: Copyright 2010, Merck Research Laboratories Packaged: 2011-12-30 13:26:23 UTC; Anderkea Modified: pkg/gsDesign/NAMESPACE =================================================================== --- pkg/gsDesign/NAMESPACE 2015-08-29 15:45:14 UTC (rev 378) +++ pkg/gsDesign/NAMESPACE 2016-01-20 12:58:24 UTC (rev 379) @@ -1,5 +1,5 @@ useDynLib(gsDesign) -import(RUnit,ggplot2,plyr,stringr,xtable ) +import(plyr, xtable, ggplot2) export(gsBoundCP, gsCP, gsPP, gsPI, gsPOS, gsCPOS, gsDensity, gsPosterior) export(gsCPz, gsHR, gsDelta, gsBValue, gsRR, hrn2z, hrz2n, zn2hr) export(gsBound, gsBound1, gsDesign, gsProbability) @@ -15,3 +15,20 @@ export(sfCauchy, sfNormal, sfTDist, spendingFunction) export(checkScalar, checkVector, checkRange, checkLengths, isInteger) export(eEvents, print.eEvents, nSurv, gsSurv, print.nSurv, print.gsSurv, tEventsIA, nEventsIA) +S3method(summary,gsDesign) +S3method(summary,spendfn) + +S3method(print,gsDesign) +S3method(print,gsProbability) +S3method(print,nSurv) +S3method(print,gsSurv) +S3method(print,nSurvival) +S3method(print,gsBoundSummary) +S3method(print,eEvents) + +S3method(plot,gsDesign) +S3method(plot,gsProbability) +S3method(plot,binomialSPRT) +S3method(plot,gsBinomialExact) +S3method(plot,ssrCP) +S3method(xtable,gsSurv) Modified: pkg/gsDesign/NEWS =================================================================== --- pkg/gsDesign/NEWS 2015-08-29 15:45:14 UTC (rev 378) +++ pkg/gsDesign/NEWS 2016-01-20 12:58:24 UTC (rev 379) @@ -10,3 +10,12 @@ 2.9-4, July, 2015 - Added initial version of nBinomial1Sample to compute sample size and power for 1-sample binomial testing. + +3.0-0, December, 2015 +- Updated xtable extension to meet R standards for extensions. +- Fixed xtable.gsSurv and print.gsSurv to work with 1-sided designs +- Update to calls to ggplot to replace show_guide (deprecated) with show.legend arguments where used in geom_text (function from ggplot2 package) calls; no user impact +- Minor typo fixed in sfLogistic help file +- Cleaned up "imports" and "depends" in an effort to be an R "good citizen" +- Registered S3 methods in NAMESPACE + Modified: pkg/gsDesign/R/gsSurv.R =================================================================== --- pkg/gsDesign/R/gsSurv.R 2015-08-29 15:45:14 UTC (rev 378) +++ pkg/gsDesign/R/gsSurv.R 2016-01-20 12:58:24 UTC (rev 379) @@ -629,11 +629,18 @@ if (length(x$ratio)>1) cat("(randomization ratios shown by strata)\n") } print.gsDesign(x) - y<-cbind(x$T,(x$eNC+x$eNE)%*%array(1,ncol(x$eNE)), - (x$eDC+x$eDE)%*%array(1,ncol(x$eNE)), - round(zn2hr(x$lower$bound,x$n.I,x$ratio,hr0=x$hr0,hr1=x$hr),3), - round(zn2hr(x$upper$bound,x$n.I,x$ratio,hr0=x$hr0,hr1=x$hr),3)) - colnames(y)<-c("T","n","Events","HR futility","HR efficacy") + if(x$test.type != 1){ + y<-cbind(x$T,(x$eNC+x$eNE)%*%array(1,ncol(x$eNE)), + (x$eDC+x$eDE)%*%array(1,ncol(x$eNE)), + round(zn2hr(x$lower$bound,x$n.I,x$ratio,hr0=x$hr0,hr1=x$hr),3), + round(zn2hr(x$upper$bound,x$n.I,x$ratio,hr0=x$hr0,hr1=x$hr),3)) + colnames(y)<-c("T","n","Events","HR futility","HR efficacy") + }else{ + y<-cbind(x$T,(x$eNC+x$eNE)%*%array(1,ncol(x$eNE)), + (x$eDC+x$eDE)%*%array(1,ncol(x$eNE)), + round(zn2hr(x$upper$bound,x$n.I,x$ratio,hr0=x$hr0,hr1=x$hr),3)) + colnames(y)<-c("T","n","Events","HR efficacy") + } rnames<-paste("IA",1:(x$k)) rnames[length(rnames)]<-"Final" rownames(y)<-rnames @@ -654,7 +661,7 @@ } } xtable.gsSurv <- function(x, caption=NULL, label=NULL, align=NULL, digits=NULL, - display=NULL, footnote=NULL, fnwid="9cm", timename="months",...){ + display=NULL, auto=FALSE, footnote=NULL, fnwid="9cm", timename="months",...){ k <- x$k stat <- c("Z-value","HR","p (1-sided)", paste("P\\{Cross\\} if HR=",x$hr0,sep=""), paste("P\\{Cross\\} if HR=",x$hr,sep="")) @@ -671,34 +678,40 @@ an[5*(0:(k-1))+2]<- paste("N:",ceiling(rowSums(x$eNC))+ceiling(rowSums(x$eNE))) an[5*(0:(k-1))+3]<- paste("Events:",ceiling(rowSums(x$eDC+x$eDE))) an[5*(0:(k-1))+4]<- paste(round(x$T,1),timename,sep=" ") - fut[5*(0:(k-1))+1]<- as.character(round(x$lower$bound,2)) + if (x$test.type != 1) fut[5*(0:(k-1))+1]<- as.character(round(x$lower$bound,2)) eff[5*(0:(k-1))+1]<- as.character(round(x$upper$bound,2)) - fut[5*(0:(k-1))+2]<- as.character(round(gsHR(z=x$lower$bound,i=1:k,x,ratio=x$ratio)*x$hr0,2)) + if (x$test.type != 1) fut[5*(0:(k-1))+2]<- as.character(round(gsHR(z=x$lower$bound,i=1:k,x,ratio=x$ratio)*x$hr0,2)) eff[5*(0:(k-1))+2]<- as.character(round(gsHR(z=x$upper$bound,i=1:k,x,ratio=x$ratio)*x$hr0,2)) asp <- as.character(round(pnorm(-x$upper$bound),4)) asp[asp=="0"]<-"$< 0.0001$" eff[5*(0:(k-1))+3] <- asp - bsp <- as.character(round(pnorm(-x$lower$bound),4)) - bsp[bsp=="0"]<-" $< 0.0001$" - fut[5*(0:(k-1))+3] <- bsp asp <- as.character(round(cumsum(x$upper$prob[,1]),4)) asp[asp=="0"]<-"$< 0.0001$" eff[5*(0:(k-1))+4] <- asp - bsp <- as.character(round(cumsum(x$lower$prob[,1]),4)) - bsp[bsp=="0"]<-"$< 0.0001$" - fut[5*(0:(k-1))+4] <- bsp asp <- as.character(round(cumsum(x$upper$prob[,2]),4)) asp[asp=="0"]<-"$< 0.0001$" eff[5*(0:(k-1))+5] <- asp - bsp <- as.character(round(cumsum(x$lower$prob[,2]),4)) - bsp[bsp=="0"]<-"$< 0.0001$" - fut[5*(0:(k-1))+5] <- bsp + if (x$test.type != 1) { + bsp <- as.character(round(pnorm(-x$lower$bound),4)) + bsp[bsp=="0"]<-" $< 0.0001$" + fut[5*(0:(k-1))+3] <- bsp + bsp <- as.character(round(cumsum(x$lower$prob[,1]),4)) + bsp[bsp=="0"]<-"$< 0.0001$" + fut[5*(0:(k-1))+4] <- bsp + bsp <- as.character(round(cumsum(x$lower$prob[,2]),4)) + bsp[bsp=="0"]<-"$< 0.0001$" + fut[5*(0:(k-1))+5] <- bsp + } neff <- length(eff) if (!is.null(footnote)) eff[neff] <- paste(eff[neff],"\\\\ \\hline \\multicolumn{4}{p{",fnwid,"}}{\\footnotesize",footnote,"}") - xxtab <- data.frame(cbind(an,stat,fut,eff)) - colnames(xxtab) <- c("Analysis","Value","Futility","Efficacy") + if (x$test.type != 1){ + xxtab <- data.frame(cbind(an,stat,fut,eff)) + colnames(xxtab) <- c("Analysis","Value","Futility","Efficacy") + }else{ + xxtab <- data.frame(cbind(an,stat,eff)) + colnames(xxtab) <- c("Analysis","Value","Efficacy") + } return(xtable(xxtab, caption=caption, label=label, align=align, digits=digits, - display=display,...)) + display=display,auto=auto,...)) } - Modified: pkg/gsDesign/R/gsqplot.R =================================================================== --- pkg/gsDesign/R/gsqplot.R 2015-08-29 15:45:14 UTC (rev 378) +++ pkg/gsDesign/R/gsqplot.R 2016-01-20 12:58:24 UTC (rev 379) @@ -198,7 +198,7 @@ if (x$test.type > 1) { p <- ggplot(data=y, aes(x=as.numeric(N), y=as.numeric(Z), group=factor(Bound), col=factor(Bound), label=Ztxt, lty=factor(Bound))) + - geom_text(show_guide=F,size=cex*5)+geom_line() + + geom_text(show.legend=F,size=cex*5)+geom_line() + scale_x_continuous(xlab)+scale_y_continuous(ylab) + scale_colour_manual(name= "Bound", values=col, labels=lbls, breaks=lbls) + scale_linetype_manual(name= "Bound", values=lty, labels=lbls, breaks=lbls) @@ -230,14 +230,14 @@ { text(x=y2$N, y=y2$Z, paste(array("r=",x$k), y2$Ztxt, sep=""), cex=cex) }else { y2$Ztxt <- paste(array("r=",x$k), y2$Ztxt, sep="") - p <- p + geom_text(data=y2, aes(group=factor(Bound), label=Ztxt), size=cex*5, show_guide=F, colour=1) + p <- p + geom_text(data=y2, aes(group=factor(Bound), label=Ztxt), size=cex*5, show.legend=F, colour=1) } }else { if(base) { text(x=y2$N, y=y2$Z, paste(array("N=",x$k), y2$Ztxt, sep=""), cex=cex) }else { y2$Ztxt <- paste(array("N=",x$k), y2$Ztxt, sep="") - p <- p + geom_text(data=y2, aes(group=factor(Bound),label=Ztxt), size=cex*5, show_guide=F, colour=1) + p <- p + geom_text(data=y2, aes(group=factor(Bound),label=Ztxt), size=cex*5, show.legend=F, colour=1) } } } if (base) @@ -338,7 +338,7 @@ { lbls <- c("Lower","Upper") p <- ggplot(data=y, aes(x=as.numeric(N), y=as.numeric(CP), group=factor(Bound), col=factor(Bound), label=Ztxt, lty=factor(Bound))) + - geom_text(show_guide=F, size=cex*5)+geom_line() + + geom_text(show.legend=F, size=cex*5)+geom_line() + scale_x_continuous(xlab)+scale_y_continuous(ylab) + scale_colour_manual(name= "Bound", values=col, labels=lbls, breaks=lbls) + scale_linetype_manual(name= "Bound", values=lty, labels=lbls, breaks=lbls) @@ -719,7 +719,7 @@ scale_linetype_manual(name="Probability", values=lty, breaks=1:2, labels=c("Upper bound","1-Lower bound")) } - p <- p + geom_text(data=yt, aes(theta, prob, colour=factor(bound), group=1, label=itxt), size=cex*5, show_guide=F) + p <- p + geom_text(data=yt, aes(theta, prob, colour=factor(bound), group=1, label=itxt), size=cex*5, show.legend=F) for(i in 1:x$k) p <- p + geom_line(data=subset(y,interim==i&bound==1), colour=col[1], lty=lty[1], lwd=lwd[1]) if (test.type > 2) for(i in 1:(x$k-1)) { Modified: pkg/gsDesign/man/nSurv.Rd =================================================================== --- pkg/gsDesign/man/nSurv.Rd 2015-08-29 15:45:14 UTC (rev 378) +++ pkg/gsDesign/man/nSurv.Rd 2016-01-20 12:58:24 UTC (rev 379) @@ -39,7 +39,7 @@ tol = .Machine$double.eps^0.25) \method{print}{gsSurv}(x,digits=2,...) \method{xtable}{gsSurv}(x, caption=NULL, label=NULL, align=NULL, digits=NULL, - display=NULL, footnote=NULL, fnwid="9cm", timename="months",...) + display=NULL, auto=FALSE, footnote=NULL, fnwid="9cm", timename="months",...) tEventsIA(x, timing=.25, tol = .Machine$double.eps^0.25) nEventsIA(tIA=5, x=NULL, target=0, simple=TRUE) } @@ -104,6 +104,7 @@ \item{label}{passed through to generic \code{xtable()}.} \item{align}{passed through to generic \code{xtable()}.} \item{display}{passed through to generic \code{xtable()}.} +\item{auto}{passed through to generic \code{xtable()}.} \item{...}{other arguments that may be passed to generic functions underlying the methods here.} } Modified: pkg/gsDesign/man/sflogistic.Rd =================================================================== --- pkg/gsDesign/man/sflogistic.Rd 2015-08-29 15:45:14 UTC (rev 378) +++ pkg/gsDesign/man/sflogistic.Rd 2016-01-20 12:58:24 UTC (rev 379) @@ -57,7 +57,7 @@ \eqn{F^{-1}()} is its inverse. For the logistic spending function this simplifies to -\deqn{f(t;\alpha,a,b)\alpha (1-(1+e^a(t/(1-t))^b)^{-1}).} +\deqn{f(t;\alpha,a,b)=\alpha (1-(1+e^a(t/(1-t))^b)^{-1}).} For the extreme value distribution with \deqn{F(x)=\exp(-\exp(-x))} this simplifies to \deqn{f(t;\alpha,a,b)=\alpha \exp(-e^a (-\ln t)^b).} From noreply at r-forge.r-project.org Wed Jan 27 02:50:08 2016 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 27 Jan 2016 02:50:08 +0100 (CET) Subject: [Gsdesign-commits] r380 - pkg/gsDesign/man Message-ID: <20160127015008.E6659185A7B@r-forge.r-project.org> Author: keaven Date: 2016-01-27 02:50:08 +0100 (Wed, 27 Jan 2016) New Revision: 380 Modified: pkg/gsDesign/man/gsBinomialExact.Rd Log: Removed url link that no longer exists in gsBinomialExact.Rd Modified: pkg/gsDesign/man/gsBinomialExact.Rd =================================================================== --- pkg/gsDesign/man/gsBinomialExact.Rd 2016-01-20 12:58:24 UTC (rev 379) +++ pkg/gsDesign/man/gsBinomialExact.Rd 2016-01-27 01:50:08 UTC (rev 380) @@ -15,7 +15,7 @@ The print function has been extended using \code{print.gsBinomialExact} to print \code{gsBinomialExact} objects; see examples. Similarly, a plot function has been extended using \code{plot.gsBinomialExact} to plot \code{gsBinomialExact} objects; see examples. -\code{binomialSPRT} computes a truncated binomial sequential probability ratio test (SPRT) which is a specific instance of an exact binomial group sequential design for a single arm trial with a binary outcome. See, for example, \url{http://theriac.org/DeskReference/viewDocument.php?id=65&SectionsList=3}. +\code{binomialSPRT} computes a truncated binomial sequential probability ratio test (SPRT) which is a specific instance of an exact binomial group sequential design for a single arm trial with a binary outcome. %\code{gsBinomialPP} computes a truncated binomial (group) sequential design based on predictive probability. From noreply at r-forge.r-project.org Sat Jan 30 16:38:13 2016 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 30 Jan 2016 16:38:13 +0100 (CET) Subject: [Gsdesign-commits] r381 - pkg/gsDesign Message-ID: <20160130153813.13B1B187B40@r-forge.r-project.org> Author: keaven Date: 2016-01-30 16:38:12 +0100 (Sat, 30 Jan 2016) New Revision: 381 Modified: pkg/gsDesign/DESCRIPTION pkg/gsDesign/NAMESPACE pkg/gsDesign/NEWS Log: Removed url link that no longer exists in gsBinomialExact.Rd, updated NEWS, added importFrom in NAMESPACE, import from plyr in DESCRIPTION Modified: pkg/gsDesign/DESCRIPTION =================================================================== --- pkg/gsDesign/DESCRIPTION 2016-01-27 01:50:08 UTC (rev 380) +++ pkg/gsDesign/DESCRIPTION 2016-01-30 15:38:12 UTC (rev 381) @@ -1,10 +1,10 @@ Package: gsDesign -Version: 3.0-0 +Version: 3.0-1 Title: Group Sequential Design Author: Keaven Anderson Maintainer: Keaven Anderson Depends: R (>= 3.0.0), xtable, ggplot2 -Imports: plyr +Imports: plyr, methods Suggests: knitr, scales VignetteBuilder: knitr Description: Derives group sequential designs and describes their properties. Modified: pkg/gsDesign/NAMESPACE =================================================================== --- pkg/gsDesign/NAMESPACE 2016-01-27 01:50:08 UTC (rev 380) +++ pkg/gsDesign/NAMESPACE 2016-01-30 15:38:12 UTC (rev 381) @@ -1,5 +1,13 @@ useDynLib(gsDesign) import(plyr, xtable, ggplot2) +importFrom("graphics", "axis", "legend", "lines", "matplot", + "matpoints", "mtext", "par", "plot", "points", "strwidth", + "text") +importFrom("methods", "is") +importFrom("stats", "dbinom", "dnorm", "nlminb", "pbeta", "pbinom", + "pcauchy", "pchisq", "pnorm", "pt", "qbinom", "qcauchy", + "qchisq", "qnorm", "qt", "rbinom", "reshape", "uniroot") +importFrom("utils", "packageVersion") 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/NEWS =================================================================== --- pkg/gsDesign/NEWS 2016-01-27 01:50:08 UTC (rev 380) +++ pkg/gsDesign/NEWS 2016-01-30 15:38:12 UTC (rev 381) @@ -1,16 +1,8 @@ -2.9-4 -- Minor edit to package description to comply with R standards +3.0-1, January, 2016 +- More changes to comply with R standards (in NAMESPACE - importFrom statements - and DESCRIPTION - adding plyr to imports) ensuring appropriate references. +- Deleted link in documentation that no longer exists (gsBinomialExact.Rd). -2.9-3, November, 2014 -- Added sfTrimmed as likely preferred spending function approach to skipping early or all interim efficacy analyses; this also can adjust bound when final analysis is performed with less than maximum planned information. Updated help(sfTrimmed) to demonstrate these capabilities. -- Added sfGapped, which is primarily intended to eliminate futility analyses later in a study; see help(sfGapped) for an example -- Added summary.spendfn to provide textual summary of spending functions; this simplified the print function for gsDesign objects -- Added sfStep which can be used to set an interim spend when the exact amount of information is unknown; an example of how this can be misused is provided in the help file. -- Fixed rounding so that gsBoundSummary, xtable.gsSurv and summary.gsDesign are consistent for gsSurv objects -2.9-4, July, 2015 -- Added initial version of nBinomial1Sample to compute sample size and power for 1-sample binomial testing. - 3.0-0, December, 2015 - Updated xtable extension to meet R standards for extensions. - Fixed xtable.gsSurv and print.gsSurv to work with 1-sided designs @@ -19,3 +11,12 @@ - Cleaned up "imports" and "depends" in an effort to be an R "good citizen" - Registered S3 methods in NAMESPACE +2.9-4 +- Minor edit to package description to comply with R standards + +2.9-3, November, 2014 +- Added sfTrimmed as likely preferred spending function approach to skipping early or all interim efficacy analyses; this also can adjust bound when final analysis is performed with less than maximum planned information. Updated help(sfTrimmed) to demonstrate these capabilities. +- Added sfGapped, which is primarily intended to eliminate futility analyses later in a study; see help(sfGapped) for an example +- Added summary.spendfn to provide textual summary of spending functions; this simplified the print function for gsDesign objects +- Added sfStep which can be used to set an interim spend when the exact amount of information is unknown; an example of how this can be misused is provided in the help file. +- Fixed rounding so that gsBoundSummary, xtable.gsSurv and summary.gsDesign are consistent for gsSurv objects