# Compare_to_original_BOIN

    library(bfboin)

A good starting point to test that `get.oc.bf()` is working as expected is that it should produce the same result (within simulation error) as `BOIN::get.oc()` when the response rates are all set to zero (thus effectively turning off the backfilling component of the design).

    get.oc.bf(ntrial = 10000,
              seed = 9,
              target = 0.25,
              p.true = c(0.1, 0.5),
              ncohort = 10,
              cohortsize = 3,
              n.earlystop = 9,
              startdose = 1,
              titration = FALSE,
              cutoff.eli = 0.95,
              extrasafe = TRUE,
              offset = 0.1,
              boundMTD=FALSE,
              n.cap = 12,
              end.backfill = TRUE,
              n.per.month = 1,
              dlt.window = 1,
              p.response.true = c(0.00001, 0.00001))
    #> $selpercent
    #> [1] 77.91 17.91
    #>
    #> $npatients
    #>       1       2
    #> 10.8288  7.6767
    #>
    #> $percentpatients
    #>        1        2
    #> 58.51666 41.48334
    #>
    #> $ntox
    #>      1      2
    #> 1.0852 3.8624
    #>
    #> $totaltox
    #> [1] 4.9476
    #>
    #> $totaln
    #> [1] 18.5055
    #>
    #> $percentstop
    #> [1] 4.18
    #>
    #> $duration
    #> [1] 21.30958

    BOIN::get.oc(target = 0.25,
                 p.true = c(0.1, 0.5),
                 ncohort = 10,
                 cohortsize = 3,
                 n.earlystop = 9,
                 startdose = 1,
                 titration = FALSE,
                 cutoff.eli = 0.95,
                 extrasafe = TRUE,
                 offset = 0.1,
                 boundMTD=FALSE,
                 ntrial = 10000, seed = 6)
    #> $selpercent
    #> [1] 77.75 18.42
    #>
    #> $npatients
    #> [1] 10.7160  7.7784
    #>
    #> $ntox
    #> [1] 1.0536 3.8988
    #>
    #> $totaltox
    #> [1] 4.9524
    #>
    #> $totaln
    #> [1] 18.4944
    #>
    #> $percentstop
    #> [1] 3.83
    #>
    #> $simu.setup
    #>   target p.true ncohort cohortsize startdose p.saf p.tox cutoff.eli extrasafe
    #> 1   0.25    0.1      10          3         1  0.15  0.35       0.95      TRUE
    #> 2   0.25    0.5      10          3         1  0.15  0.35       0.95      TRUE
    #>   offset ntrial dose
    #> 1    0.1  10000    1
    #> 2    0.1  10000    2
    #>
    #> $flowchart
    #> [1] TRUE
    #>
    #> $lambda_e
    #> [1] 0.1968009
    #>
    #> $lambda_d
    #> [1] 0.2983922
    #>
    #> attr(,"class")
    #> [1] "boin"