`R/trialr_nbg_selector.R`

`get_trialr_nbg.Rd`

This function returns an object that can be used to fit a Neuenschwander, Branson and Gsponer (NBG) model for dose-finding using methods provided by the trialr package.

```
get_trialr_nbg(
parent_selector_factory = NULL,
real_doses,
d_star,
target,
alpha_mean,
alpha_sd,
beta_mean,
beta_sd,
tite = FALSE,
...
)
```

- parent_selector_factory
optional object of type

`selector_factory`

that is in charge of dose selection before this class gets involved. Leave as NULL to just use this model from the start.- real_doses
Doses under investigation, a non-decreasing vector of numbers.

- d_star
Numeric, reference dose for calculating the covariate

`log(dose / d_star)`

when fitting the model. Sometimes (but not always) taken to be the max dose in real_doses.- target
We seek a dose with this probability of toxicity.

- alpha_mean
Prior mean of intercept variable for normal prior. See Details. Also see documentation for trialr package for further details.

- alpha_sd
Prior standard deviation of intercept variable for normal prior. See Details. Also see documentation for trialr package for further details.

- beta_mean
Prior mean of gradient variable for normal prior. See Details. Also see documentation for trialr package for further details.

- beta_sd
Prior standard deviation of slope variable for normal prior. See Details. Also see documentation for trialr package for further details.

- tite
FALSE to use regular model; TRUE to use TITE version See Description.

- ...
Extra args are passed to

`stan_nbg`

.

an object of type `selector_factory`

that can fit the
NBG model to outcomes.

The model form implemented in trialr is:

\(F(x_{i}, \alpha, \beta) = 1 / (1 + \exp{-(\alpha + \exp{(\beta)} log(x_i / d_*))}) \)

with normal priors on alpha and beta.

Dose selectors are designed to be daisy-chained together to achieve different
behaviours. This class is a **resumptive** selector, meaning it carries on
when the previous dose selector, where present, has elected not to continue.
For example, this allows instances of this class to be preceded by a selector
that follows a fixed path in an initial escalation plan, such as that
provided by `follow_path`

. In this example, when the observed
trial outcomes deviate from that initial plan, the selector following the
fixed path elects not to continue and responsibility passes to this class.
See examples under `get_dfcrm`

.

A time-to-event variant, like TITE-CRM, is used when you specify
`tite = TRUE`

. This weights the observations to allow dose-selections
based on partially observed outcomes.

Neuenschwander, B., Branson, M., & Gsponer, T. (2008). Critical aspects of the Bayesian approach to phase I cancer trials. Statistics in Medicine, 27, 2420–2439. https://doi.org/10.1002/sim.3230

Brock, K. (2020). trialr: Clinical Trial Designs in 'rstan'. R package version 0.1.5. https://github.com/brockk/trialr

Brock, K. (2019). trialr: Bayesian Clinical Trial Designs in R and Stan. arXiv preprint arXiv:1907.00161.

```
real_doses <- c(5, 10, 25, 40, 60)
d_star <- 60
target <- 0.25
model <- get_trialr_nbg(real_doses = real_doses, d_star = d_star,
target = target,
alpha_mean = 2, alpha_sd = 1,
beta_mean = 0.5, beta_sd = 1)
# Refer to the trialr documentation for more details on model & priors.
outcomes <- '1NNN 2NTN'
fit <- model %>% fit(outcomes)
fit %>% recommended_dose()
#> [1] 2
fit %>% mean_prob_tox()
#> [1] 0.1247287 0.2536382 0.5640881 0.7266730 0.8269195
```