## How does the Logarithmic Market Scoring Rule (LMSR) work?

#### The Ultimate Guide to Crowdsourced Forecasting

In our article "What are the different types of prediction markets?," we discussed the difference between prediction markets that use a continuous double auction and those that use a market scoring rule. Market scoring rules are used to compute the current price of a stock in a prediction market. Consequently, a market scoring rule also is used to compute the cost of a trade between a trader and the market maker (which is typically just a software platform that acts as the "house," taking the other side of a trade).

## Computing a Stock Price

One of the most commonly used market scoring rules is known as the Logarithmic Market Scoring Rule (LMSR), which was invented by Robin Hanson. The current price for a stock (in a market with 2 stocks) using LMSR is calculated with the formula:

`price = e^(q1/b) / (e^(q1/b)+e^(q2/b))`

In this formula, b is an arbitrary constant, q1 is the number of outstanding shares in the stock for which you're calculating the price, and q2 is the number of outstanding shares in the other stock.

This formula can be extended to markets with more than 2 stocks. For a 3 stock market, the equation would be:

`price = e^(q1/b) / (e^(q1/b)+e^(q2/b)+e^(q3/b))`

For an example calculation, say we have a market with three stocks, where there are 10 shares of stock 1 outstanding, 20 shares of stock 2, and 23 shares of stock 3. If we use 10 as the value for b, then the calculation for the price of stock 1 would be:

```price = e^(10/10) / (e^(10/10)+e^(20/10)+e^(23/10)) = 0.1354```

So in our example, we'd quote stock 1 at \$13.53/share.

In addition to quoting current stock prices, we also need to be able to determine the cost of a given trade. When using LMSR, this can be done with the cost function:

`cost = b * ln(e^(q1/b) + e^(q2/b))`

In order to determine the cost of a given trade, we need to compute the cost before the trade and the cost after the trade. The difference between these two is the amount that a trader must pay to acquire the shares. Extending our example above, let's say a trader wants to purchase 7 shares of stock 1. The cost before the trade would be:

`cost = 10 * ln(e^(10/10) + e^(20/10) + e^(23/10)) = 29.998`

And the cost after the trade would be:

`cost = 10 * ln(e^(17/10) + e^(20/10) + e^(23/10)) = 31.284`

And the cost of the trade is difference between the two: 31.284 - 29.998 = 1.286. Within Cultivate Forecasts, we multiply this by 100 to make the numbers a bit more fun and appealing (trading \$128.60 is obviously much more fun than \$1.286).

## Choosing the B Value

As mentioned above, the variable b in the LMSR equation is just an arbitrary constant. While arbitrary, its value can have important effects within the market. With a small value for b, the prices will change much more rapidly (ie. purchasing a small number of shares increase the price a lot). Conversely, a large value for b will make the prices feel more "sticky," requiring a large number of shares to change the price significantly.

Choosing a good value for b is largely dependent on the nature of the market. For small markets where there is likely to be less trading activity, a smaller b value is typically desirable. This will allow the prices (and corresponding probabilities) to change relatively easily to match real world probabilities. If you use a large b value for a small market, prices can get out of line, since traders may not have enough currency to move the price to match the underlying real-world probabilities. For large markets with a large number of traders, the opposite is typically true -- a large value of b tends to be preferable.

Go back to The Ultimate Guide to Prediction Markets