RCTplatform <- substring(version$platform,6,7)
RCTdirnameV <- paste(ifelse(RCTplatform=="ap","~","z:"),
"/Documents/RCTdesign.org/Software/Validation/",sep="")
#####
##
## Internal verification of handling of defaults in seqDesign()
## This validation suite is primarily of interest to the RCTdesign developers
## This code verifies that
## -- erroneous input properly results in errors for selected cases
## -- valid alternative specification of designs results in the same
## seqDesign objects
## -- the validation also compares the seqDesign() results for valid
## "seqDesign" objects with results obtained and stored from
## prior executions of this code. In that way, this routine is also
## used to validate consistency across versions of RCTdesign.
##
#####
# source(paste(RCTdirnameV,"RCTvalidateSeqDesignArgs.R",sep=""))
#####
##
## Validation of agreement with closed form solution for expected mean when J=2
## seqCheckExpMeanJ2() implements closed form solution
## (see unpublished University of Washington dissertation by Scott Emerson)
## In addition to comparing the numerical integration to the closed form
## solution implemented in seqCheckExpMeanJ2 for arbitrarily selected
## group sequential designs, the validation design compares the
## "seqDesign" and "seqOC" objects with results obtained and stored from
## prior executions of this code. In that way, this routine is also
## used to validate consistency across versions of RCTdesign.
##
#####
source(paste(RCTdirnameV,"RCTvalidateExpMeanJ2.R",sep=""))
#####
##
## External validation of agreement with published critical values
## The unified family of designs implemented in RCTdesign includes as special cases
## -- Wang & Tsiatis, Biometrics, 1987 (which in turn includes Pocock and O'Brien-Fleming)
## -- Emerson & Fleming, Biometrics, 1989
## -- Pampallona & Tsiatis, Journal of Statistical Planning and Inference, 1994
## This code verifies that the critical values returned by seqDesign() agree with
## the published values within the precision of the published papers.
## A couple notes regarding this external validation:
## -- Much of the code in RCTdesign got its start in the code used for Emerson & Fleming
## Hence, those validations are better viewed as consistency across versions, than
## independent programming.
## -- There were two cases in which the seqDesign() results disagreed with Pampallona & Tsiatis
## Given the agreement with all other values and the plausibility of typographical errors
## giving rise to the actual disagreements, the disagreement has been suppressed in the output
## in order that these routines might be used to ensure consistency across RCTdesign versions
## (the "RCTvalidateCriticalValues.R" file provides specific details regarding the discrepancy)
## -- Much of the code that was used by Pampallona & Tsiatis was at least partially incorporated
## into early versions of East
##
#####
source(paste(RCTdirnameV,"RCTvalidateCriticalValues.R",sep=""))
#####
##
## The R package gsDesign was developed by Keaven Anderson and others at Merck.
## The most commonly used RCTdesign group sequential design families are
## also included in gsDesign. The script file ``RCTvalidateGSDesign.R''
## compares the stopping rule critical values returned by seqDesign() and gsDesign()
## for selected designs within the Wang and Tsiatis (1987) family, a family of single
## boundary designs, the Hwang, Shih, and DeCani (1990) error spending family, and the
## Kim and DeMets (1987) power error spending family. The critical values are compared
## on the Z statistic scale and the error spending scale.
##
#####
<>=
source(paste(RCTdirnameV,"RCTvalidateGSDesign.R",sep=""))
@
#####
##
## Validation of statistical analyses used in the simulation routines.
## The functions called by rSeq() use vectorized code that implements
## t tests and chi square tests. The following tests check that code
## against the R functions t.test() and chisq.test().
##
#####
strt <- proc.time()
runRCTvalidateTests <- (1:41)[c(1:2,9:11,18:19,26:28,35:37,39:41)]
source(paste(RCTdirnameV,"RCTvalidateRSeq.R",sep=""))
proc.time() - strt
#####
##
## Validation of numerically integrated stopping probabilities using simulation
## This function uses seqCheckOC(), which in turn calls seqOC(...,Nsimul=100000)
## It then compares simulated stopping probabilities to those calculated using
## numerical integration of the truncated normal densities. Chi square goodness
## of fit statistics are calculated for each of 50 (for one-sided tests) or 100
## (for two-sided tests) values of theta. The function displays plots of the
## p values, as well as comparing differences in power and ASN between the
## simulated and numerically integrated results. The routine also compares the
## design and numerically integrated operating characteristics against
## previously stored results, thereby also serving as a check for consistency
## across versions of RCTdesign.
## There are 38 different designs included in the file, and for each design
## comparisons are made on the seqDesign object to any stored value,
## the seqOC object to any stored value, and the agreement between simulated
## and numerically integrated results. Ultimately there are thus 114 tests
## reported if all 38 cases are run. Because these validations are time
## consuming, you can specify that only a few cases are run.
##
#####
strt <- proc.time()
runRCTvalidateTests <- (1:38)[c(17,34,38)]
source(paste(RCTdirnameV,"RCTvalidateOCsimulate.R",sep=""))
proc.time() - strt
#####
##
## Validation of inference (point estimates, confidence intervals)
## This script file defines functions
## gstMLEle(): returns indicators of "less-than" for each ordering
## seqCheckQuantilesBAM(): uses simulations to verify quantiles and BAM
## seqCheckConsistentInference(): verifies the relationship between
## quantiles and CI and expected MLE and BAM
## seqSimCoverageBias(): uses simulations to verify coverage probability
## of CIs and to compute bias and RMSE of estimators
##
## Using these functions, the script file verifies the inferential quantities
## for four selected designs (performing four tests for each design). Because
## these validations are time consuming, you can specify that only a few cases
## are run.
##
#####
strt <- proc.time()
runRCTvalidateTests <- (1:4)[c(4)]
source(paste(RCTdirnameV,"RCTvalidateInference.R",sep=""))
proc.time() - strt
#####
##
## Validation of agreement of "seqDesign" objects based on error spending
## functions with previously stored results
## Hence, this routine is primarily of use to validate consistency
## across versions of RCTdesign.
##
#####
source(paste(RCTdirnameV,"RCTvalidateErrSpendExmpls.R",sep=""))
#source(paste(RCTdirnameV,"RCTvalidateDraftMS.R",sep=""))