Computing Rank Dependent Utility in R

[This article was first published on R – Jacob Smith Economics, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Probability weighting without rules can make no sense. Fortunately we have some guidance.

Introduction: What is Rank Dependent Utility?

Rank dependent utility theory made its debut in John Quiggin’s 1982 paper “A Theory of Anticipated Utility” with the mission, similar to other papers at the time, to come up with a model which addressed the Allais Paradox which was a major problem for expected utility theory. what all prior attempts had in common was replacing probabilities of specific outcomes occuring with “decision weights” or “weighted probabilities” which expressed how individuals use information regarding the probability of outcomes occuring. What made this attempt different was the fact that Quiggin came up with a formulation which required these decision weights to add up to one and preserve dominance (something which usually is not preserved in usual probability weighting).

To illustrate the problem with usual probability weighting suppose an individual faces the choice between being given a dollar with certainty and facing a 50-50 gamble between winning one dollar or two dollars. If our individual weights their probabilities according to the function w(p)=p^2 we end up with a scenario where:


While the math checks out, the decision is ridiculous as the gamble is clearly better than just getting dollar with certainty. To rule out these cases, we need to put some rules on how they are computed. The steps for computing rank dependent utility is given in Peter Wakker’s 2010 text “Prospect Theory: For Risk and Ambiguity” .

Building RDU_Compute()

While there is likely a more efficient code for generating a function which computes rank dependent utility, I have come up with the following to compute these the rank dependent utility of a gamble.


#Step 0 organize outcomes and probabilities into a single vector

#Step 1 Organize Probabilities by outcome, inserting a row of zeros in your data frame.

#Step 2  Define vector of ranks

#Step 3 compute pweights

#Step 4 Take difference between pw_vec to compute decision weights
#Check if weights sum to 1
#Add to dataframe

#Step 5: Compute Rank Dependent Utility
return(data.frame(RDU,sum(d_weights1)))} else{
  print("Outcomes and vector of probabilities must be the same length")

It should be noted:

  • RDU_Compute() requires a list of outcomes or payoffs, list of probabilities and probability weighting function (denoted by pw in the code).
  • The number of probabilities and outcomes must be the same, if not an error message will show.
  • The function is designed in a way to display two outputs, the first being the computed rank dependent utility of the gamble and if the sum of decision weights add up to 1. while this is satisfied in most cases, there are circumstances where you can break it as we will see below.

A Computed Example

Considering the rank dependent utility with a prospect that has four different outcomes we get the following:



    RDU sum.d_weights1.
1 1.091               1

Further its simple to illustrate how we can solve the initial issue of dominance. When valuing a 50-50 gamble between one dollar and two dollars we get:



   RDU sum.d_weights1.
1 1.25               1

Probability Weighting Functions that Break Rank Dependent Utility

For reasons that are not entirely clear to me (at the time of writing this article) we can easily violate this condition of having our decision weights summing to one. To illustrate consider the case of where w(p)=p^2+0.01*p, this gives us the following:



    RDU sum.d_weights1.
1 1.265            1.01

There must be some structure required of these probability weighting functions, but at this time I cant quite figure it out. If you know anything on this be sure to let me know in the comments below!

To leave a comment for the author, please follow the link and comment on their blog: R – Jacob Smith Economics. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)