[Gsdesign-commits] r234 - in pkg: gsDesign/R gsDesign/man gsDesignGUIReview/osx

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Dec 21 18:15:28 CET 2009


Author: keaven
Date: 2009-12-21 18:15:28 +0100 (Mon, 21 Dec 2009)
New Revision: 234

Added:
   pkg/gsDesignGUIReview/osx/gsDesign_2.2-0.tar.gz
   pkg/gsDesignGUIReview/osx/gsDesign_2.2-0.zip
Modified:
   pkg/gsDesign/R/gsMethods.R
   pkg/gsDesign/R/gsSurvival.R
   pkg/gsDesign/man/gsDesign.Rd
   pkg/gsDesign/man/nSurvival.Rd
Log:
Updated gsDesign to incorporate sample size for time-to-event designs

Modified: pkg/gsDesign/R/gsMethods.R
===================================================================
--- pkg/gsDesign/R/gsMethods.R	2009-12-21 04:16:33 UTC (rev 233)
+++ pkg/gsDesign/R/gsMethods.R	2009-12-21 17:15:28 UTC (rev 234)
@@ -91,6 +91,11 @@
 
 "print.gsDesign" <- function(x, ...)
 {    
+	if (x$nFixSurv > 0)
+	{	cat("Group sequential design sample size for time-to-event outcome\n", 
+        "with sample size ", x$nSurv, ". The analysis plan below shows events\n",
+        "at each analysis.\n", sep="")
+	}
     
     if (x$test.type == 1) 
     {
@@ -236,29 +241,46 @@
         print(y)
     }
 }
-print.nSurvival <- function(x,y=0,med=F,timeunit="months", ...){
+print.nSurvival <- function(x, med=FALSE, timeunit=""){
 	if (class(x) != "nSurvival") stop("print.nSurvival: primary argument must have class nSurvival")
-   cat("Two-arm trial with time-to-event outcome with fixed accrual and study duration.\n")
-	cat("Sample size computed using Lachin and Foulkes (1986) method.\n")
-	cat("Accrual duration ", x$Tr, " ", timeunit, " and minimum follow-up ", x$Ts-x$Tr, " ", 
-       timeunit, ".\n", sep="")
-   cat("Fixed design sample size n=", 2*ceiling(x$n/2), " subjects ", sep="")
-   cat("followed until nEvents=", ceiling(x$nEvents), " events occur to detect\n")
-   if (!med) cat("a reduction from a ", round(x$lambda1,3), " failure rate in the control group to a\n",
-                    "failure rate of ", round(x$lambda2,3), " in the experimental group\n", sep="")
-   else cat("an increase from", round(log(2)/x$lambda1,1), "median time-to-event in the control group\nto",
-            round(log(2)/x$lambda2,1), "in the experimental group\n")
-   cat("(hazard ratio =", round(x$lambda2/x$lambda1,3), ") with ", (1-x$beta)*100, "% power and ",
-       x$sided, "-sided Type I error =", 100*x$alpha, "%.\n", sep="")
-	if (class(y) == "gsDesign")
-	{	cat("The total sample size required for the group sequential design is ", 
-        ceiling(x$n * y$n.I[y$k] / y$n.fix /2) *2,".\n", sep="")
-   	cat("The group sequential design analysis plan is given in terms of the number\n",
-       "of events at each analysis below.\n", sep="")
+   cat("Fixed design, two-arm trial with time-to-event\n")
+	cat("outcome (Lachin and Foulkes, 1986).\n")
+	cat("Study duration (fixed):          Ts=", x$Ts, " ", timeunit, "\n", sep="")
+	cat("Accrual duration (fixed):        Tr=", x$Tr, " ", timeunit, "\n",sep="")
+	if (x$entry=="unif") cat('Uniform accrual:              entry="unif"\n')
+	else {
+		cat('Exponential accrual:          entry="expo"\n') 
+		cat("Accrual shape parameter:      gamma=", round(x$gamma,3), "\n",sep="")
 	}
+	if (med){
+		cat("Control median:      log(2)/lambda1=", round(log(2) / x$lambda1,1), " ", timeunit, "\n", sep="")
+		cat("Experimental median: log(2)/lambda2=", round(log(2) / x$lambda2,1), " ", timeunit, "\n", sep="")
+		if (x$eta > 0){
+			cat("Censoring only at study end (eta=0)\n")
+		}else{
+			cat("Censoring median:        log(2)/eta=", round(log(2) / x$eta, 1), " ", timeunit, "\n", sep="")
+		}
+	}else{
+		cat("Control failure rate:       lambda1=", round(x$lambda1,3), "\n", sep="") 
+		cat("Experimental failure rate:  lambda2=", round(x$lambda2,3), "\n", sep="")
+		cat("Censoring rate:                 eta=", round(x$eta,3),"\n", sep="")
+	}
+	cat("Power:                 100*(1-beta)=", (1-x$beta)*100, "%\n",sep="")
+   cat("Type I error (", x$sided, "-sided):   100*alpha=", 100*x$alpha, "%\n", sep="")
+	if (x$ratio==1) cat("Equal randomization:          ratio=1\n")
+	else cat("Randomization (Exp/Control):  ratio=", x$ratio, "\n", sep="")
+	if (x$type=="rr"){
+		cat("Sample size based on hazard ratio=", round(x$lambda2/x$lambda1,3), ' (type="rr")\n',sep="") 
+  	}else{
+		cat('Sample size based on risk difference=', round(x$lambda1 - x$lambda2,3), ' (type="rd")\n', sep="")
+		if (x$approx) cat("Sample size based on H1 variance only:  approx=TRUE\n")
+		else cat("Sample size based on H0 and H1 variance: approx=FALSE\n")
+	}
+   cat("Sample size (computed):           n=", 2*ceiling(x$n/2), "\n", sep="")
+   cat("Events required (computed): nEvents=", ceiling(x$nEvents), "\n",sep="")
+	invisible(x)
 }
 
-
 ###
 # Hidden Functions
 ###

Modified: pkg/gsDesign/R/gsSurvival.R
===================================================================
--- pkg/gsDesign/R/gsSurvival.R	2009-12-21 04:16:33 UTC (rev 233)
+++ pkg/gsDesign/R/gsSurvival.R	2009-12-21 17:15:28 UTC (rev 234)
@@ -131,7 +131,7 @@
             lambda1 = lambda1, lambda2 = lambda2,
             eta = eta, ratio=ratio, 
             gamma = gamma, alpha = alpha, beta = beta, sided = sided,
-            Ts = Ts, Tr = Tr)
+            Ts = Ts, Tr = Tr, approx=approx)
     class(outd) <- "nSurvival"
     outd
 }

