This calculator implements a random utility model. The model takes a single-parameter, user-defined utility function and a user-defined distribution for that parameter. The code calculates the probability of choosing each gamble, assuming that a utility function parameter is drawn at random from the distribution.
The example R code implements the model for a simple example choice. Pressing "run" submits the code to R and generates predictions, or you can edit the code for your own choices. Predictions appear at the bottom of the output page, and give the probability of selecting each gamble in each choice.
Full source code for the model is available, with an application to the Kahneman and Tversky (1979) choices.