R/peps2_process.R
peps2_process.Rd
Process RStan samples from a BEBOP model fit to PePS2 data. This step lets us make inferences about whether the modelled efficacy and toxicity probabilities suggest the treatment is acceptable in each of the cohorts under study. The parameters have default values to match those used in the PePS2 trial. See the accompanying vignette for a full description.
peps2_process( fit, min_eff = 0.1, max_tox = 0.3, eff_cert = 0.7, tox_cert = 0.9 )
fit | An instance of |
---|---|
min_eff | The lower efficacy probability threshold; a number between 0 and 1. |
max_tox | The upper toxicity probability threshold; a number between 0 and 1. |
eff_cert | Certainty required to infer the treatment is acceptable with regards to being probably efficacious; a number between 0 and 1. |
tox_cert | Certainty required to infer the treatment is acceptable with regards to being probably tolerable; a number between 0 and 1. |
a list with the following items:
ProbEff
, the posterior mean probability of efficacy in the 6
cohorts.
ProbAccEff
, the posterior mean probability that the probability
of efficacy exceeds min_eff
, in the 6 cohorts.
ProbTox
, the posterior mean probability of toxicity in the 6
cohorts.
ProbAccTox
, the posterior mean probability that the probability
of toxicity is less than max_tox
, in the 6 cohorts.
Accept
, a vector of logical values to show whether treatment
should be accepted in the 6 cohorts. Treatment is acceptable when it is
probably efficacious and probably not toxic, with respect to the described
rules.
alpha
, the posterior mean estimate of alpha.
beta
, the posterior mean estimate of beta.
gamma
, the posterior mean estimate of gamma.
zeta
, the posterior mean estimate of zeta.
lambda
, the posterior mean estimate of lambda.
psi
, the posterior mean estimate of psi.
set.seed(123) fit <- stan_peps2( eff = c(0, 1, 0, 1, 0, 0), tox = c(0, 0, 1, 1, 0, 0), cohorts = c(3, 1, 1, 4, 5, 6) )#> #> SAMPLING FOR MODEL 'BebopInPeps2' NOW (CHAIN 1). #> Chain 1: #> Chain 1: Gradient evaluation took 4.5e-05 seconds #> Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.45 seconds. #> Chain 1: Adjust your expectations accordingly! #> Chain 1: #> Chain 1: #> Chain 1: Iteration: 1 / 2000 [ 0%] (Warmup) #> Chain 1: Iteration: 200 / 2000 [ 10%] (Warmup) #> Chain 1: Iteration: 400 / 2000 [ 20%] (Warmup) #> Chain 1: Iteration: 600 / 2000 [ 30%] (Warmup) #> Chain 1: Iteration: 800 / 2000 [ 40%] (Warmup) #> Chain 1: Iteration: 1000 / 2000 [ 50%] (Warmup) #> Chain 1: Iteration: 1001 / 2000 [ 50%] (Sampling) #> Chain 1: Iteration: 1200 / 2000 [ 60%] (Sampling) #> Chain 1: Iteration: 1400 / 2000 [ 70%] (Sampling) #> Chain 1: Iteration: 1600 / 2000 [ 80%] (Sampling) #> Chain 1: Iteration: 1800 / 2000 [ 90%] (Sampling) #> Chain 1: Iteration: 2000 / 2000 [100%] (Sampling) #> Chain 1: #> Chain 1: Elapsed Time: 0.068686 seconds (Warm-up) #> Chain 1: 0.054903 seconds (Sampling) #> Chain 1: 0.123589 seconds (Total) #> Chain 1: #> #> SAMPLING FOR MODEL 'BebopInPeps2' NOW (CHAIN 2). #> Chain 2: #> Chain 2: Gradient evaluation took 1.2e-05 seconds #> Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.12 seconds. #> Chain 2: Adjust your expectations accordingly! #> Chain 2: #> Chain 2: #> Chain 2: Iteration: 1 / 2000 [ 0%] (Warmup) #> Chain 2: Iteration: 200 / 2000 [ 10%] (Warmup) #> Chain 2: Iteration: 400 / 2000 [ 20%] (Warmup) #> Chain 2: Iteration: 600 / 2000 [ 30%] (Warmup) #> Chain 2: Iteration: 800 / 2000 [ 40%] (Warmup) #> Chain 2: Iteration: 1000 / 2000 [ 50%] (Warmup) #> Chain 2: Iteration: 1001 / 2000 [ 50%] (Sampling) #> Chain 2: Iteration: 1200 / 2000 [ 60%] (Sampling) #> Chain 2: Iteration: 1400 / 2000 [ 70%] (Sampling) #> Chain 2: Iteration: 1600 / 2000 [ 80%] (Sampling) #> Chain 2: Iteration: 1800 / 2000 [ 90%] (Sampling) #> Chain 2: Iteration: 2000 / 2000 [100%] (Sampling) #> Chain 2: #> Chain 2: Elapsed Time: 0.060613 seconds (Warm-up) #> Chain 2: 0.055559 seconds (Sampling) #> Chain 2: 0.116172 seconds (Total) #> Chain 2: #> #> SAMPLING FOR MODEL 'BebopInPeps2' NOW (CHAIN 3). #> Chain 3: #> Chain 3: Gradient evaluation took 1.2e-05 seconds #> Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0.12 seconds. #> Chain 3: Adjust your expectations accordingly! #> Chain 3: #> Chain 3: #> Chain 3: Iteration: 1 / 2000 [ 0%] (Warmup) #> Chain 3: Iteration: 200 / 2000 [ 10%] (Warmup) #> Chain 3: Iteration: 400 / 2000 [ 20%] (Warmup) #> Chain 3: Iteration: 600 / 2000 [ 30%] (Warmup) #> Chain 3: Iteration: 800 / 2000 [ 40%] (Warmup) #> Chain 3: Iteration: 1000 / 2000 [ 50%] (Warmup) #> Chain 3: Iteration: 1001 / 2000 [ 50%] (Sampling) #> Chain 3: Iteration: 1200 / 2000 [ 60%] (Sampling) #> Chain 3: Iteration: 1400 / 2000 [ 70%] (Sampling) #> Chain 3: Iteration: 1600 / 2000 [ 80%] (Sampling) #> Chain 3: Iteration: 1800 / 2000 [ 90%] (Sampling) #> Chain 3: Iteration: 2000 / 2000 [100%] (Sampling) #> Chain 3: #> Chain 3: Elapsed Time: 0.064461 seconds (Warm-up) #> Chain 3: 0.058734 seconds (Sampling) #> Chain 3: 0.123195 seconds (Total) #> Chain 3: #> #> SAMPLING FOR MODEL 'BebopInPeps2' NOW (CHAIN 4). #> Chain 4: #> Chain 4: Gradient evaluation took 1.2e-05 seconds #> Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 0.12 seconds. #> Chain 4: Adjust your expectations accordingly! #> Chain 4: #> Chain 4: #> Chain 4: Iteration: 1 / 2000 [ 0%] (Warmup) #> Chain 4: Iteration: 200 / 2000 [ 10%] (Warmup) #> Chain 4: Iteration: 400 / 2000 [ 20%] (Warmup) #> Chain 4: Iteration: 600 / 2000 [ 30%] (Warmup) #> Chain 4: Iteration: 800 / 2000 [ 40%] (Warmup) #> Chain 4: Iteration: 1000 / 2000 [ 50%] (Warmup) #> Chain 4: Iteration: 1001 / 2000 [ 50%] (Sampling) #> Chain 4: Iteration: 1200 / 2000 [ 60%] (Sampling) #> Chain 4: Iteration: 1400 / 2000 [ 70%] (Sampling) #> Chain 4: Iteration: 1600 / 2000 [ 80%] (Sampling) #> Chain 4: Iteration: 1800 / 2000 [ 90%] (Sampling) #> Chain 4: Iteration: 2000 / 2000 [100%] (Sampling) #> Chain 4: #> Chain 4: Elapsed Time: 0.06245 seconds (Warm-up) #> Chain 4: 0.05655 seconds (Sampling) #> Chain 4: 0.119 seconds (Total) #> Chain 4:decision <- peps2_process(fit) decision$Accept#> [1] FALSE FALSE FALSE FALSE FALSE FALSEdecision$ProbEff#> [1] 0.4600691 0.1285211 0.1780199 0.4821025 0.1391304 0.2067594decision$ProbAccEff#> [1] 0.94025 0.34400 0.57275 0.91450 0.38475 0.60950