Modified: pkg/gsDesign/man/gsDesign.Rd
===================================================================
--- pkg/gsDesign/man/gsDesign.Rd	2009-12-21 04:16:33 UTC (rev 233)
+++ pkg/gsDesign/man/gsDesign.Rd	2009-12-21 17:15:28 UTC (rev 234)
@@ -7,7 +7,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) 
+         maxn.IPlan = 0, nFixSurv=0) 
 
 print.gsDesign(x,...)}
 
@@ -26,7 +26,8 @@
 	This will be changed to \eqn{1 - }\code{alpha} when default value of 0 is used. 
 	Since this is the expected usage, normally \code{astar} is not specified by the user.}
 	\item{delta}{Standardized effect size. See details and examples.}
-	\item{n.fix}{Sample size for fixed design with no interim; used to find maximum group sequential sample size.
+	\item{n.fix}{Sample size for fixed design with no interim; used to find maximum group sequential sample size. For a time-to-event outcome, input number of events required for a fixed design rather than sample size
+and enter fixed design sample size (optional) in \code{nFixSurv}.
 	See details and examples.}
 	\item{timing}{Sets relative timing of interim analyses. Default of 1 produces equally spaced analyses. 
 	Otherwise, this is a vector of length \code{k} or \code{k-1}.
@@ -55,6 +56,8 @@
 	Normally \code{r} will not be changed by the user.}
 	\item{n.I}{Used for re-setting bounds when timing of analyses changes from initial design; see examples.}
 	\item{maxn.IPlan}{Used for re-setting bounds when timing of analyses changes from initial design; see examples.}
+	\item{nFixSurv}{If a time-to-event variable is used, \code{nFixSurv} computed as the sample size from \code{nSurvival} may be entered to have \code{gsDesign}
+	compute the total sample size required as well as the number of events at each analysis that will be returned in \code{n.fix}; this is rounded up to an even number.}|
 	\item{x}{In \code{print.gsDesign} this is an object of class gsDesign.}
 	\item{...}{This should allow optional arguments that are standard when calling \code{print}.}
 }

Modified: pkg/gsDesign/man/nSurvival.Rd
===================================================================
--- pkg/gsDesign/man/nSurvival.Rd	2009-12-21 04:16:33 UTC (rev 233)
+++ pkg/gsDesign/man/nSurvival.Rd	2009-12-21 17:15:28 UTC (rev 234)
@@ -1,5 +1,6 @@
 \name{nSurvival}
 \alias{nSurvival}
