toxicity_probs <- c(0.05, 0.15, 0.25, 0.40, 0.55)
efficacy_probs <- c(0.10, 0.25, 0.45, 0.60, 0.65)
# Clinical thresholds based on disease context
tox_low <- 0.10 # Below 10% toxicity: minimal concern
tox_upp <- 0.45 # Above 45% toxicity: major concern
eff_low <- 0.15 # Below 15% efficacy: clinically negligible
eff_upp <- 0.55 # Above 55% efficacy: highly satisfactory
utilities <- utility.truncated.linear(
probt = toxicity_probs, probe = efficacy_probs,
tlow = tox_low, tupp = tox_upp,
elow = eff_low, eupp = eff_upp
)
# Display results with transformations
results <- data.frame(
Dose = 1:5,
Toxicity = toxicity_probs,
Efficacy = efficacy_probs,
Tox_Transform = ifelse(toxicity_probs <= tox_low, 1,
ifelse(toxicity_probs >= tox_upp, 0,
1 - (toxicity_probs - tox_low)/(tox_upp - tox_low))),
Eff_Transform = ifelse(efficacy_probs <= eff_low, 0,
ifelse(efficacy_probs >= eff_upp, 1,
(efficacy_probs - eff_low)/(eff_upp - eff_low))),
Utility = round(utilities, 3)
)
print(results)
# Optimal dose selection
optimal_dose <- which.max(utilities)
cat("\\nOptimal dose:", optimal_dose, "with utility:",
round(max(utilities), 3), "\\n")
Run the code above in your browser using DataLab