Skip to contents

Applies a utility function to the value matrix V. If no function is supplied, values are passed through unchanged (linear / risk-neutral case).

Usage

transform_to_utility(voi, utility_func = NULL, ...)

Arguments

voi

A voi_problem object.

utility_func

A function f(v, ...) that maps values to utilities. If NULL, identity is used.

...

Additional arguments passed to utility_func.

Value

The voi_problem object with a U field added.

Examples

V <- matrix(c(55, 135, 100, 100), nrow = 2, byrow = TRUE)
p <- c(0.5, 0.5)
rp  <- risk_preference("CRRA", param = 1, val_min = 0, val_max = 200,
                       outcome_name = "frogs", maximize = TRUE)
fns <- use_risk_preference(rp)
voi_problem(V, p) |> transform_to_utility(fns$utility)
#> ℹ VOI problem: 2 actions, 2 states, 2 experiment outcomes.
#> ℹ Utility: values mapped through utility function.
#> 
#> ── VOI Problem ──
#> 
#> • Actions: 2
#> • States: 2
#> • Experiment outcomes: 2