Monday, March 29, 2021

Why we have runs on toilet paper

The great toilet paper shortage of 2020 and 2021 (?)

To properly understand the toilet paper shortage of 2020, we have to know what really changed at the start of the pandemic and understand a little of 'irrational' consumer behavior. Press stories at the time focused on panic buying but missed key parts of the bigger picture.

(No toilet paper in the supermarket. Image source: Wikimedia Commons, License: Creative Commons, Author: D.D.Teoli Jr)

Rolling forward to 2021, the grounding of the Ever Given has led to press reports suggesting new toilet paper shortages, but the press has written very little on why there might be a shortage and what parts of the world might be affected. As a sneak peek: it isn't just the stuck ship that might cause a shortfall.

Where we use toilet paper (not the obvious place) and why it matters

Let's imagine you're a typical worker. You leave for the office or factory at 8 am, you get in for 9 am, leave at 5 pm, and get home at 6 pm. Of course, you use the restrooms at the office and you use the toilet paper there. 

(It used to be the office restroom... Image source: Wikimedia Commons, Licence: Creative Commons, Author: Chris Light)

Let's imagine you go out for a meal or a drink once a week. You might use the restrooms at the restaurant or pub. Similarly, if you go to a sporting event or a concert. You get the picture.

Prior to the pandemic, you probably spent something like 55+ hours a week doing things outside the home. Post pandemic, you spend that time at home. Right now, you're using your bathroom a lot more and other bathrooms a lot less.

(...now, you spend your time at home. Image source: Wikimedia Commons, Licence: Creative Commons, Author: Infrogmation of New Orleans)

Commercial toilet paper is different from home toilet paper: the rolls are a lot bigger, as is the size of the hole, and the paper itself is more utilitarian. You can't just put a roll of toilet paper from the office into your home toilet paper holder.

In early 2020, pretty much overnight and across the world, demand for one type of toilet paper (commercial) went down substantially and demand for the other type of toilet paper (consumer) went up substantially. Bear in mind, toilet paper manufacturers have production lines for commercial and consumer paper, it takes time to slow down production on one line and ramp it up on another.

To put it simply, the overnight change in human behavior was a shock to the toilet paper supply chain. There wasn't enough of the right paper and there was too much of the wrong paper.

