Skip to contents
## Exports from /home/runner/work/gsDesign2/gsDesign2/src/gridpts_h1_hupdate.cpp:
##    List gridptsRcpp(int r, double mu, double a, double b)
##    List h1Rcpp(int r, double theta, double I, double a, double b)
##    List hupdateRcpp(int r, double theta, double I, double a, double b, double thetam1, double Im1, List gm1)
## 
## /home/runner/work/gsDesign2/gsDesign2/src/RcppExports.cpp updated.
## /home/runner/work/gsDesign2/gsDesign2/R/RcppExports.R updated.
## * installing *source* package ‘gsDesign2’ ...
## ** using staged installation
## ** libs
## g++ -std=gnu++14 -I"/opt/R/4.2.1/lib/R/include" -DNDEBUG  -I'/home/runner/work/_temp/Library/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c RcppExports.cpp -o RcppExports.o
## g++ -std=gnu++14 -I"/opt/R/4.2.1/lib/R/include" -DNDEBUG  -I'/home/runner/work/_temp/Library/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c gridpts_h1_hupdate.cpp -o gridpts_h1_hupdate.o
## g++ -std=gnu++14 -shared -L/opt/R/4.2.1/lib/R/lib -L/usr/local/lib -o gsDesign2.so RcppExports.o gridpts_h1_hupdate.o -L/opt/R/4.2.1/lib/R/lib -lR
## installing to /tmp/RtmpEP7MXg/devtools_install_48397dc19d33/00LOCK-gsDesign2/00new/gsDesign2/libs
## ** checking absolute paths in shared objects and dynamic libraries
## * DONE (gsDesign2)

Test 1: unstratified population

enrollRates <- tibble(Stratum = "All",
                      duration = c(2, 10, 4, 4, 8),
                      rate = c(5, 10, 0, 3, 6))
failRates <- tibble(Stratum = "All",
                    duration = 1,
                    failRate = c(.1, .2, .3, .4),
                    hr = c(.9, .75, .8, .6),
                    dropoutRate = .001)
x1 <- AHR(enrollRates = enrollRates, failRates = failRates, totalDuration = c(15, 30))
x2 <- AHR_(enrollRates = enrollRates, failRates = failRates, totalDuration = c(15, 30))

expect_equal(x1, x2)

Test 2: stratified population

enrollRates <- tibble(Stratum = c(rep("Low", 2), rep("High", 3)),
                      duration = c(2, 10, 4, 4, 8),
                      rate = c(5, 10, 0, 3, 6))
failRates <- tibble(Stratum = c(rep("Low", 2), rep("High", 2)),
                    duration = 1,
                    failRate = c(.1, .2, .3, .4),
                    hr = c(.9, .75, .8, .6),
                    dropoutRate = .001)

x1 <- AHR(enrollRates = enrollRates, failRates = failRates, totalDuration = c(15, 30))
x2 <- AHR_(enrollRates = enrollRates, failRates = failRates, totalDuration = c(15, 30))

expect_equal(x1, x2)