Parse a string of phase I dose-finding outcomes to a binary vector notation necessary for model invocation.

The outcome string describes the doses given, outcomes observed and groups patients into cohorts. The format of the string is described in Brock (2019), and that itself is the phase I analogue of the similar idea described in Brock et al. (2017). See Examples.

The letters T and N are used to represents patients that experienced (T)oxicity and (N)o toxicity. These letters are concatenated after numerical dose-levels to convey the outcomes of cohorts of patients. For instance, 2NNT represents a cohort of three patients that were treated at dose-level 2, one of whom experienced toxicity, and two that did not. The results of cohorts are separated by spaces. Thus, 2NNT 1NN extends our previous example, where the next cohort of two were treated at dose-level 1 and neither experienced toxicity. See examples.

parse_phase1_outcomes(outcomes, as_list = TRUE)

Arguments

outcomes

character string, conveying doses given and outcomes observed.

as_list

TRUE (the default) to return a list; FALSE to return a data.frame

Value

If as_list == TRUE, a list with elements tox, doses and num_patients. If as_list == FALSE, a data.frame with columns tox and doses.

References

Brock, K. (2019). trialr: Bayesian Clinical Trial Designs in R and Stan. arXiv:1907.00161 [stat.CO]

Brock, K., Billingham, L., Copland, M., Siddique, S., Sirovica, M., & Yap, C. (2017). Implementing the EffTox dose-finding design in the Matchpoint trial. BMC Medical Research Methodology, 17(1), 112. https://doi.org/10.1186/s12874-017-0381-x

Examples

x = parse_phase1_outcomes('1NNN 2NTN 3TTT')
# Three cohorts of three patients. The first cohort was treated at dose 1 and
# none had toxicity. The second cohort was treated at dose 2 and one of the
# three had toxicity. Finally, cohort three was treated at dose 3 and all
# patients had toxicity.
x$num_patients  # 9
#> [1] 9
x$doses         # c(1, 1, 1, 2, 2, 2, 3, 3, 3)
#> NULL
x$tox           # c(0, 0, 0, 0, 1, 0, 1, 1, 1)
#> [1] 0 0 0 0 1 0 1 1 1
sum(x$tox)      # 4
#> [1] 4

# The same information can be parsed to a data-frame:
y = parse_phase1_outcomes('1NNN 2NTN 3TTT', as_list = FALSE)
y
#> # A tibble: 9 × 4
#>   cohort patient  dose   tox
#>    <int>   <int> <int> <int>
#> 1      1       1     1     0
#> 2      1       2     1     0
#> 3      1       3     1     0
#> 4      2       4     2     0
#> 5      2       5     2     1
#> 6      2       6     2     0
#> 7      3       7     3     1
#> 8      3       8     3     1
#> 9      3       9     3     1