+\alias{print.nSurvival}
 \alias{Survival sample size}
 \title{3.4: Time-to-event sample size calculation (Lachin-Foulkes)}
 \description{\code{nSurvival()} is used to calculate the sample size for a clinical trial with a time-to-event endpoint. The Lachin and Foulkes (1986) method is used.
@@ -9,6 +10,7 @@
 nSurvival(lambda1=1/12, lambda2=1/24, Ts=24, Tr=12, eta = 0, ratio = 1,
       alpha = 0.025, beta = 0.10, sided = 1, approx = FALSE,
       type = c("rr", "rd"), entry = c("unif", "expo"), gamma = NA)
+print.nSurvival(x, med=FALSE, timeunit="")
 }
 \arguments{
   \item{lambda1, lambda2}{event hazard rate for placebo and treatment
@@ -30,19 +32,23 @@
   \item{gamma}{rate parameter for exponential entry. \code{NA} if entry type is
     \code{"unif"} (uniform). A non-zero value is supplied if entry type is
     \code{"expo"} (exponential).} 
+  \item{x}{An object of class "nSurvival" returned by \code{nSurvival()}}
+  \item{med}{If true, median time-to-event is printed rather than failure rate.}
+  \item{timeunit}{Character string indicating time units for event rates
+   (optional: used for output; "months" or "years" would be the 'usual' choices).}
 }
 
 \details{
-  \code{nSurvival} produces the number of subjects and events for a set of
+  \code{nSurvival} produces an object of class "nSurvival" with 
+  the number of subjects and events for a set of
   pre-specified trial parameters, such as accrual duration and follow-up
-  period. The calculation is based on Lachin and Foulkes method and can
+  period. The calculation is based on Lachin and Foulkes (1986) method and can
   be used for risk ratio or risk difference. The function also consider
-  non-uniform entry as well as uniform entry. 
+  non-uniform (exponential) entry as well as uniform entry. 
 
   If the logical approx is \code{TRUE}, the variance under alternative
   hypothesis is used to replace the variance under null hypothesis.
-The 
-  For non-uniform entry. a non-zero value of gamma for exponential entry
+  For non-uniform entry, a non-zero value of gamma for exponential entry
   must be supplied. For positive gamma, the entry distribution is
   convex, whereas for negative gamma, the entry distribution is concave.
 }
@@ -51,8 +57,8 @@
   \code{nSurvival} produces a list with the following component returned:
   \item{type}{As input.}
   \item{entry}{As input.}
-  \item{n}{Sample size required.}
-  \item{nEvents}{Number of events required.}
+  \item{n}{Sample size required (computed).}
+  \item{nEvents}{Number of events required (computed).}
   \item{lambda1}{As input.}
   \item{lambda2}{As input.}
   \item{eta}{As input.}
@@ -64,10 +70,9 @@
   \item{Ts}{As input.}
   \item{Tr}{As input.}
 }
-
+\seealso{\link{gsDesign package overview}, \link{Plots for group sequential designs}, \link{gsDesign}} 
 \author{Shanhong Guan \email{shanhong\_guan at merck.com}}
 \references{
-  
   Lachin JM and Foulkes MA (1986),
   Evaluation of Sample Size and Power for Analyses of Survival
   with Allowance for Nonuniform Patient Entry, Losses to Follow-Up,
@@ -81,7 +86,7 @@
 # 6 month uniform enrollment
 # Treatment/placebo hazards = 0.1/0.2 per 1 person-year
 # drop out hazard 0.1 per 1 person-year
-# alpha = 0.05 (two-sided)
+# alpha = 0.025 (1-sided)
 # power = 0.9 (default beta=.1)
 
 ss <- nSurvival(lambda1=.2 , lambda2=.1, eta = .1, Ts = 2, Tr = .5,
@@ -90,16 +95,17 @@
 
 #  symmetric, 2-sided design with O'Brien-Fleming-like boundaries
 #  sample size is computed based on a fixed design requiring n=100
-	x<-gsDesign(k = 5, test.type = 2)
-	x
+	x<-gsDesign(k = 5, test.type = 2, n.fix=ss$nEvents, nFixSurv=ss$n)
 # boundary plot
 	plot(x)
-# power plot
-	plot(x, plottype = 2)
+# effect size plot
+	plot(x, plottype = "hr")
 # total sample size
-   ceiling(x$n.I[x$k] / 2 * ss$n) * 2
+   x$nSurv
 # number of events at analyses
-   ceiling(ss$nEvents * x$n.I)
+   x$n.I
+# print the design
+x
 }
 
 \keyword{design}

Added: pkg/gsDesignGUIReview/osx/gsDesign_2.2-0.tar.gz
===================================================================
(Binary files differ)


Property changes on: pkg/gsDesignGUIReview/osx/gsDesign_2.2-0.tar.gz
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: pkg/gsDesignGUIReview/osx/gsDesign_2.2-0.zip
===================================================================
(Binary files differ)


Property changes on: pkg/gsDesignGUIReview/osx/gsDesign_2.2-0.zip
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream



More information about the Gsdesign-commits mailing list