calc_utility | R Documentation |
Calculate expected utility function = 1 - E[lower loss] - E[upper loss]
calc_utility(dose_info$X_d[1], dose_info$Y_d[1], dose_info$Z_d[1], num_samples = 1e4)
a |
Futility count |
b |
Efficacy count |
c |
Toxicity count |
num_samples |
Number of times to sample Dirichlet(a,b,c) distribution. The higher this number, the more precise the estimate (default = 1e4). |
The observed pf and pt values are only one instantiation of the Dirichlet(a,b,c) distribution. In this function we simulate many draws from this distribution and calculate expected losses by averaging loss over all drawn toxicity and futility probabilities, and then derive the Utility value for that dose level. In other words, this calculation is mathematically equivalent to finding the lower and upper utility values for every sample, and then taking Utility = 1 - mean(all toxicity losses) - mean(all futility losses).
Note that the bottleneck of this function is num_samples
– the higher this value is, the slower the overall simulation performance. Between 1e4 and 1e6 is a reasonable range.
The calculated utility value (numeric)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.