# Example 1: Basic scoring utility calculation
# Scenario: Acute leukemia treatment with curative intent
# Dose-response probabilities
toxicity_probs <- c(0.10, 0.25, 0.40, 0.55, 0.70)
efficacy_probs <- c(0.20, 0.45, 0.65, 0.80, 0.85)
# Curative intent scoring: ineffectiveness penalized, mixed outcome acceptable
psi_safe_ineffective <- 35 # Low score for missing cure opportunity
psi_toxic_effective <- 75 # High score for achieving cure despite toxicity
utilities <- utility.scoring(
probt = toxicity_probs, probe = efficacy_probs,
psi00 = psi_safe_ineffective, psi11 = psi_toxic_effective
)
# Display outcome probability breakdown
results <- data.frame(
Dose = 1:5,
P_Tox = toxicity_probs,
P_Eff = efficacy_probs,
P_Safe_Ineffective = round((1-toxicity_probs) * (1-efficacy_probs), 3),
P_Safe_Effective = round((1-toxicity_probs) * efficacy_probs, 3),
P_Toxic_Ineffective = round(toxicity_probs * (1-efficacy_probs), 3),
P_Toxic_Effective = round(toxicity_probs * efficacy_probs, 3),
Expected_Utility = round(utilities, 1)
)
print(results)
# Optimal dose selection
optimal_dose <- which.max(utilities)
cat("\\nOptimal dose for curative intent:", optimal_dose,
"with utility:", round(max(utilities), 1), "\\n")
Run the code above in your browser using DataLab