A (perhaps rather cynical) performance measure for lawyers is the percentage of cases he or she has won. Let's say a person is looking for a lawyer to defend his case and would like to choose the one with the highest performance. There are three lawyers in the area who are knowledgeable in the field and their past performances are displayed in the table below. Assuming that each lawyer's cases were random samples from the same population of cases (so we can assume a Binomial process) since all three lawyers work in the same field, whom should the person choose as his lawyer?

Lawyer | Number of trials done | Number of trials won | % of trials won |

"Gary" | 230 | 215 | 93.5% |

"Jon" | 34 | 32 | 94.1% |

"Frank" | 17 | 16 | 94.1% |

#### Answer

The first step is to determine the probability r each lawyer would win a random case. We assume a binomial process for the trials which is probably reasonable if each trial's result is unrelated to any other trial, but will not be entirely correct if random effects change the probability for *all* trials, in which case it would be a mixture process. Given the binomial assumption, the number of trials n and the number of successes s allow us to estimate the probability p as Beta(s+1,n-s+1,1, using the Bayesian estimate with an uninformed prior (the technique is exactly the same if you use a classically derived uncertainty distribution for r).

A Beta distribution estimate of r is constructed for each lawyer. The three distributions are plotted below:

The density plot on the left shows that there is considerable overlap between the three distributions, which means that we cannot know for sure which lawyer is the best, although the cumulative plot shows that 'Gary' is second order stochastic dominant and should therefore be preferred by the defendant. This may well be sufficient for the defendant's needs, but with simulation we can also describe how *confident* we are that 'Gary' is actually better than the other two...

The model Lawyers provides the confidence we should have that each lawyer is the best. A random sample from these distributions represent possible true performance rates (probability of success): if a value for 'Gary' is greater than for the other two lawyers in an iteration, then this scenario gives 'Gary' as being the better lawyer.

**Numerical integration**

This model is an example of Numerical Integration: a broad technique that has many applications in risk analysis. The confidence value we are looking for is, in words, the confidence of rate(Gary)=x AND rate(Jon)<x AND rate(Frank)<x, summed over all value of x. In equation terms this is:

p(r_{Gary}=max)=\int\limits_0^1 p_{rGary}(x) F_{rJon}(x) F_{rFrank}(x)dx |

where f(x) is the Beta pdf and F(x) is the Beta cdf.

There is also a more efficient approach to the above method which is described separately in the software specific model sections. If you run a simulation you will see the results from both approaches are the same. However, the second approach is more efficient: meaning that it reaches the required value with a specified tolerance with fewer iterations than the original approach.

#### Exercise

Try repeating the exercise using a classical statistic estimate of the "lawyers" rates. The answers will be a little different: why? How would you present the results to the client (the defendant)?

The links to the Lawyers software specific models are provided here: