R Under development (unstable) (2021-03-23 r80109) -- "Unsuffered Consequences" Copyright (C) 2021 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > pkgname <- "OneArmPhaseTwoStudy" > source(file.path(R.home("share"), "R", "examples-header.R")) > options(warn = 1) > library('OneArmPhaseTwoStudy') Loading required package: Rcpp > > base::assign(".oldSearch", base::search(), pos = 'CheckExEnv') > base::assign(".old_wd", base::getwd(), pos = 'CheckExEnv') > cleanEx() > nameEx("getCE") > ### * getCE > > flush(stderr()); flush(stdout()) > > ### Name: getCE > ### Title: Calculates the conditional error. > ### Aliases: getCE > > ### ** Examples > > design <- getSolutions()$Solutions[1,] result.cpp:89:6: runtime error: load of value 190, which is not a valid value for type 'bool' #0 0x7f5307fe4c32 in Result::get_R_Representation() /data/gannet/ripley/R/packages/tests-gcc-SAN/OneArmPhaseTwoStudy/src/result.cpp:89 #1 0x7f53080c83f8 in SimonDesign::getResultsForR() /data/gannet/ripley/R/packages/tests-gcc-SAN/OneArmPhaseTwoStudy/src/simon.cpp:449 #2 0x7f53080ec259 in Rcpp::CppMethod0::operator()(SimonDesign*, SEXPREC**) /data/gannet/ripley/R/test-4.1/Rcpp/include/Rcpp/module/Module_generated_CppMethod.h:34 #3 0x7f530815d684 in Rcpp::class_::invoke_notvoid(SEXPREC*, SEXPREC*, SEXPREC**, int) /data/gannet/ripley/R/test-4.1/Rcpp/include/Rcpp/module/class.h:234 #4 0x7f530891e6af in CppMethod__invoke_notvoid(SEXPREC*) /tmp/RtmpZR7CAT/R.INSTALL38ca9338efedae/Rcpp/src/module.cpp:220 #5 0x56c86e in do_External /data/gannet/ripley/R/svn/R-devel/src/main/dotcode.c:576 #6 0x6712fe in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:830 #7 0x678cf6 in do_begin /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2517 #8 0x670d08 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:802 #9 0x675304 in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1897 #10 0x6777a7 in Rf_applyClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1823 #11 0x646a5e in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:7083 #12 0x670017 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:727 #13 0x675304 in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1897 #14 0x6777a7 in Rf_applyClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1823 #15 0x646a5e in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:7083 #16 0x670017 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:727 #17 0x675304 in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1897 #18 0x6777a7 in Rf_applyClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1823 #19 0x6708df in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:850 #20 0x840bc7 in R_DispatchOrEvalSP /data/gannet/ripley/R/svn/R-devel/src/main/subset.c:619 #21 0x850593 in do_subset3 /data/gannet/ripley/R/svn/R-devel/src/main/subset.c:1221 #22 0x670d08 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:802 #23 0x840bc7 in R_DispatchOrEvalSP /data/gannet/ripley/R/svn/R-devel/src/main/subset.c:619 #24 0x84c733 in do_subset /data/gannet/ripley/R/svn/R-devel/src/main/subset.c:653 #25 0x670d08 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:802 #26 0x67c9a9 in do_set /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2969 #27 0x670d08 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:802 #28 0x6f038d in Rf_ReplIteration /data/gannet/ripley/R/svn/R-devel/src/main/main.c:264 #29 0x6f09d8 in R_ReplConsole /data/gannet/ripley/R/svn/R-devel/src/main/main.c:314 #30 0x6f0b24 in run_Rmainloop /data/gannet/ripley/R/svn/R-devel/src/main/main.c:1113 #31 0x6f0b72 in Rf_mainloop /data/gannet/ripley/R/svn/R-devel/src/main/main.c:1120 #32 0x41b3d8 in main /data/gannet/ripley/R/svn/R-devel/src/main/Rmain.c:29 #33 0x7f5318e5d081 in __libc_start_main (/lib64/libc.so.6+0x27081) #34 0x41db5d in _start (/data/gannet/ripley/R/gcc-SAN/bin/exec/R+0x41db5d) > conditional_error <- getCE(design, 4) > > > > cleanEx() > nameEx("getCP") > ### * getCP > > flush(stderr()); flush(stdout()) > > ### Name: getCP > ### Title: Calculates the conditional power. > ### Aliases: getCP > > ### ** Examples > > #Calculate a Simon's two-stage design > design <- getSolutions()$Solutions[3,] #minimax-design for the default values. > > #Assume 3 responses were observed in the interim analysis. > #Therefore the conditional power is only about 0.55. > #In order to raise the conditional power to 0.8 "n2" has to be increased. > > #get the current "n2" > n2 <- design$n - design$n1 > > #set k to 3 (only 3 responses observed so far) > k = 3 > > #get the current conditional power > cp <- getCP(n2, design$p1, design, k, mode = 1, alpha = 0.05) > cp [1] 0.5500959 > > > > > cleanEx() > nameEx("getCP_simon") > ### * getCP_simon > > flush(stderr()); flush(stdout()) > > ### Name: getCP_simon > ### Title: Returns the conditional power. > ### Aliases: getCP_simon > > ### ** Examples > > #Calculate a Simon's two-stage design > design <- getSolutions()$Solutions[3,] #minimax-design for the default values. > #Assume 3 out of 20 patients had a response. > getCP_simon(3,20,design$r1, design$n1, design$r, design$n, design$p1) [1] 0.8016185 > > > > cleanEx() > nameEx("getD_distributeToOne") > ### * getD_distributeToOne > > flush(stderr()); flush(stdout()) > > ### Name: getD_distributeToOne > ### Title: Get the conditional errors. > ### Aliases: getD_distributeToOne > > ### ** Examples > > #Calculate a Simon's two-stage design > design <- getSolutions()$Solutions[3,] #minimax-design for the default values. > > ce_toOne <- getD_distributeToOne(design, 0.05) > ce_toOne k ce 1 0 0.00000000 2 1 0.00000000 3 2 0.00000000 4 3 0.03157371 5 4 0.06840617 6 5 0.21075066 7 6 0.48527217 8 7 0.81469798 9 8 1.00000000 10 9 1.00000000 11 10 1.00000000 12 11 1.00000000 13 12 1.00000000 14 13 1.00000000 15 14 1.00000000 16 15 1.00000000 17 16 1.00000000 18 17 1.00000000 19 18 1.00000000 20 19 1.00000000 21 20 1.00000000 22 21 1.00000000 23 22 1.00000000 24 23 1.00000000 25 24 1.00000000 26 25 1.00000000 > > > > cleanEx() > nameEx("getD_equally") > ### * getD_equally > > flush(stderr()); flush(stdout()) > > ### Name: getD_equally > ### Title: Get the conditional errors equally. > ### Aliases: getD_equally > > ### ** Examples > > #Calculate a Simon's two-stage design > design <- getSolutions()$Solutions[3,] #minimax-design for the default values. > > ce_equally <- getD_equally(design, 0.05) > ce_equally k ce 1 0 0.00000000 2 1 0.00000000 3 2 0.00000000 4 3 0.01991794 5 4 0.07317444 6 5 0.22096838 7 6 0.51286001 8 7 0.90617345 9 8 1.00000000 10 9 1.00000000 11 10 1.00000000 12 11 1.00000000 13 12 1.00000000 14 13 1.00000000 15 14 1.00000000 16 15 1.00000000 17 16 1.00000000 18 17 1.00000000 19 18 1.00000000 20 19 1.00000000 21 20 1.00000000 22 21 1.00000000 23 22 1.00000000 24 23 1.00000000 25 24 1.00000000 26 25 1.00000000 > > > > cleanEx() > nameEx("getD_none") > ### * getD_none > > flush(stderr()); flush(stdout()) > > ### Name: getD_none > ### Title: Get the conditional errors. > ### Aliases: getD_none > > ### ** Examples > > #Calculate a Simon's two-stage design > design <- getSolutions()$Solutions[3,] #minimax-design for the default values. > > ce_toOne <- getD_none(design) > ce_toOne k ce 1 0 0.00000000 2 1 0.00000000 3 2 0.00000000 4 3 0.01700400 5 4 0.06840617 6 5 0.21075066 7 6 0.48527217 8 7 0.81469798 9 8 1.00000000 10 9 1.00000000 11 10 1.00000000 12 11 1.00000000 13 12 1.00000000 14 13 1.00000000 15 14 1.00000000 16 15 1.00000000 17 16 1.00000000 18 17 1.00000000 19 18 1.00000000 20 19 1.00000000 21 20 1.00000000 22 21 1.00000000 23 22 1.00000000 24 23 1.00000000 25 24 1.00000000 26 25 1.00000000 > > > > cleanEx() > nameEx("getD_proportionally") > ### * getD_proportionally > > flush(stderr()); flush(stdout()) > > ### Name: getD_proportionally > ### Title: Get the conditional errors proportionally. > ### Aliases: getD_proportionally > > ### ** Examples > > #Calculate a Simon's two-stage design > design <- getSolutions()$Solutions[3,] #minimax-design for the default values. > > ce_prop <- getD_proportionally(design, 0.05) > ce_prop k ce 1 0.000000 0.00000000 2 1.000000 0.00000000 3 2.000000 0.00000000 4 3.007164 0.02416787 5 4.007164 0.07557005 6 5.007164 0.21791453 7 6.007164 0.49243604 8 7.007164 0.82186185 9 8.000000 1.00000000 10 9.000000 1.00000000 11 10.000000 1.00000000 12 11.000000 1.00000000 13 12.000000 1.00000000 14 13.000000 1.00000000 15 14.000000 1.00000000 16 15.000000 1.00000000 17 16.000000 1.00000000 18 17.000000 1.00000000 19 18.000000 1.00000000 20 19.000000 1.00000000 21 20.000000 1.00000000 22 21.000000 1.00000000 23 22.000000 1.00000000 24 23.000000 1.00000000 25 24.000000 1.00000000 26 25.000000 1.00000000 > > > > cleanEx() > nameEx("getN2") > ### * getN2 > > flush(stderr()); flush(stdout()) > > ### Name: getN2 > ### Title: Calculates the number of patients which should be enrolled in > ### the second stage. > ### Aliases: getN2 > > ### ** Examples > > #Calculate a Simon's two-stage design > design <- getSolutions()$Solutions[3,] #minimax-design for the default values. > > #Assume we only observed 3 responses in the interim analysis. > #Therefore the conditional power is only about 0.55. > #In order to raise the conditional power to 0.8 "n2" has to be increased. > > #set k to 3 (only 3 responses observed so far) > k = 3 > > # Assume we spent the "rest alpha" proportionally in the planning phase > # there for we set "mode = 1". > n2 <- getN2(cp = 0.8, design$p1, design, k, mode = 1, alpha = 0.05) > n2 [1] 29 > > > > cleanEx() > nameEx("getSolutions") > ### * getSolutions > > flush(stderr()); flush(stdout()) > > ### Name: getSolutions > ### Title: Returns designs for a given "simon"-object (see 'setupSimon') > ### Aliases: getSolutions > > ### ** Examples > > # Example 1: Using the default values > designs <- getSolutions() > designs <- designs$Solutions > designs ID r1 n1 r n p0 p1 enP0 enP1 petP0 petP1 Alpha Beta Admissible 1 0 0 14 7 41 0.1 0.3 34.82 40.82 0.2288 0.0068 0.0468 0.0498 0 2 1 1 20 7 41 0.1 0.3 32.77 40.84 0.3917 0.0076 0.0467 0.0491 0 3 2 2 25 7 41 0.1 0.3 32.41 40.86 0.5371 0.0090 0.0467 0.0486 1 4 3 2 23 8 46 0.1 0.3 32.38 45.64 0.5920 0.0157 0.0345 0.0475 0 5 4 3 27 8 46 0.1 0.3 32.36 45.62 0.7179 0.0202 0.0339 0.0488 0 6 5 2 22 8 47 0.1 0.3 31.50 46.48 0.6200 0.0207 0.0379 0.0454 0 7 6 3 26 8 47 0.1 0.3 31.44 46.45 0.7409 0.0260 0.0368 0.0476 0 8 7 2 21 8 48 0.1 0.3 30.49 47.27 0.6484 0.0271 0.0410 0.0462 0 9 8 3 25 8 48 0.1 0.3 30.44 47.24 0.7636 0.0332 0.0394 0.0494 0 10 9 2 20 8 49 0.1 0.3 29.37 47.97 0.6769 0.0355 0.0438 0.0499 1 Admiss_Start Admiss_End Type 1 NA NA 2 NA NA 3 0.2752 1.0000 MiniMax 4 NA NA 5 NA NA 6 NA NA 7 NA NA 8 NA NA 9 NA NA 10 0.0000 0.2752 Optimal > > > > cleanEx() > nameEx("getSolutionsSub1") > ### * getSolutionsSub1 > > flush(stderr()); flush(stdout()) > > ### Name: getSolutionsSub1 > ### Title: Calculates designs for a given "sub1"-object. > ### Aliases: getSolutionsSub1 > > ### ** Examples > > # Example 1: Using the default values > sub1 <- setupSub1Design() > getSolutionsSub1(sub1) $Solutions ID r1 n1 r s n pc0 pt0 pc1 pt1 enP0 petP0 Alpha Beta Admissible 1 0 0 3 19 20 25 0.6 0.7 0.8 0.9 23.59 0.064 0.0937 0.0975 0 2 1 0 3 19 21 26 0.6 0.7 0.8 0.9 24.53 0.064 0.0939 0.0928 0 3 2 0 3 20 23 28 0.6 0.7 0.8 0.9 26.40 0.064 0.0913 0.0907 0 4 3 0 2 23 23 29 0.6 0.7 0.8 0.9 24.68 0.160 0.0865 0.0979 0 5 4 0 2 22 24 30 0.6 0.7 0.8 0.9 25.52 0.160 0.0843 0.0949 0 6 5 0 2 22 25 31 0.6 0.7 0.8 0.9 26.36 0.160 0.0946 0.0880 0 7 6 0 2 23 26 32 0.6 0.7 0.8 0.9 27.20 0.160 0.0763 0.0969 0 8 7 0 2 26 26 33 0.6 0.7 0.8 0.9 28.04 0.160 0.0872 0.0778 0 9 8 0 2 27 27 34 0.6 0.7 0.8 0.9 28.88 0.160 0.0726 0.0838 0 10 9 0 2 28 28 35 0.6 0.7 0.8 0.9 29.72 0.160 0.0602 0.0903 0 11 10 0 2 29 29 36 0.6 0.7 0.8 0.9 30.56 0.160 0.0497 0.0975 0 12 11 0 2 29 29 37 0.6 0.7 0.8 0.9 31.40 0.160 0.0871 0.0648 0 13 12 0 2 30 30 38 0.6 0.7 0.8 0.9 32.24 0.160 0.0732 0.0689 0 14 13 0 2 31 31 39 0.6 0.7 0.8 0.9 33.08 0.160 0.0613 0.0733 0 15 14 0 2 32 32 40 0.6 0.7 0.8 0.9 33.92 0.160 0.0511 0.0782 0 16 15 0 2 33 33 41 0.6 0.7 0.8 0.9 34.76 0.160 0.0424 0.0836 0 17 16 0 2 34 34 42 0.6 0.7 0.8 0.9 35.60 0.160 0.0351 0.0894 0 18 17 0 2 35 35 43 0.6 0.7 0.8 0.9 36.44 0.160 0.0289 0.0958 0 19 18 0 2 35 35 44 0.6 0.7 0.8 0.9 37.28 0.160 0.0519 0.0655 0 20 19 0 2 36 36 45 0.6 0.7 0.8 0.9 38.12 0.160 0.0435 0.0692 0 21 20 0 2 37 37 46 0.6 0.7 0.8 0.9 38.96 0.160 0.0362 0.0733 0 22 21 0 2 38 38 47 0.6 0.7 0.8 0.9 39.80 0.160 0.0301 0.0777 0 23 22 0 2 39 39 48 0.6 0.7 0.8 0.9 40.64 0.160 0.0250 0.0825 0 24 23 0 2 40 40 49 0.6 0.7 0.8 0.9 41.48 0.160 0.0206 0.0877 0 25 24 0 2 41 41 50 0.6 0.7 0.8 0.9 42.32 0.160 0.0170 0.0934 0 26 25 0 2 42 42 51 0.6 0.7 0.8 0.9 43.16 0.160 0.0139 0.0994 0 Admiss_Start Admiss_End Type ClosedTestProcedure 1 NA NA TRUE 2 NA NA TRUE 3 NA NA TRUE 4 NA NA TRUE 5 NA NA TRUE 6 NA NA TRUE 7 NA NA TRUE 8 NA NA TRUE 9 NA NA TRUE 10 NA NA TRUE 11 NA NA TRUE 12 NA NA TRUE 13 NA NA TRUE 14 NA NA TRUE 15 NA NA TRUE 16 NA NA TRUE 17 NA NA TRUE 18 NA NA TRUE 19 NA NA TRUE 20 NA NA TRUE 21 NA NA TRUE 22 NA NA TRUE 23 NA NA TRUE 24 NA NA TRUE 25 NA NA TRUE 26 NA NA TRUE $Curtailment_Results list() > > > > cleanEx() > nameEx("get_CI") > ### * get_CI > > flush(stderr()); flush(stdout()) > > ### Name: get_CI > ### Title: Calculates the confidence interval. > ### Aliases: get_CI > > ### ** Examples > > #Calculate a Simon's two-stage design > design <- getSolutions()$Solutions[3,] #minimax-design for the default values. > > #Assume 9 responses were observed in the whole trial. > k = 9 > > ci <- get_CI(k, design$r1, design$n1, design$n) > > > > cleanEx() > nameEx("get_UMVUE_GMS") > ### * get_UMVUE_GMS > > flush(stderr()); flush(stdout()) > > ### Name: get_UMVUE_GMS > ### Title: Calculates the "uniformly minimal variance unbiased estimator". > ### Aliases: get_UMVUE_GMS > > ### ** Examples > > #Calculate a Simon's two-stage design > design <- getSolutions()$Solutions[3,] #minimax-design for the default values. > > #Assume 9 responses were observed in the whole trial. > k = 9 > > umvue <- get_UMVUE_GMS(k, design$r1, design$n1, design$n) > > > > cleanEx() > nameEx("get_UMVUE_GMS_subset_second_only") > ### * get_UMVUE_GMS_subset_second_only > > flush(stderr()); flush(stdout()) > > ### Name: get_UMVUE_GMS_subset_second_only > ### Title: Calculates the "uniformly minimal variance unbiased estimator". > ### Aliases: get_UMVUE_GMS_subset_second_only > > ### ** Examples > > #Setup "sub1"-object > sub1 <- setupSub1Design(pc0 = 0.5, pt0 = 0.6) > > #Calculate a subset design > design <- getSolutionsSub1(sub1, skipN1 = FALSE)$Solutions[4,] > > #Assume 9 responses in the subset endpoint and 13 responses in the superset endpoint were observed. > t = 9 > u = 13 > umvue_second <- get_UMVUE_GMS_subset_second_only(t, u, design$r1, design$n1, design$n) > > > > cleanEx() > nameEx("get_UMVUE_GMS_subset_second_total") > ### * get_UMVUE_GMS_subset_second_total > > flush(stderr()); flush(stdout()) > > ### Name: get_UMVUE_GMS_subset_second_total > ### Title: Calculates the "uniformly minimal variance unbiased estimator". > ### Aliases: get_UMVUE_GMS_subset_second_total > > ### ** Examples > > #Setup "sub1"-object > sub1 <- setupSub1Design(pc0 = 0.5, pt0 = 0.6) > > #Calculate a subset design > design <- getSolutionsSub1(sub1, skipN1 = FALSE)$Solutions[4,] > > #Assume 9 responses in the subset endpoint and 13 responses in the superset endpoint were observed. > t = 9 > u = 13 > umvue_second <- get_UMVUE_GMS_subset_second_total(t, u, design$r1, design$n1, design$n) > > > > cleanEx() > nameEx("get_conditionalPower") > ### * get_conditionalPower > > flush(stderr()); flush(stdout()) > > ### Name: get_conditionalPower > ### Title: Calculates the conditional power. > ### Aliases: get_conditionalPower > > ### ** Examples > > #Setup "sub1"-object > sub1 <- setupSub1Design(pc0 = 0.5, pt0 = 0.6) > > #Calculate a subset design > design <- getSolutionsSub1(sub1, skipN1 = FALSE)$Solutions[4,] > > t <- 5 > u <- 7 > enrolled <- 10 > > con_p <- get_conditionalPower(t, u, enrolled, design$r1, + design$n1, design$r, design$s, design$n, design$pc1, design$pt1, sub1) > > > > cleanEx() > nameEx("get_confidence_set") > ### * get_confidence_set > > flush(stderr()); flush(stdout()) > > ### Name: get_confidence_set > ### Title: Calculates the confidence set. > ### Aliases: get_confidence_set > > ### ** Examples > > #Setup "sub1"-object > sub1 <- setupSub1Design(pc0 = 0.5, pt0 = 0.6) > > #Calculate a subset design > design <- getSolutionsSub1(sub1, skipN1 = FALSE)$Solutions[4,] > > t <- 12 > u <- 13 > alpha = 0.1 > > conf_set <- get_confidence_set(t, u, design$r1, design$n1, design$n, design$pc0, design$pt0, alpha) > > > > cleanEx() > nameEx("get_p_KC") > ### * get_p_KC > > flush(stderr()); flush(stdout()) > > ### Name: get_p_KC > ### Title: Calculates the p-value. > ### Aliases: get_p_KC > > ### ** Examples > > #Calculate a Simon's two-stage design > design <- getSolutions()$Solutions[3,] #minimax-design for the default values. > > #Assume 9 responses were observed in the whole trial. > k = 9 > > p_val <- get_p_KC(k, design$r1, design$n1, design$n, design$p0) > > > > cleanEx() > nameEx("get_p_exact_subset") > ### * get_p_exact_subset > > flush(stderr()); flush(stdout()) > > ### Name: get_p_exact_subset > ### Title: Calculates the exact p value. > ### Aliases: get_p_exact_subset > > ### ** Examples > > #Setup "sub1"-object > sub1 <- setupSub1Design(pc0 = 0.5, pt0 = 0.6) > > #Calculate a subset design > design <- getSolutionsSub1(sub1, skipN1 = FALSE)$Solutions[4,] > > #Assuming 9 responses in the subset endpoint and 13 responses > #in the superset endpoint were observed. > t = 9 > u = 13 > > p_val <- get_p_exact_subset(t, u, design$r1, design$n1, design$n, design$pc0, design$pt0, sub1) > p_val [1] 0.00739709 > > > > cleanEx() > nameEx("get_r2_flex") > ### * get_r2_flex > > flush(stderr()); flush(stdout()) > > ### Name: get_r2_flex > ### Title: Calculates the number of responses needed for the second stage. > ### Aliases: get_r2_flex > > ### ** Examples > > #Calculate a Simon's two-stage design > design <- getSolutions()$Solutions[3,] #minimax-design for the default values. > #Get the conditional error values using proportionally "rest"-alpha spending. > ce_df <- getD_proportionally(design, 0.05) > #Assume 5 responses were observed in the interim analysis. > ce <- ce_df[5+1,]$ce # conditional error for 5 responses is listed in the 6th row of "ce_df" > #Calculate the number of patients needed in the second stage. > n2 <- design$n - design$n1 > r2 <- get_r2_flex(ce, design$p0, n2) > r2 [1] 3 > #Assume 10 patients more should be recruited in the second stage. > #(This changes the number of needed responses.) > n2 <- n2 + 10 > r2 <- get_r2_flex(ce, design$p0, n2) > r2 [1] 5 > > > > cleanEx() > nameEx("plot_confidence_set") > ### * plot_confidence_set > > flush(stderr()); flush(stdout()) > > ### Name: plot_confidence_set > ### Title: Plots the "confidence set" according to the observed responses. > ### Aliases: plot_confidence_set > > ### ** Examples > > #Setup "sub1"-object > sub1 <- setupSub1Design(pc0 = 0.5, pt0 = 0.6) > > #Calculate a subset design > design <- getSolutionsSub1(sub1, skipN1 = FALSE)$Solutions[4,] > > #Assume 11 responses in the subset endpoint and 12 responses in the superset endpoint were observed. > t = 10 > u = 12 > > plot_confidence_set(t, u, design$r1, design$n1, design$n, design$pc0, design$pt0, 0.1) > > > > cleanEx() > nameEx("plot_simon_study_state") > ### * plot_simon_study_state > > flush(stderr()); flush(stdout()) > > ### Name: plot_simon_study_state > ### Title: Plots the study state of a given Simon's two-stage design. > ### Aliases: plot_simon_study_state > > ### ** Examples > > #Calculate a Simon's two-stage design > design <- getSolutions()$Solutions[3,] #minimax-design for the default values. > #Define the stopping rules according to the chosen design > sr <- data.frame(Enrolled_patients = c(design$n1, design$n), + Needed_responses_ep1 = c(design$r1, design$r)) > #Simulate 18 random generated outcomes. > enrolledPat <- data.frame(ep1 = rbinom(18,1, design$p1)) > #Plot study state > plot_simon_study_state(sr, enrolledPat, design$r1, design$n1, design$r, design$n) > > > > cleanEx() > nameEx("plot_sub1_study_state") > ### * plot_sub1_study_state > > flush(stderr()); flush(stdout()) > > ### Name: plot_sub1_study_state > ### Title: Plots the study state of a given subset design. > ### Aliases: plot_sub1_study_state > > ### ** Examples > > #Calculate a subset design. > sub1 <- setupSub1Design(alpha = 0.1, beta = 0.2, pc0 = 0.3, pt0 = 0.4) > design <- getSolutionsSub1(sub1)$Solutions[10,] > #Define the stopping rules according to the chosen design. > sr <- data.frame(Enrolled_patients = c(design$n1, design$n), + Needed_responses_ep1 = c(design$r1, design$r), Needed_responses_ep2 = c(0,design$s)) > #Simulate 14 random generated outcomes. > tmp_ep1 <- rbinom(14,1, design$pc1) > tmp_ep2 <- tmp_ep1 | rbinom(14,1, design$pt1) > enrolledPat <- data.frame(ep1 = tmp_ep1, ep2 = tmp_ep2) > #Plot study state. > plot_sub1_study_state(sr, enrolledPat, design$r1, design$n1, design$r, design$s, design$n) > > > > cleanEx() > nameEx("setSimonParams") > ### * setSimonParams > > flush(stderr()); flush(stdout()) > > ### Name: setSimonParams > ### Title: Sets the parameters for a given "simon"-object. > ### Aliases: setSimonParams > > ### ** Examples > > #Create "simon"-object. > simon <- setupSimon() > #Change parameters. > setSimonParams(simon, alpha = 0.1, beta = 0.2, p0 = 0.25, p1 = 0.45) > #Calculate designs for the given "simon"-object. > designs <- getSolutions(simon)$Solutions > designs ID r1 n1 r n p0 p1 enP0 enP1 petP0 petP1 Alpha Beta Admissible 1 0 0 7 9 26 0.25 0.45 23.46 25.71 0.1335 0.0152 0.0897 0.1986 0 2 1 1 10 9 26 0.25 0.45 22.10 25.63 0.2440 0.0233 0.0894 0.1992 0 3 2 2 13 9 26 0.25 0.45 21.68 25.65 0.3326 0.0269 0.0896 0.1979 0 4 3 3 15 9 26 0.25 0.45 20.93 25.53 0.4613 0.0424 0.0890 0.1997 1 5 4 4 15 9 27 0.25 0.45 18.76 25.56 0.6865 0.1204 0.0973 0.1988 1 Admiss_Start Admiss_End Type 1 NA NA 2 NA NA 3 NA NA 4 0.6839 1.0000 MiniMax 5 0.0000 0.6839 Optimal > > > > cleanEx() > nameEx("setSub1Params") > ### * setSub1Params > > flush(stderr()); flush(stdout()) > > ### Name: setSub1Params > ### Title: Sets the parameters for a given "sub1"-object. > ### Aliases: setSub1Params > > ### ** Examples > > #Create "sub1"-object. > sub1 <- setupSub1Design() > #Change parameters. > setSub1Params(sub1, beta = 0.2, pc0 = 0.5, pt0 = 0.6) > #Calculate designs for the given "sub1"-object. > designs <- getSolutionsSub1(sub1)$Solutions > designs ID r1 n1 r s n pc0 pt0 pc1 pt1 enP0 petP0 Alpha Beta Admissible 1 0 0 3 7 8 10 0.5 0.6 0.8 0.9 9.12 0.125 0.0740 0.1907 0 2 1 1 3 8 8 11 0.5 0.6 0.8 0.9 7.00 0.500 0.0950 0.1667 0 3 2 0 2 9 9 12 0.5 0.6 0.8 0.9 9.50 0.250 0.0771 0.1384 0 4 3 0 2 10 10 13 0.5 0.6 0.8 0.9 10.25 0.250 0.0537 0.1601 0 5 4 0 2 11 11 14 0.5 0.6 0.8 0.9 11.00 0.250 0.0370 0.1833 0 6 5 0 2 11 11 15 0.5 0.6 0.8 0.9 11.75 0.250 0.0822 0.0887 0 7 6 0 2 12 12 16 0.5 0.6 0.8 0.9 12.50 0.250 0.0594 0.1006 0 8 7 0 2 13 13 17 0.5 0.6 0.8 0.9 13.25 0.250 0.0425 0.1139 0 9 8 0 2 14 14 18 0.5 0.6 0.8 0.9 14.00 0.250 0.0301 0.1284 0 10 9 0 2 15 15 19 0.5 0.6 0.8 0.9 14.75 0.250 0.0212 0.1442 0 11 10 0 2 16 16 20 0.5 0.6 0.8 0.9 15.50 0.250 0.0148 0.1612 0 12 11 0 2 17 17 21 0.5 0.6 0.8 0.9 16.25 0.250 0.0102 0.1791 0 13 12 0 2 18 18 22 0.5 0.6 0.8 0.9 17.00 0.250 0.0070 0.1981 0 14 13 0 2 18 18 23 0.5 0.6 0.8 0.9 17.75 0.250 0.0173 0.1060 0 15 14 0 2 19 19 24 0.5 0.6 0.8 0.9 18.50 0.250 0.0123 0.1172 0 16 15 0 2 20 20 25 0.5 0.6 0.8 0.9 19.25 0.250 0.0087 0.1293 0 17 16 0 2 21 21 26 0.5 0.6 0.8 0.9 20.00 0.250 0.0061 0.1423 0 18 17 0 2 22 22 27 0.5 0.6 0.8 0.9 20.75 0.250 0.0043 0.1562 0 19 18 0 2 23 23 28 0.5 0.6 0.8 0.9 21.50 0.250 0.0030 0.1709 0 20 19 0 2 24 24 29 0.5 0.6 0.8 0.9 22.25 0.250 0.0020 0.1864 0 21 20 0 2 24 24 30 0.5 0.6 0.8 0.9 23.00 0.250 0.0052 0.1067 0 22 21 0 2 25 25 31 0.5 0.6 0.8 0.9 23.75 0.250 0.0037 0.1163 0 23 22 0 2 26 26 32 0.5 0.6 0.8 0.9 24.50 0.250 0.0026 0.1266 0 24 23 0 2 27 27 33 0.5 0.6 0.8 0.9 25.25 0.250 0.0018 0.1376 0 25 24 0 2 28 28 34 0.5 0.6 0.8 0.9 26.00 0.250 0.0013 0.1494 0 26 25 0 2 29 29 35 0.5 0.6 0.8 0.9 26.75 0.250 0.0009 0.1617 0 27 26 0 2 30 30 36 0.5 0.6 0.8 0.9 27.50 0.250 0.0006 0.1748 0 28 27 0 2 31 31 37 0.5 0.6 0.8 0.9 28.25 0.250 0.0004 0.1884 0 29 28 0 2 31 31 38 0.5 0.6 0.8 0.9 29.00 0.250 0.0011 0.1135 0 30 29 0 2 32 32 39 0.5 0.6 0.8 0.9 29.75 0.250 0.0008 0.1224 0 31 30 0 2 33 33 40 0.5 0.6 0.8 0.9 30.50 0.250 0.0005 0.1319 0 32 31 0 2 34 34 41 0.5 0.6 0.8 0.9 31.25 0.250 0.0004 0.1420 0 33 32 0 2 35 35 42 0.5 0.6 0.8 0.9 32.00 0.250 0.0003 0.1526 0 34 33 0 2 36 36 43 0.5 0.6 0.8 0.9 32.75 0.250 0.0002 0.1638 0 35 34 0 2 37 37 44 0.5 0.6 0.8 0.9 33.50 0.250 0.0001 0.1755 0 36 35 0 2 38 38 45 0.5 0.6 0.8 0.9 34.25 0.250 0.0001 0.1877 0 37 36 0 2 38 38 46 0.5 0.6 0.8 0.9 35.00 0.250 0.0002 0.1176 0 38 37 0 2 39 39 47 0.5 0.6 0.8 0.9 35.75 0.250 0.0002 0.1259 0 39 38 0 2 40 40 48 0.5 0.6 0.8 0.9 36.50 0.250 0.0001 0.1347 0 40 39 0 2 41 41 49 0.5 0.6 0.8 0.9 37.25 0.250 0.0001 0.1439 0 41 40 0 2 42 42 50 0.5 0.6 0.8 0.9 38.00 0.250 0.0001 0.1537 0 42 41 0 2 43 43 51 0.5 0.6 0.8 0.9 38.75 0.250 0.0000 0.1638 0 Admiss_Start Admiss_End Type ClosedTestProcedure 1 NA NA TRUE 2 NA NA FALSE 3 NA NA TRUE 4 NA NA TRUE 5 NA NA TRUE 6 NA NA TRUE 7 NA NA TRUE 8 NA NA TRUE 9 NA NA TRUE 10 NA NA TRUE 11 NA NA TRUE 12 NA NA TRUE 13 NA NA TRUE 14 NA NA TRUE 15 NA NA TRUE 16 NA NA TRUE 17 NA NA TRUE 18 NA NA TRUE 19 NA NA TRUE 20 NA NA TRUE 21 NA NA TRUE 22 NA NA TRUE 23 NA NA TRUE 24 NA NA TRUE 25 NA NA TRUE 26 NA NA TRUE 27 NA NA TRUE 28 NA NA TRUE 29 NA NA TRUE 30 NA NA TRUE 31 NA NA TRUE 32 NA NA TRUE 33 NA NA TRUE 34 NA NA TRUE 35 NA NA TRUE 36 NA NA TRUE 37 NA NA TRUE 38 NA NA TRUE 39 NA NA TRUE 40 NA NA TRUE 41 NA NA TRUE 42 NA NA TRUE > > > > cleanEx() > nameEx("setupSimon") > ### * setupSimon > > flush(stderr()); flush(stdout()) > > ### Name: setupSimon > ### Title: Creates a "simon"-object. > ### Aliases: setupSimon > > ### ** Examples > > #Create a "simon"-object > simon <- setupSimon() > #Calculate designs for the given "simon"-object. > designs <- getSolutions(simon)$Solutions > designs ID r1 n1 r n p0 p1 enP0 enP1 petP0 petP1 Alpha Beta Admissible 1 0 0 14 7 41 0.1 0.3 34.82 40.82 0.2288 0.0068 0.0468 0.0498 0 2 1 1 20 7 41 0.1 0.3 32.77 40.84 0.3917 0.0076 0.0467 0.0491 0 3 2 2 25 7 41 0.1 0.3 32.41 40.86 0.5371 0.0090 0.0467 0.0486 1 4 3 2 23 8 46 0.1 0.3 32.38 45.64 0.5920 0.0157 0.0345 0.0475 0 5 4 3 27 8 46 0.1 0.3 32.36 45.62 0.7179 0.0202 0.0339 0.0488 0 6 5 2 22 8 47 0.1 0.3 31.50 46.48 0.6200 0.0207 0.0379 0.0454 0 7 6 3 26 8 47 0.1 0.3 31.44 46.45 0.7409 0.0260 0.0368 0.0476 0 8 7 2 21 8 48 0.1 0.3 30.49 47.27 0.6484 0.0271 0.0410 0.0462 0 9 8 3 25 8 48 0.1 0.3 30.44 47.24 0.7636 0.0332 0.0394 0.0494 0 10 9 2 20 8 49 0.1 0.3 29.37 47.97 0.6769 0.0355 0.0438 0.0499 1 Admiss_Start Admiss_End Type 1 NA NA 2 NA NA 3 0.2752 1.0000 MiniMax 4 NA NA 5 NA NA 6 NA NA 7 NA NA 8 NA NA 9 NA NA 10 0.0000 0.2752 Optimal > > > > cleanEx() > nameEx("setupSub1Design") > ### * setupSub1Design > > flush(stderr()); flush(stdout()) > > ### Name: setupSub1Design > ### Title: Creates a "sub1"-object. > ### Aliases: setupSub1Design > > ### ** Examples > > #Create "sub1"-object. > sub1 <- setupSub1Design() > #Calculate designs for the given "sub1"-object. > designs <- getSolutionsSub1(sub1)$Solutions > designs ID r1 n1 r s n pc0 pt0 pc1 pt1 enP0 petP0 Alpha Beta Admissible 1 0 0 3 19 20 25 0.6 0.7 0.8 0.9 23.59 0.064 0.0937 0.0975 0 2 1 0 3 19 21 26 0.6 0.7 0.8 0.9 24.53 0.064 0.0939 0.0928 0 3 2 0 3 20 23 28 0.6 0.7 0.8 0.9 26.40 0.064 0.0913 0.0907 0 4 3 0 2 23 23 29 0.6 0.7 0.8 0.9 24.68 0.160 0.0865 0.0979 0 5 4 0 2 22 24 30 0.6 0.7 0.8 0.9 25.52 0.160 0.0843 0.0949 0 6 5 0 2 22 25 31 0.6 0.7 0.8 0.9 26.36 0.160 0.0946 0.0880 0 7 6 0 2 23 26 32 0.6 0.7 0.8 0.9 27.20 0.160 0.0763 0.0969 0 8 7 0 2 26 26 33 0.6 0.7 0.8 0.9 28.04 0.160 0.0872 0.0778 0 9 8 0 2 27 27 34 0.6 0.7 0.8 0.9 28.88 0.160 0.0726 0.0838 0 10 9 0 2 28 28 35 0.6 0.7 0.8 0.9 29.72 0.160 0.0602 0.0903 0 11 10 0 2 29 29 36 0.6 0.7 0.8 0.9 30.56 0.160 0.0497 0.0975 0 12 11 0 2 29 29 37 0.6 0.7 0.8 0.9 31.40 0.160 0.0871 0.0648 0 13 12 0 2 30 30 38 0.6 0.7 0.8 0.9 32.24 0.160 0.0732 0.0689 0 14 13 0 2 31 31 39 0.6 0.7 0.8 0.9 33.08 0.160 0.0613 0.0733 0 15 14 0 2 32 32 40 0.6 0.7 0.8 0.9 33.92 0.160 0.0511 0.0782 0 16 15 0 2 33 33 41 0.6 0.7 0.8 0.9 34.76 0.160 0.0424 0.0836 0 17 16 0 2 34 34 42 0.6 0.7 0.8 0.9 35.60 0.160 0.0351 0.0894 0 18 17 0 2 35 35 43 0.6 0.7 0.8 0.9 36.44 0.160 0.0289 0.0958 0 19 18 0 2 35 35 44 0.6 0.7 0.8 0.9 37.28 0.160 0.0519 0.0655 0 20 19 0 2 36 36 45 0.6 0.7 0.8 0.9 38.12 0.160 0.0435 0.0692 0 21 20 0 2 37 37 46 0.6 0.7 0.8 0.9 38.96 0.160 0.0362 0.0733 0 22 21 0 2 38 38 47 0.6 0.7 0.8 0.9 39.80 0.160 0.0301 0.0777 0 23 22 0 2 39 39 48 0.6 0.7 0.8 0.9 40.64 0.160 0.0250 0.0825 0 24 23 0 2 40 40 49 0.6 0.7 0.8 0.9 41.48 0.160 0.0206 0.0877 0 25 24 0 2 41 41 50 0.6 0.7 0.8 0.9 42.32 0.160 0.0170 0.0934 0 26 25 0 2 42 42 51 0.6 0.7 0.8 0.9 43.16 0.160 0.0139 0.0994 0 Admiss_Start Admiss_End Type ClosedTestProcedure 1 NA NA TRUE 2 NA NA TRUE 3 NA NA TRUE 4 NA NA TRUE 5 NA NA TRUE 6 NA NA TRUE 7 NA NA TRUE 8 NA NA TRUE 9 NA NA TRUE 10 NA NA TRUE 11 NA NA TRUE 12 NA NA TRUE 13 NA NA TRUE 14 NA NA TRUE 15 NA NA TRUE 16 NA NA TRUE 17 NA NA TRUE 18 NA NA TRUE 19 NA NA TRUE 20 NA NA TRUE 21 NA NA TRUE 22 NA NA TRUE 23 NA NA TRUE 24 NA NA TRUE 25 NA NA TRUE 26 NA NA TRUE > > > > ### *