(See https://marker.medium.com/what-everyones-getting-wrong-about-the-toilet-paper-shortage-c812e1358fe0 for more details.)

Just-in-time delivery and manufacturing

Because of its proven financial advantages, for decades manufacturers have used just-in-time production. This applies to toiler paper too. Under normal conditions, the demand for toilet paper stays more or less the same (what would cause a sudden increase or decrease in demand?), which makes it an ideal industry for supply-chain optimization. Why pay to store toilet paper in warehouses when you can just ship it to retailers? After all, if demand is static, by optimizing logistics you can reduce costs.

The side effect of just-in-time manufacturing is reducing the amount of slack in the system. There are no giant toilet paper warehouses to cushion demand shocks (why should there be demand shocks?). This means the system has limited resilience to large swings in demand.

(See these sites for more information:

Runs on the bank

The closest analogy to the toiler paper panic of 2020 is a run on a bank.

Banks maintain a minimum amount of cash to serve the needs of their customers. They minimize cash because it earns no interest; far better to have money invested earning interest than not. Under normal circumstances, this works just fine, it's a model built on confidence.

In a bank run, the bank's customers come to believe the bank will go bankrupt and they'll lose their money, so they withdraw money from the bank as cash (or the equivalent). This rapidly depletes the bank's cash holdings. As a run starts, more and more customers may become convinced the bank is going under, not because the bank is fundamentally insolvent, but because the run will make it so. In other words, I need to get my money out because other people removing their money means there won't be any left for me.

What starts as a relatively minor problem can rapidly expand into a full-blown rout. Even a solvent bank can go under during a run.

(Run on the Norther Rock bank 2007 - which was nationalized to avoid failure. Image source: Wikimedia Commons, License: Creative Commons, Author: Lee Jordan)

There are several ways for banks and governments to stop bank runs:

  • closing banks temporarily (letting consumer rationality return)
  • guaranteeing banks (which has included nationalization)
  • imposing limits on withdrawals (rationing)
  • charging customers fees to withdraw money (pricing)

All of these actions require intervention into the free market.

(See these sites for more details:

What happened in 2020

The pandemic caused large numbers of workers to immediately work from home, increasing demand for home products, including of course toilet paper. This led to an oversupply of commercial toilet paper and an undersupply of consumer toilet paper.

As supplies decreased, consumers became concerned about future supplies and we had a classic run on the bank, or in this case, a run on toilet paper. 

Because the toilet paper supply chain is optimized, there is no slack in the system, so the demand went immediately to the manufacturers, who couldn't ramp up production fast enough. 

Panic buying was only stopped when supermarkets introduced rationing. 

(I need more toilet paper. Image source: Wikimedia Commons, License: Creative Commons, Author: Mwinog2777)

There were alternatives to rationing. The most obvious is to use the laws of supply and demand, in other words, increasing the price of toilet paper, which also happened. Interestingly, some authors suggested a form of 'nationalization' of toilet paper, which would have had the paper suppliers working together to produce unbranded toilet paper to meet demand.

As the supply chain settled down from the shock, supplies came back to normal levels.

To understand what might happen to toilet paper in 2021, we have to understand the toilet paper supply chain and the global shipping industry.

(See these sites for more details:

The toilet paper supply chain

Bear in mind, toilet paper is a bulky, low-cost, low-margin item. Economics dictate it's made as close as possible to where it's consumed. Here's a simplified view of the supply chain:

  • Forestry
  • Pulp production
  • Toilet roll manufacture
  • (Optional) wholesale
  • Retailers

Sometimes, pulp production is in the same facility as the manufacture of toilet paper, but sometimes not. In some cases, pulp is shipped from country to country, for example, Suzano ships wood pulp from Brazil to paper production facilities in Europe and Asia. Of course, shipping requires ships and shipping containers.

(See for example:

What containers have to do with anything - what could happen in 2021

Toilet paper consumed in the Americas is largely created in the Americas. North and Soth America have large forests and have paper processing plants, they also have extensive road and rail networks which reduce the need for transporting raw materials or the finished product by ship. Europe and Asia import wood pulp from South America and other places to manufacture paper, some of which travels via ships.

The pandemic has led to shipping container costs going through the roof. The chart below comes from Fitch Ratings who provide data on shipping prices worldwide. It's a pricing index based on the cost of renting a 40-ft shipping container for different shipping routes. It shows costs have shot up enormously for certain routes in 2021. COVID has disrupted the global supply chain, including disrupting port operations, which means containers are spending more time in ports and less time on the sea. In turn, the price of anything that comes via ship is going to go up, including toiler paper wood pulp.

(Container shipping prices. The chart is taken from Fitch Ratings who provide shipping data.)

As far as I can figure out, the volume of toilet paper shipped through the Suez Canal is minimal. Of itself, the Ever Given shouldn't cause interruptions to the toilet paper supply chain. But the traffic jam is tying up shipping containers and ships and may put upward pressure on shipping prices.

If you live in the Americas, probably nothing much changes with toilet paper. If you live in Europe or Asia, there's the potential for disruption and price increases. Will there be shortages again? Only if we have another run on toilet paper - and hopefully retailers will impose rationing more quickly this time.

(See for example:

What does this mean?

Toilet paper production is a triumph of modern supply chain management and just-in-time manufacturing. The whole system works like clockwork and delivers significant savings for consumers. But an optimized system is more vulnerable to external shocks because it has limited capacity to recover - there's no slack in the system. Consumer panic buying makes the situation worse and can turn a small blip in supply into a full-blown shortage - with the only mechanisms to solve the problem being rationing or other interventions in the free market.

Medicated toilet paper - a peculiarly British obsession

I can't leave this discussion of toilet paper without mentioning something very weird and very British. When I grew up in the UK, schools and government buildings had a very particular kind of toilet paper. The brand name was Izal and it was stiff and coated with coal tar. The coal tar made it "medicated" and it was advertised as protecting against disease (what the diseases were was never stated). The joke was, it was John Wayne toilet paper, it was rough, tough, and took no... well, you know what I mean.

Why this ever became a thing mystifies me.

The company behind it was Newton, Chambers & Co. Originally, they gave it away to government offices and schools, possibly as an attempt to build a market. Later on, Newton sold it as a product in its own right and they were very successful. Advertising rules were laxer in the past, so they gleefully promoted its supposed health benefits. For a long time, schools and government buildings provided this type of toiler paper, and even some businesses used it. From personal experience, I can tell you using it was unpleasant.

My first job was at a retailer called Superdrug who sold toilet paper (among many other things). As the new boy, my responsibility was the toiler paper section (yes, literally starting at the bottom). I would stack the shelves with all brands of toilet paper and I used to know the price of every brand.  Astonishingly, Izal was a good seller and it was priced above most other brands. In other words, the most uncomfortable and least effective toilet paper on the market sold well and was more expensive than more pleasant and softer brands. Perhaps this should be a lesson about the complexities of the consumer retail market.

Izal (and its competitor, Bronco) are no longer around. People who liked firm toiler paper were gradually persuaded that softer was better, and I agree with them. You can still find Izal on eBay though - I guess people are selling rolls they found in the attic. 

Perhaps the biggest lesson here is that even something as mundane as toilet paper can reveal a great deal about markets and the modern world.

(See:

Tuesday, March 23, 2021

Know your rights: assignment of rights

Why assignment of rights matters

Let's imagine you're running a company that sells products or services to other companies (B2B). A big company wants to acquire you. They do their due diligence on your contracts to make sure they know what they're buying. They want all your contracts (customers) as part of the deal. What could possibly go wrong?

What could go very wrong is your contract terms, especially something called assignment of rights. In this blog post, I'm going to tell you what it is and what you should consider doing.

(Image source: Wikimedia Commons, License: Public Domain)

Obligatory disclosure

I am not a lawyer. Don't take legal advice from me. The goal of this blog entry is to inform you of a contractual term that's important for your business. Go and speak to a lawyer to find out more.

Everything I'm writing about assumes common law. Common law countries are countries that derive their legal system from the UK, which include the US, Australia, Ireland, Canada, New Zealand, etc. If you're not in a common law country, this applies to you only so far as you do business with common law countries.

What is assignment of rights?

I'm going to simplify some things here. Let's say you're Company X and you're selling a product or service to Company Y. Who provides the service and who receives the money? In most cases, company X provides goods or services to Y and gets money from Y in return.  If something goes wrong, X and Y can sue each other. This is all very simple, and it's the basis of most contracts.

Let's look at two exceptions to this pattern:

  • Company X sub-contracts contract performance to another company, Company A. Company A could be a subsidiary of X or it could be an outsourcing company with no ownership relationship between X and A.
  • Company X is subsequently bought by Company B.

Some businesses have rules about who performs contract work; they won't allow outsourcing. In the contracts they write, they create a contract section, usually headed "Assignment of rights". This section says words to the effect of 'you can't assign the performance of this contract to another entity'. What this means is, Company X has to perform the contract, not some other legal entity.

If Company X is bought by Company B, in most cases, things are OK, but there can be exceptions that can badly hurt Company X. 

Most contracts have a section called something like "assignment of rights" that lays out the rules for who does the work and what happens in the case of a takeover.

What could go wrong?

Let's imagine the contract between X and Y states there can be no assignment of rights. X has to perform the contract.

Company X has a restructuring and wants to sell off a division to another company. Oops! It can sell off the division, but the contracts can't go with it. The new owners of the division will have to re-negotiate contracts, which could be disastrous. Customers now have the upper hand in any negotiation and can just say no. I can see some customers getting a nice discount to agree to the change.

What happens if Company X is bought? This is a change of control and could well invalidate the assignment of rights clause, depending on exactly how it's written. Customers could be within their contractual rights to terminate the contract because of a change of control. In the subsequent negotiation, they have the upper hand and could well demand a discount.

Here's another wrinkle. What if Company X is bought by a competitor to one of their customers? It's in the customers' interest to stop this from happening, so they should forbid it in the contract. In practice, this might mean specific language in the contract allowing termination in this case.

The final example is usually the simplest: bankruptcy. Most contracts have provisions that deal with the bankruptcy of one or both parties.

The consequences of not setting up assignment correctly

All the failure modes I'm talking about (and a lot more) are well-known. There's a reason why lawyers are experts. There are reasons why you need to have a lawyer review your contracts.

Let's say you wanted to buy Company X. One of the first things you would do in your due diligence is check out the contracts, especially the assignment of rights section. You're looking for language that allows the rights of the contract to be assigned to another entity (usually using terms like "successor entity", "change of control", etc.). A major problem is the existence of language that forbids the assignment of rights in a takeover or that requires permission from other parties. If this language exists, the acquisition costs go up and it may drive down the acquisition price.

In the case of a change of control (takeover), customers can suddenly get a windfall, they have an opportunity to negotiate their contracts downwards. To put it simply, Company X comes to them saying "we've been bought by Company B, we need to change our contract with you", customers can say, "we don't want to change, but we'll agree to it if you give us a 20% discount".

What should you do?

Go see a lawyer. Make sure a lawyer draws up your contract using standard contract templates. This is especially important if you think your company might be acquired.

In big deals, there's a back and forth on contract terms. In most cases, the bigger company gets the contract terms they want. In the excitement of the deal, sometimes companies agree to things they shouldn't. It's the end of the year, it's a marquee customer, and it's a huge deal that takes the sales team over quota. In a case like this, the temptation to agree is enormous. Don't do it, or at least, do it knowing the consequences.

In general, all contracts should be reviewed. You need to be very sure what your contracts say, and what an acquirer may find in due diligence.

Saturday, March 13, 2021

Forecasting the 2020 election: a retrospective

What I did  

One of my hobbies is forecasting US presidential elections using opinion poll data. The election is over and Joe Biden has been sworn in, so this seems like a good time to look back on what I got right and what I got wrong. 

I built a computer model that ingests state-level opinion poll data and outputs a state-level forecast of the election results. My model aggregates polling data, using the previous election results as a starting point. It's written in Python and you can get it from my Github page. The polling data comes from the ever-wonderful 538.
(This pole works, unlike some other polls. Image source: Wikimedia Commons, License: Creative Commons, Author: Daniel FR.)

What I got right

My final model correctly predicted the results of 49 out of 51 states (including Washington D.C.). 

What I got wrong

The two states my model got wrong were Florida and North Carolina, and these were big misses - beyond my confidence interval. The cause in both cases was polling data. In both states, the polls were consistently wrong and way overstated Biden's vote share. 

My model also overstated Biden's margin of victory in many of the states he won. This is hidden because my model forecast a Biden victory and Biden won, but in several cases, his margin of victory was less than my model predicted - and significantly so.

The cause of the problem was opinion polls overstating Biden's vote share.

The polling industry and 2020

The polling industry as a whole over-stated Biden's support by several percentage points across many states. This is disguised because they got most states directionally correct, but it's still a wide miss. 

In the aftermath of 2016, the industry did a self-examination and promised it would do better next time, but 2020 was still way off. The industry is going to do a retrospective to find out what went wrong in 2020.

I've read a number of explanations of polling misses in the press but their motivation is selling advertising, not getting to the root cause. Polling is hard and 2020 was very different from previous years; there was a pandemic and Donald Trump was a highly polarizing candidate. This led to a higher voter turnout and many, many more absentee ballots. If the cause was easy to find, we'd have found it by now.

The 2020 investigation needs to be thorough and credible, which means it will be several months at least before we hear anything. My best guess is, there will be an industry paper in six months, and several independent research papers starting in a few months. I'm looking forward to the analysis: I'm convinced I'm going to learn something new.

Where next?

There are lots of tweaks I could make to my model, but I'm not going to do any of them until the underlying polling data improves. In other words, I'm going to forget about it all for three years. In fact, I'd quite like to forget about politics for a while.

If you liked this post, you might like these ones

Monday, March 8, 2021

A masterclass in information visualization: the tube map

Going underground

The London Underground tube map is a master class in information visualization. It's been described in detail in many, many places, so I'm just going to give you a summary of why it's so special and what we can learn from it. Some of the lessons are about good visual design principles, some are about the limitations of design, but some of them are about wealth and poverty and the unintended consequences of abstraction.

(London Underground map.)

The problem

Starting in 1863, the underground train system in London grew in a haphazard fashion, with different railway companies building different lines and no sense of creating a coherent system. 

Despite the disorder, when it was first built it was viewed as a marvel and had a cultural impact beyond just transport; Conan Doyle wove it into Sherlock Holmes stories, H.G. Wells created science fiction involving it, and Virginia Woolf and others wrote of it too.

After various financial problems, the system was unified under government control. The government authority running it wanted to promote its use to reduce street-level congestion but the problem was, there were many different lines that only served part of the capital. Making it easy to use the system was hard.

Here's an early map of the system so you can see the problem.

1908 tube map

(1908 tube map. Image source: Wikimedia Commons.)

The map's hard to read and it's hard to follow. It's visually very cluttered and there are lots of distracting details; it's not clear why some things are marked on the map at all (why is ARMY & NAVY AND AUXILLARY STORES marked so prominently?). The font is hard to read, the text orientation is inconsistent, and the contrast of station names with the background isn't high enough.

The problem gets even worse when you zoom out to look at the entire system. Bear in mind, stations in central London are close together but they get further apart as you go into the suburbs. Here's an early map of the entire system, do you think you could navigate it?

(1931 whole system tube map.)

Of course, printing technology of the time was more limited than it is now, which made information representation harder.

Design ideas in culture

To understand how the tube map as we know it was created, we have to understand a little of the design culture of the time (the early 1930s).

Electrical engineering was starting as a discipline and engineers were creating circuit diagrams for new electrical devices. These circuit diagrams showed the connection between electrical components, not how they were laid out on a circuit board. Circuit diagrams are examples of topological maps.

(Example circuit diagram. Show electrical connections between components, not how they're laid out on a circuit board. Image source: Wikimedia Commons, License: Public domain.)

The Bauhaus school in Germany was emphasizing art and design in mass-produced items, bring high-quality design aesthetics into everyday goods. Ludwig Mies van der Rohe, the last director of the Bauhaus school, used a key aphorism that summarized much of their design philosophy: "less is more".

(Bauhaus kitchen design 1928 - they invented much of the modern design world. Image source: Wikimedia Commons, License: Public domain)

The modern art movement was in full swing, with the principles of abstraction coming very much to the fore. Artists were abstracting from reality in an attempt to represent an underlying truth about their subjects or about the world.

(Piet Mondrian, Composition 10. Image source: Wikimedia Commons, License: Public Domain.)

To put it simply, the early 1930s were a heyday of design that created much of our modern visual design language.

Harry Beck's solution - form follows function

In 1931, Harry Beck, a draughtsman for London Underground, proposed a new underground map. Beck's map was clearly based on circuit diagrams: it removed unnecessary detail to focus on what was necessary. In Beck's view, what was necessary for the tube was just the stations and the lines, plus a single underlying geographical detail, the river Thames.

Here's his original map. There's a lot here that's very, very different from the early geographical maps.

The design grammar of the tube map

The modern tube map is a much more complex beast, but it still retains the ideas Harry Beck created. For simplicity, I'm going to use the modern tube map to explain Beck's design innovations. There is one underlying and unifying idea behind everything I'm going to describe: consistency.

Topological not geographical.This is the key abstraction and it was key to the success of Beck's original map. On the ground, tube lines snake around and follow paths determined by geography and the urban landscape. This makes the relationship between tube lines confusing. Beck redrew the tube lines as straight lines without attempting to preserve the geographic relations of tube lines to one another. He made the stations more or less equidistant from each other, whereas, on the ground, the distance between stations varies widely. 

The two images below show the tube map and a geographical representation of the same map. Note how the tube map substantially distorts the underlying geography.

(The tube map. Image source: BBC.)

(A geographical view of the same system. Image source: Wikimedia Commons.)

Removal of almost all underlying geographical features. The only geographical feature on tube maps is the river Thames. Some versions of the tube map removed it, but the public wanted it put back in, so it's been a consistent feature for years now.

(The river Thames, in blue, is the only geographic feature on the map.)

A single consistent font.  Station names are written with the same orientation. Using the same font and the same text orientation makes reading the map easier. The tube has its own font, New Johnston, to give a sense of corporate identity.

(Same text orientation, same font everywhere.)

High contrast. This is something that's become easier with modern printing technology and good quality white paper. But there are problems. The tube uses a system of fare zones which are often added to the map (you can see them in the first two maps in this section, they're the gray and white bands). Although this is important information if you're paying for your tube ticket, it does add visual clutter. Because of the number of stations on the system, many modern maps add a grid so you can locate stations. Gridlines are another cluttering feature.

Consistent symbols. The map uses a small set of symbols consistently. The symbol for a station is a 'tick' (for example, Goodge Street or Russell Square). The symbol for a station that connects two or more lines is a circle (for example, Warren Street or Holborn).

Graphical rules. Angles and curves are consistent throughout the map, with few exceptions - clearly, the map was constructed using a consistent set of layout rules. For example, tube lines are shown as horizontal, vertical, or 45-degree lines in almost all cases.

The challenge for the future

The demand for mass transit in London has been growing for very many years which means London Underground is likely to have more development over time (new lines, new stations). This poses challenges for map makers.

The latest underground maps are much more complicated than Harry Beck's original, newer maps incorporate the south London tram system, some overground trains, and of course the new Elizabeth Line. At some point, a system becomes so complex that even an abstract simplification becomes too complex. Perhaps we'll need a map for the map.

A trap for the unwary

The tube map is topological, not geographical. On the map, tube stations are roughly the same distance apart, something that's very much not the case on the ground.

Let's imagine you had to go from Warren Street to Great Portland Street. How would you do it? Maybe you would get the Victoria Line southbound to Oxford Circus, change to the Bakerloo Line northbound, change again at Baker Street, and get the Circle Line eastbound to Great Portland Street. That's a lot of changes and trains. Why not just walk from Warren Street to Great Portland Street? They're less than 500m apart and you can do the walk in less than 5 minutes. The tube map misleads people into doing stuff like this all the time.

Let's imagine it's a lovely spring day and you're traveling to Chesham on the Metropolitan Line. If Great Portland Street and Warren Street are only 482m apart, then it must be a nice walk between Chalfont & Latimer and Chesham, especially as they're out in the leafy suburbs. Is this a good idea? Maybe not. These stations are 6.19km apart.

Abstractions are great, but you need to understand that's exactly what they are and how they can mislead you.

Using the map to represent data

The tube map is an icon, not just of the tube system, but for London itself. Because of its iconic status, researchers have used it as a vehicle to represent different data about the city.

James Cheshire of University College London mapped life expectancy data to tube stations, the idea being, you can spot health disparities between different parts of the city. He produced a great map you can visit at tubecreature.com. Here's a screenshot of part of his map.


You go from a life expectancy of 78 at Stockwell to 89 at Green Park, but the two stations are just 4 stops apart. His map shows how disparities occur across very short distances.

Mark Green of the University of Sheffield had a similar idea, but this time using a more generic deprivation score. Here's his take on deprivation and the tube map, the bigger circles representing higher deprivation.

Once again, we see the same thing, big differences in deprivation over short distances.

What the tube map hides

Let me show you a geographical layout of the modern tube system courtesy of Wikimedia. Do you spot what's odd about it?

(Geographical arrangement of tube lines. Image source: Wikimedia Commons, License: Creative Commons.)

Look at the tube system in southeast London. What tube system? There are no tube trains in southeast London. North London has lots of tube trains, southwest London has some, and southeast London has none at all. What part of London do you think is the poorest?

The tube map was never designed to indicate wealth and poverty, but it does that. It clearly shows which parts of London were wealthy enough to warrant underground construction and which were not. Of course, not every area in London has a tube station, even outside the southeast of London. Cricklewood (population 80,000) in northwest London doesn't have a tube station and is nowhere to be seen on the tube map. 

The tube map leaves off underserved areas entirely, it's as if southeast London (and Cricklewood and other places) don't exist. An abstraction meant to aid the user makes whole communities invisible.

Now look back at the previous section and the use of the tube map to indicate poverty and inequality in London. If the tube map is an iconic representation of London, what does that say about the areas that aren't even on the map? Perhaps it's a case of 'out of sight, out of mind'.

This is a clear reminder that information design is a deeply human endeavor. A value-neutral expression of information doesn't exist, and maybe we shouldn't expect it to.

Takeaways for the data scientist

As data scientists, we have to visualize data, not just for our fellow data scientists, but more importantly for the businesses we serve. We have to make it easy to understand and easy to interpret data. The London Underground tube map shows how ideas from outside science (circuit diagrams, Bauhaus, modernism) can help - information representation is, after all, a human endeavor. But the map shows the limits to abstraction and how we can be unintentionally led stray. 

The map also shows the hidden effects of wealth inequality and the power of exclusion - what we do does not exist in a cultural vacuum, which is true for both the tube map and the charts we produce too.