[Gsdesign-commits] r330 - in pkg/gsDesign: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Jan 14 20:04:02 CET 2012


Author: keaven
Date: 2012-01-14 20:04:02 +0100 (Sat, 14 Jan 2012)
New Revision: 330

Modified:
   pkg/gsDesign/DESCRIPTION
   pkg/gsDesign/R/gsSpending.R
   pkg/gsDesign/man/sfLinear.Rd
   pkg/gsDesign/man/sfpoints.Rd
Log:
Update of sfLinear, sfPoints and their documentation; these now allow 0 spending at an interim.

Modified: pkg/gsDesign/DESCRIPTION
===================================================================
--- pkg/gsDesign/DESCRIPTION	2011-12-30 14:30:05 UTC (rev 329)
+++ pkg/gsDesign/DESCRIPTION	2012-01-14 19:04:02 UTC (rev 330)
@@ -1,5 +1,5 @@
 Package: gsDesign
-Version: 2.6-02
+Version: 2.6-03
 Title: Group Sequential Design
 Author: Keaven Anderson 
 Maintainer: Keaven Anderson <keaven_anderson at merck.com>

Modified: pkg/gsDesign/R/gsSpending.R
===================================================================
--- pkg/gsDesign/R/gsSpending.R	2011-12-30 14:30:05 UTC (rev 329)
+++ pkg/gsDesign/R/gsSpending.R	2012-01-14 19:04:02 UTC (rev 330)
@@ -11,6 +11,7 @@
 #    sfHSD
 #    sfLDOF
 #    sfLDPocock
+#    sfLinear
 #    sfLogistic
 #    sfNormal
 #    sfPoints
@@ -433,9 +434,9 @@
     }
     k <- j/2
 
-    if (max(param) >= 1 || min(param) <= 0)
+    if (max(param) > 1 || min(param) < 0)
     {
-       stop("Timepoints and cumulative proportion of spending must be > 0 and < 1 in sfLinear")
+       stop("Timepoints and cumulative proportion of spending must be >= 0 and <= 1 in sfLinear")
     }
     if (k > 1)
     {   inctime <- x$param[1:k] - c(0, x$param[1:(k-1)])
@@ -501,14 +502,14 @@
     
     incspend <- x$param - c(0, x$param[1:k-1])
     
-    if (min(incspend) <=  0.)
+    if (min(incspend) <  0.)
     { 
-        stop("Cumulative user-specified spending levels must increase with each analysis")
+        stop("Cumulative user-specified spending levels must be non-decreasing with each analysis")
     }
     
     if (max(x$param) > 1.)
     { 
-        stop("Cumulative user-specified spending must be > 0 and <= 1")
+        stop("Cumulative user-specified spending must be >= 0 and <= 1")
     }
     
     x$spend <- alpha * x$param
@@ -632,7 +633,7 @@
        stop("param$trange must be a vector of length 2 with 0 <= param$trange[1] < param$trange[2]<=1. See help(sfTruncated)")
    if (class(param$sf) != "function") stop("param$sf must be a spending function") 
    if (!is.numeric(param$param)) stop("param$param must be numeric")
-   spend<-array(0,length(t))
+   spend<-as.vector(array(0,length(t)))
    spend[t>=param$trange[2]]<-alpha
    indx <- param$trange[1]<t & t<param$trange[2]
    s <- param$sf(alpha=alpha,t=(t[indx]-param$trange[1])/(param$trange[2]-param$trange[1]),param$param)

Modified: pkg/gsDesign/man/sfLinear.Rd
===================================================================
--- pkg/gsDesign/man/sfLinear.Rd	2011-12-30 14:30:05 UTC (rev 329)
+++ pkg/gsDesign/man/sfLinear.Rd	2012-01-14 19:04:02 UTC (rev 330)
@@ -19,9 +19,11 @@
 	or \code{alpha=0.1} for Type II error specification. However, this could be set to 1 if for descriptive purposes you wish to see the proportion of spending as a function of the proportion of sample size or information.}
 	\item{t}{A vector of points with increasing values from 0 to 1, inclusive. Values of the proportion of 
 	sample size or information for which the spending function will be computed.}
-	\item{param}{A vector with a positive, even length. All values must be strictly between 0 and 1.
-Letting \code{m <- length(param/2)}, the first \code{m} points in param specify increasing values strictly between 0 and 1 where the proportion of total spending is specified. 
-The last \code{m} points in param specify increasing values strictly between 0 and 1 with the cumulative proportion of spending at the timepoints in the first part of the vector.}
+	\item{param}{A vector with a positive, even length. Values must range from 0 to 1, inclusive.
+Letting \code{m <- length(param/2)}, the first \code{m} points in param specify increasing values strictly between 0 and 1,
+where the proportion of total spending is specified. 
+The last \code{m} points in param specify non-decreasing values from 0 to 1, inclusive, 
+with the cumulative proportion of spending at the timepoints in the first part of the vector.}
 }
 \value{An object of type \code{spendfn}. 
 The cumulative spending returned in \code{sfLinear$spend} is 0 for \code{t=0} and \code{alpha} for \code{t>=1}. 
@@ -46,5 +48,12 @@
 plot(x, plottype="sf")
 x
 
+# now do an example where there is no lower-spending at interim 1
+# and no upper spending at interim 2
+sflpar<-c(1/3,2/3,0,.25)
+sfupar<-c(1/3,2/3,.1,.1)
+x <- gsDesign(sfu=sfLinear, sfl=sfLinear, sfupar=sfupar, sflpar=sflpar)
+plot(x, plottype="sf")
+x
 }
 \keyword{design}

Modified: pkg/gsDesign/man/sfpoints.Rd
===================================================================
--- pkg/gsDesign/man/sfpoints.Rd	2011-12-30 14:30:05 UTC (rev 329)
+++ pkg/gsDesign/man/sfpoints.Rd	2012-01-14 19:04:02 UTC (rev 330)
@@ -19,10 +19,10 @@
 	\item{alpha}{Real value \eqn{> 0} and no more than 1. Normally, \code{alpha=0.025} for one-sided Type I error specification
 	or \code{alpha=0.1} for Type II error specification. However, this could be set to 1 if for descriptive purposes
 	you wish to see the proportion of spending as a function of the proportion of sample size/information.}
-	\item{t}{A vector of points with increasing values from 0 to 1, inclusive. The last point should be 1.
+	\item{t}{A vector of points with increasing values from >0 and <=1. 
 	Values of the proportion of sample size/information for which the spending function will be computed.}
 	\item{param}{A vector of the same length as \code{t} specifying the cumulative proportion of spending
-	to corresponding to each point in \code{t}.}
+	to corresponding to each point in \code{t}; must be >=0 and <=1.}
 }
 \value{An object of type \code{spendfn}. See spending functions for further details.}
 
@@ -65,5 +65,12 @@
 lines(tx, sfTDist(1, tx, c(c(1, 3, 5)/6, .01, .1, .5))$spend)
 text(x=.6, y=.9, labels="Pointwise Spending Approximated by")
 text(x=.6, y=.83, "t-Distribution Spending with 3-point interpolation")
+
+# example without lower spending at initial interim or 
+# upper spending at last interim
+x <- gsDesign(k=3, sfu=sfPoints, sfupar=c(.25, .25),
+              sfl=sfPoints, sflpar=c(0,.25))
+x
+
 }
 \keyword{design}



More information about the Gsdesign-commits mailing list