# \donttest{
# Generate some single-arm toy data.
n <- 1500
K <- 1
reward <- matrix(1 + runif(n * K), n, K)
scores <- reward + 5 * matrix(rnorm(n * K), n, K)
cost <- 1
# Fit a Qini curve.
qini <- maq(reward, cost, scores, R = 200)
# Plot the policy values as we vary the fraction treated.
plot(qini, xlab = "Fraction treated")
# Plot the policy values for a maximum allocation of, for example, 500 units.
plot(scale_maq(qini, 500), xlab = "Units treated")
# With R 4.1.0 or later, the native pipe can be used to chain scaling and plotting.
# scale_maq(qini, 500) |>
# plot(xlab = "Units treated")
# }
Run the code above in your browser using DataLab