This functions calculates the expected utilities of each action or decision corresponding to a given utility matrix. The long-run probable utilities are also calculated.
Arguments
- u
a utility matrix given as a
base::matrix()or as abase::data.frame()(internally converted into a matrix). Each row of the matrix corresponds to a possible action; each row to an uncertain outcome \(Y\). The number of columns must be equal to the number of \(Y\)-values of the "prova_pr" (probability) object of argumentp.- p
A "prova_pr" (probability) object, obtained from
Pr(). The number of \(Y\)-values of this object must be equal to the number of columens of the utility matrix of argumentum.
Value
A list of the following elements:
'value': a matrix of the expected utilities of the actions. One row for each action, one column for each value of the conditional \(X\) in the probabilityp.'samples': an array of samples of the expeceted utilities that the actions would have, if many more sample data were available. The first dimension corresponds to the actions, the second to the values of the conditional \(X\), and the third the sample index.'value.acc': numerical accuracies of'value'elements.'optimal': list of actions having maximal expected utility, one list element per column ofp(that is, its conditional valuesX). If there are ties, all actions in the tie are reported.'optimal.samples': matrix with the probabilities that each action would be chosen as the optimal one, if more data were available. One row for each action, one column for each column ofp(that is, its conditional valuesX).'optimal.samples': matrix of samples of actions having maximal expected utility, if many more sample data were available. Each row correspond to a column ofp(that is, its conditional valuesX); each column is a sample. In case of ties, one action is unsystematically selected viabase::sample().'X','tails','K': copies of the homonymous values from the probability objectp.
References
Raiffa (1970): Decision Analysis: Introductory Lectures on Choices under Uncertainty, Addison-Wesley https://archive.org/details/decisionanalysis00raif.
North (1968): A Tutorial Introduction to Decision Theory doi:10.1109/TSSC.1968.300114.
Lindley (1988): Making Decisions, Wiley https://www.wiley.com/Making+Decisions%2C+2nd+Edition-p-x000008175.
Fenton, Neil (2019): Risk Assessment and Decision Analysis with Bayesian Networks, CRC doi:10.1201/b21982
Sox, Higgins, Owens, Schmidler (2024): Medical Decision Making, Wiley doi:10.1002/9781119627876.
Lusted (1968): Introduction to Medical Decision Making, Thomas (Springfield, USA).
See also
Pr() to calculate joint and conditional probabilities.
Examples
## Use the example "prova_K" (knowledge) object 'Kexample'
## calculated from the "penguins" dataset;
## variates: 'species' and 'bill_len'
## define a utility matrix with four actions,
## and outcomes depending on the variate 'species'
umatrix <- matrix(c(
1.80, 0.42, 1.60, -0.12, -1.10, 0.20, -0.51, 0.35, -0.49, 0.35, -0.48, 0.62
), nrow = 4, ncol = 3, dimnames = list(actions = paste0('A', 1:4), NULL))
print(umatrix)
#>
#> actions [,1] [,2] [,3]
#> A1 1.80 -1.10 -0.49
#> A2 0.42 0.20 0.35
#> A3 1.60 -0.51 -0.48
#> A4 -0.12 0.35 0.62
## Calculate the probability of the 'species outcomes
probs <- Pr(data.frame(species = c('Adelie', 'Chinstrap', 'Gentoo')),
Kexample)
## Calculate the expected utilities of the actions
eu <- exputility(umatrix, probs)
eu$value
#>
#> actions [,1]
#> A1 0.3981347
#> A2 0.3510855
#> A3 0.4306723
#> A4 0.2403208
## optimal action:
eu$optimal
#> [[1]]
#> [1] "A3"
#>
## Probabilities for the actions to be judged as optimal
## if many more sample data were available
eu$optimal.probs
#>
#> actions [,1]
#> A1 0.01333333
#> A2 0.05777778
#> A3 0.92888889
#> A4 0.00000000