Brett Romero

Data Inspired Insights

Tag: finance

The Surprising Complexity of Randomness

Previously, in a walkthrough on building a simple application without a database, I touched on randomness. Randomness and generating random numbers is a surprisingly deep and important area of computer science, and also one that few outside of computer science know much about. As such, for my own benefit as much as yours, I thought I would take a deeper look at the surprising complexity of randomness.

Why do we need randomness?

There can be a number of uses for randomness. But firstly, one thing to note is that when it comes to computers and computer science, randomness is typically represented by random numbers – seemingly random sequences of numbers that can then be used for different purposes. These purposes can range from randomly generating words in a flashcard app or shuffling songs in a playlist, to significantly more high-stakes uses, such as generating random keys for secure logins, data encryption, or randomly shuffling a deck of cards in an online game where large amounts of money are at stake.

How are random numbers created at the moment?

Random numbers come in two types, pseudorandom numbers and true random numbers.

Pseudorandom numbers are numbers that are generated to appear random, but are not truly random. Typically, pseudorandom numbers will be generated using a seed value provided by a user or programmer, which is then passed to an algorithm that uses that value to generate a new number. These algorithms often work by taking the remainder of an equation with includes the seed value and several large numbers.

For example, let’s say we use the following very simple equation to generate a series of random numbers:

R = (387 x S + 217) // 954

Where:
R is the random number to be produced
S is the seed value for R
// represents modular division, where the result will be the remainder of the division

Starting with a seed value (S) of 43, the first random number produced by the equation will be:

R = (387 x 43 + 217) // 953

R = 657

To produce the second random number, we then insert 657 as S, back into the equation:

R = (387 x 657 + 217) // 953

R = 25

This process can be repeated as many times as needed, generating an apparently random series of numbers.

While this example is a very simple one, this process of feeding the last random number into the same equation to generate a new random number is common to almost all pseudorandom number generators, and will result in two common attributes, regardless of the complexity.

The first is that if the seed value (S) is the same, the sequence of ‘random’ numbers produced by the algorithm will be exactly the same every time. This means that if you know the equation and the seed value, you can predict the entire sequence of ‘random’ numbers.

The second issue is that, eventually, the pattern will repeat. That is, eventually the formula will generate the same number twice, meaning the whole sequence will start again. And depending on the equation and large values chosen, this could be surprisingly soon.

Creating true random numbers

The reason we have pseudorandom numbers is because generating true random numbers using a computer is difficult. Computers, by design, are excellent at taking a set of instructions and carrying them out in the exact same way, every single time. It is this predictability which makes them so powerful. However, this predictability also makes it complicated to generate true random numbers.

As such, for a computer to create a truly random number, it has to take in some external input from something that is truly random. This external input can be something like key presses and movements of the mouse by a human operator, or network activity on a busy network in an office setting. But it can also be something far more complex such as the effect of atmospheric turbulence on a laser, or measuring the decay of a radioactive isotope.

randomness

Generating random numbers using mouse and keyboard inputs

Why does it matter?

This difference between pseudorandom and true random numbers is important, but only in certain settings.

For uses like selecting a random sample when working with data, shuffling a playlist, or triggering events in a video game, it is less important if pseudorandom or true random numbers are used. How true the randomness is, in these cases, will not impact the quality of the outcomes.

In some cases, using pseudorandom numbers may be advantageous. Take for example the process of selecting a random sample for a scientific study. In this case, using pseudorandom numbers allows others to replicate your results by using the same seed value. In video games, being able to trigger the same ‘random’ events is very useful when the game is being tested.

In other cases, using true random numbers is much more important. In applications such as encryption, using true random numbers is particularly important as it helps to ensure that data remains protected. Similarly, for online gambling, gaming companies need to have a very high level of confidence that the way results are being produced in everything from blackjack (how the cards are shuffled), to roulette (where the ball lands) and poker machines (which position the reels stop in) is a truly random process, or they risk someone reverse engineering the algorithm and making a significant profit as a result.

True randomness is not what most people expect

When it comes to true randomness, one of its stranger aspects is that it often behaves differently to people’s expectations. Take the two diagrams below – which one do you think is a random distribution, and which has been deliberately created/adjusted?

randomized dots

Only one of these panels shows a random distribution of dots | Source: Bully for Brontosaurus – Stephen Jay Gould

If you said the right panel, you are in good company, as this is most people’s expectation of what randomness looks like. However, this relatively uniform distribution has been adjusted to ensure the dots are evenly spread. In fact, it is the left panel, with its clumps and voids, that reflects a true random distribution. It is also this tendency for randomness to produce clumps and voids that leads to some unintuitive outcomes.

Take Spotify, the digital music service for example. For years, Spotify listeners have complained about the quality of the playlist shuffle. In fact, the quality of Spotify’s shuffle has been such a topic of discussion, that if you type “Spotify shuffle” into Google, one of the first autocomplete options that will come up is “sucks”. When Spotify looked into these complaints, the most common theme centered on songs from the same artist frequently playing one after the other. In short, people’s expectations of randomness were not matching reality. As Spotify explain in this interesting article, their shuffle was actually random, but they have now adjusted it to better align with what people think of as random – by reducing the randomness and ensuring that songs from a given artist will be spread throughout the playlist.

The gambler’s fallacy

As is also covered in the Spotify article, a great example of this misalignment of people’s expectations with the true nature of randomness is the so-called gambler’s fallacy. What the gambler’s fallacy boils down to is two things:

  1. A belief that independent random events (a flip of a coin, a roll of a dice) have some sort of inherent tendency to revert to the mean. For example, when flipping a coin, a streak of heads makes the likelihood that the next flip will be tails increase so that the eventual distribution will move back towards 50-50.
  2. As a result of belief 1, people tend to underestimate the likelihood of streaks (or clumps) of outcomes. The classic example of this is the person at the roulette table who looks at the list of previous results and sees a run of five black numbers, and believes that the likelihood of the next number being red is now higher as a result. By the way, this is exactly why casinos show the history, to tempt people into betting when they think the odds are in their favor.

To test your own beliefs on the likelihood of streaks, consider a roulette wheel in a casino. Let’s say the casino is open 12 hours a day, and that on average, it gets spun once per minute, giving us 720 spins in a day. Assuming there is a 50% chance of a red number and a 50% chance of a black number (i.e. we are ignoring the green 0 and 00 tiles for simplicity), what do you think the probability is of a streak of 8 or more black or red numbers in a row on a given day?

The answer is over 75%. In other words, on three out of four days, you should expect to see at least one streak of 8 or more black or red numbers during the day. Extending this, there is a 30% chance of a streak of 10 or more and around an 8% chance of a streak of twelve. You can test this and other scenarios using this handy calculator.

What does any of this mean?

In the course of your daily life, not too much. If you are a gambler, you should probably stop, but I am sure I am not the first person to tell you that. If you follow stock pickers, hopefully you will reconsider how much of their ‘skill’ is pure chance, especially when you factor in survivorship bias[1]. Perhaps something here will help you impress your friends at a trivia night.

If none of the above apply however, hopefully this article has introduced you to an interesting and little known area of knowledge with some important and fascinating applications.

 

[1] Survivorship bias in this context exists because the stock pickers that were not picking the right stocks did not keep writing articles. Over time, this leaves only the people who have been picking the winners (the ‘survivors’) to continue writing, even if their picks were correct purely by chance.

 

4 Reasons Fiat Money is a Great Idea and One Catch

In the world of economics and finance there are many complex topics that are poorly understood in the wider community. Differential calculus, options trading and multiple regression to take three examples. However, money and the monetary system is another topic I would quickly add to this list. The difference when it comes to money, however, is the number of people who believe they do understand the system. This leads to a range of misunderstandings including:

  1. Money in modern economies is still exchangeable for gold
  2. Printing of money will always lead to high levels of inflation
  3. Balancing a household budget is a suitable analogy for balancing the budget of a Government
  4. Paper money is worthless and doomed to fail

There is a lot of myths to dispel in that list. In this article we are going to tackle the question of why money works, even when not tied to a physical commodity (known as “fiat money”[1]). To do this, let’s start by imagining a world where there is no money. Instead of paying for things for money, everyone now has to barter for goods. What issues would people have in this system?

1. Coincidence of Wants

In a world where everyone has to barter to exchange goods, the first problem you are likely to encounter is described as the coincidence of wants. Imagine you are a pig farmer and, sick of eating pork for every meal (hard to imagine I know), you decide you would like to trade a pig for some wheat. The first hurdle is finding a wheat farmer who actually wants a pig. This is the coincidence – that you have pigs and want wheat, and that someone else has wheat and wants pigs and that both these wants occur at the same time.

Even in a simple agrarian village with only a limited number of food related products, you can already see the difficulties that will arise. Wheat is only available at certain times of the year and that will not coincide with the production of many other products. Some people may simply not like certain products, making it difficult for people producing those products to do any trading with them.

Introducing money into this scenario cleanly solves this problem by providing something to trade for what everybody wants at any given time.

2. Divisibility of Money

The second major problem in a barter system is the indivisibility of goods. Let’s go back to the pig farmer example and imagine again you want to trade pig for wheat. Assuming we find someone who wants to trade with us, how much of each do we actually trade? A pig is probably worth quite a large quantity of wheat, so what do I do if I only want a little bit of wheat? I’d have to kill my pig, give some of it to the wheat farmer, then hope I could find someone to buy the other parts of my pig. What about people producing even larger goods that can’t be sold in parts at all, such as a horse trainer or a house builder? They would constantly be forced to trade their goods for huge quantities of other goods.

Money solves this problem because it has the property of divisibility. I can sell a pig for $100, then split that money up to buy as many different types of goods as I want.

3. A Store of Value

The third problem in our moneyless world is that many of the goods we trade have limited lifespans. As a wheat farmer, if I have a good year and have extra wheat, what can I do with my extra wheat? I need to trade it for something or it will go off and be wasted.

In the past, this was such a problem, nearly every culture developed ways to preserve seasonal produce. Think about how many cultures have cured meats (prosciutto, jerky, spec), preserved fish (bacalao, pickled herring), pickled vegetables (cucumbers, onions, beans, peppers, achar) and fruit preserves and jams. Many of the most popular foods today were developed largely as a way to store produce over extended time periods in the days before freezers and refrigeration.

Although money doesn’t stop food spoiling, it does allow a farmer to sell off their seasonal produce for something that does not need to be preserved. That money can then be spent as needed in the future to purchase other goods. In the simple world of our example, that may simply mean buying preserved goods during the winter to survive until the next season. In a more complicated world it helps us do many things including to save for more expensive purchases such as a TV, a car, a house or our retirement.

4. Practicality

Continuing to build on the farming example, let’s imagine that the people of this particular farming village are trying to decide on a given (non-money) product that will become the unit of trade for everyone. Keeping in mind the points above, what would be the best options?

It would need to be something that could be easily divisible, which rules out livestock and any large objects such as furniture, tractors, houses and so on. It has to be something that doesn’t go off or require preservation, which rules out vegetables, fruits, grains and so on. What if they decided to use something that met these basic conditions like salt or honey?

Here we run into another issue that is neatly solved by money – practicality. Even trading in a commodity such as salt or honey would face a number of hurdles:

  1. Every transaction would need to be weighed or measured out to ensure the quantity exchanged is correct
  2. People would have to carry around honey or salt to complete transactions, and for large transactions, that could be a significant burden
  3. There would need to be some measure of the quality of the commodity being traded. How pure is the honey or salt? Do salts from certain places carry more value? Has the honey been diluted?
  4. People would have to find ways to store large amounts of these commodities in a such a way that they are safe and don’t get stolen, eaten or washed away

Problems 3 and 4 could be alleviated by some third party fulfilling the role of a salt or honey bank. This bank could verify the quality of the commodity and store large quantities of these commodities on behalf of their customers (for a small fee of course). It could even provide facilities allowing customers to access their deposits. This could be done by allowing access to the commodity itself, or by issuing some sort of official document or paper that the holder could bring to the bank to exchange for the commodity (it’s starting to sound pretty close to money at this point right?). But even in this case, the commodity would still need to be stored somewhere physically.

All these concerns are things we don’t have to worry about in a world with money. Notes and coins are extremely portable, meaning people can carry even very large amounts in small leather foldy things (let’s call them “wallets”). They come in predefined amounts which mean they don’t have to be measured out and quantities can be quickly verified. Finally, in a fiat money system, the vast majority of money doesn’t need to be physically stored, it is stored as numbers in a bank account.

The Catch

The catch in a fiat monetary system is that it is essentially a system built on mutual trust. For me to accept money as payment for goods I am selling or services I am providing, I must believe that I will be able to trade that money for goods and services, of approximately the same value, in the future. The person I purchase those goods or services from, in turn, must also believe the same thing, and so on down the line. If, at any given point, people in general stopped believing money would be able to be traded for goods or services in the future, the fiat money system would collapse very quickly.

We can see some examples of this in the real world in countries where hyperinflation and/or currency controls have occurred. In most cases, the local currency often becomes close to worthless as people substitute to either a more stable currency (typically the US dollar) or hard commodities. Luckily, these occurrences have usually been limited to small and poorly run economies and have not seriously impacted the legitimacy of the fiat money system overall.

What would happen if the population of a major developed economy stopped believing their currency would be accepted in the future? At that stage all bets are off. There is a substantial community of people that does have this concern, and are preparing for this scenario by buying hard commodities such as precious metals. But realistically, they should also be buying guns, canned food and digging a shelter in the backyard, because a failure of the monetary system would be a complete catastrophe.

Overall

Looking at the above points, we can see there are a large number of advantages to fiat money. Many of the transactions we undertake every day would become extremely burdensome in the absence of money. A lot of larger business transactions would be impossible in a barter system. Although money introduces some its own complications, it is hard to argue that the world would be anywhere near as complex or advanced if we had persisted with a barter system or a commodity based trade system.

Money in Three Charts

To finish off, let’s take a look at some stats on the values and volume of currency on issue for the worlds reserve currency, the US dollar. All the underlying data and more is available at the Federal Reserve website for those interested. I’m trying out some new interactive charts so please click, play and let me know what you think!

Chart 1 – Value of US Currency in Circulation by Denomination

Chart 2 – Volume of US Currency in Circulation by Denomination

Chart 3 – Comparison of Different Measures of Money Supply

For those that are unfamiliar, there are different ways of measuring the total money supply. The following chart compares 3 different measures – M1 money supply, M2 money supply and cash. This data is from the Federal Reserve of St. Louis website.

[1] Fiat money is money that derives it value only from Government rule or regulation. This is as opposed to commodity or representative money which is tied to the value of an underlying commodity.

Why You Probably Don’t Need a Financial Advisor

I recently had an interesting series of conversations with my parents around investing and the world of financial advice, which encouraged me to outlay some thoughts on the subject. First things first – I am not a financial advisor, and none of this should be taken as specific investment advice. My only aim is to highlight some common mistakes people make when it comes investing. If after reading this you feel you may not be getting the best advice, your next step should be to do your own further research and/or have a more informed conversation with your current financial advisor.

Why You Probably Don’t Need a Financial Advisor

Generally speaking, financial advisors are people who provide a service to investors, helping them build, balance, manage and adjust a portfolio of assets, taking into account the prevailing economic conditions and the expectations and needs of the client. There are a multitude of scenarios where financial advisors and asset managers provide a valuable service to their clients, unfortunately, however, as Matt Yglesias points out, this is almost never for small “retail investors”, like you or me.

If this is the case, why are financial advisors still in such demand when it comes to retail investors? I believe it comes down to four factors:

  1. Unrealistic expectations on the part of retail investors
  2. Fear of complexity
  3. The belief that your financial advisor’s incentives align completely with your own, and/or
  4. A lack of understanding of compounding.

Adjusting Expectations

Your expectations may seem pretty straightforward – you want to maximize the returns on your assets. But let’s dig a little deeper – what level of returns are you looking for? For most people, the prospect of 5-7% per annum returns seems underwhelming – that’s pretty much the average for the market right? What if I want to beat the market – half the investing world is beating the market average in a given year – surely I can be one of those guys?

Unfortunately, there is no shortage of people who will tell you they can help you do exactly that. From stock pickers in your local newspaper to highly paid active fund managers on Wall St, there is an endless line of people who want to help you discover the secret of obtaining above average returns. More often than not, it is even sold as quite a reasonable thing, an opportunity that others have overlooked for some plausible sounding reason, or something that is only available to a tiny subset of investors that you happen to a part of.

The problem is not the salesmen – salesmen are gonna sell – the problem is we keep buying into the promises of above average returns, despite our own better judgment. The reality is beating the market is extremely difficult to do, particularly over any multi-year period. Even if there are advisors and money managers that have found a way to consistently beat the market, they are running a hedge fund with billions in assets, or providing advice to people and/or companies with a lot more money than you or I. They are almost certainly not working 9 to 5 at your local branch of ABC Bank.

To start thinking like an investor, instead of a gambler, the first step is to readjust your expectations. There are no shortcuts to wealth – average market returns should be your expectation. Once that is your expectation, your view on the best way to invest your money fundamentally changes. Now the question changes from “How big is the return I can get?” to “What is the lowest cost way to match the average market returns?” That is the right question to be asking.

Fear of Complexity

Fear is a tool that has been used by professionals in most fields essentially since the beginning of people doing things for money. From lawyers to auto mechanics to management consultants, they have a vested interest in making any job they do seem more complicated than it is to ensure that a) you don’t learn how to do it yourself; and b) they can charge as much as possible for their services. People working in the financial industry are no different.

That’s not to say there aren’t extremely complicated products and concepts in the financial world, but now that we have adjusted our expectations – all we want is to match average market returns – why do we need to understand these complicated products? Do you have a large exposure to Chinese Yuan that you need to hedge? Have you been creating short positions on European junk bonds that you need to cover? You can probably stop reading this if you do.

If we accept that matching the average market return is in fact a perfectly acceptable result, then there are a range of simple, understandable options available to retail investors that are only a regular brokerage account away.

The Incentive Misalignment

Despite the platitudes, a financial advisor’s primary incentive is to maximize the amount of money they make from you as a client. There is some alignment in incentives in the sense that their fees increase as your assets grow (fees are typically structured as a percentage of total assets), but the difference to your advisor between your assets growing at 5% or 7% is minimal. The real money is in finding additional pools of assets to manage. Because of this, it is much more economical for them to spend their time finding additional clients than it is for them to spend that time trying to squeeze an extra percent or two out of your portfolio. Confused? Similar incentives apply for Real Estate agents (I’m just picking fights with everyone today) as is explained very well in the following short clip.

The above misalignment is actually one of the more innocent ways in which an advisor’s incentives can diverge from your best interests. The more disturbing divergence occurs due to the opaque world of incentives and commissions. This varies widely between countries, states and even the specific type of advisor you have, but these payments can lead an advisor to recommend products and strategies that aren’t actually the best option for you[1]. This could include recommending unnecessarily complex portfolio structures, advising you to take on too little or too much risk, or even recommending funds and/or securities that the advisor actually receives commission for selling. Most people have heard about this happening in the US, but don’t believe it doesn’t happen elsewhere – take this excerpt from the Financial Services Guide for Colonial First State, an Australian Wealth Management Group (emphasis mine):

“You may receive advice in relation to the products we offer from financial advisers who do not work for Colonial First State or may be representatives of other licensees in the Bank. These advisers may receive some benefits from us. The adviser’s remuneration is included in the fees you pay when investing in our products.”

The issue here isn’t that these products are being marketed, but there is a blurring of the lines between advisor and salesman that is particularly bad in the financial industry. Again referring to Matt Yglesias – compare buying securities recommended by your advisor to buying a car: “we understand that the car salesman works for the dealership — he’s not your car advisor.”

The key point is that the only person who really cares about your money is you and you should spend as much time researching how you invest your money as you would on any other major purchase. Fortunately, there has never been a better time for investing novices to learn some of the basic concepts of investing – CNN, ASIC, Yahoo Finance and many others have beginner’s guides to investing. For those looking for something more in depth, Coursera is a fantastic resource of free courses offered by some of the worlds leading Universities. Two excellent beginners’ finance courses are currently being offered by the University of Michigan and Yale.

So instead of spending all your time online looking up Joe Pesci trivia, watching John Stewart clips on racial inequality, or researching the best toothbrush to buy, invest some time building your financial knowledge. Start with important concepts like the risk-return tradeoff and diversification, and move onto the different types of securities. Let your curiosity take you where you want… after you watch the Joe Pesci clip of course.

Underestimating Compounding

One of the big reasons so many of the injustices in the financial markets occur is because people consistently underestimate the effects of compounding. Let’s look at a simple example – the bank provides you with an asset worth $0.01, but it doubles in value every day (i.e. it would be worth $0.02 on day two, $0.04 on day three and so on) for an entire 31-day month. How much would that asset be worth at the end of the month?

If your guess had less than 7 figures, you are way off. By the end of the month, that asset would be worth over $10 million. That is the impact of compounding. Let’s look at a more relevant example for investors. Anecdotally, you will often hear people say something along the lines of the following:

X was a great investment – it doubled in price over the last 10 years.

What is the average rate of return that would cause an asset to double in value in 10 years? 7.18% per annum. Consistent 7.18% returns is nothing to sneeze at, but it is a lot less impressive than the returns sought by a lot of investors. It is also lower than the long run average return of the S&P500, which is over 9% (see Chart 1).

Chart 1 – Value of $100 Invested in the S&P500 in 1928

fin_adv_chart_1

Ok, so leaving relatively small amounts of money invested at low rates results in a lot bigger returns than you might expect. If that is the case, it shouldn’t matter if my advisor is charging me 0.15% or 1.5%, as long as I leave it accumulating for long enough, right? Unfortunately the opposite is true, when it comes to fees, compounding works against you. Those seemingly small fees that financial advisors and intermediaries charge you for their services end up having a much bigger impact than you might expect.

Just as compounding works by exponentially increasing a value by giving us returns on our returns, the money lost through fees grows exponentially by taking away money each year that would be compounded in future years. Chart 2 shows a comparison of two $100,000 investments over 30 years assuming the long run returns of the S&P500 (9%). One investment is made in a low cost market index fund (cost 0.1% of assets) and the other in a high cost managed fund (cost 1.5% of assets).

Chart 2 – $100,000 Investment: High Cost vs. Low Cost Management

fin_adv_chart_2

Within 5 years, the high cost fund has cost you over $10,000 more in fees and lost returns than the low cost fund – that’s over 10% of the value of your initial investment gone. The cost reaches over $30,000 by the 10-year mark, and over $135,000 by year 20.

The worst part of this, going back to the first point, is there is almost no chance that your high cost fund managed to outperform the market index fund over the course of those 20 years, and a pretty good shot it did significantly worse. At best you probably just paid $135,000 to match the average market returns… on the plus side, maybe they will take you out on their new yacht for your generosity.

What To Do?

If you understand and agree with the points made above, and if you are currently investing or are planning to invest any significant money, then what you should be looking for is something that will allow you to reproduce the market average performance at a very low cost. There is a growing number of ways to do this, but low cost managed funds and ETFs are the most accessible to most investors.

However, do not simply substitute this advice for your old financial advice. Do your own research – there is so much information out there, and the best advice is often free. Understand what the product options are, what the fees and costs are, and what returns are expected and why. Don’t be afraid to ask questions – the only dumb question is the one asked after you have lost a stack of money.

 

[1] The option recommended might simply be less beneficial than the best option as opposed to an option that is not in your interest at all, which would be a breach of fiduciary obligations.

 

Disagree with any of the above? Feel free to leave a comment below.

© 2018 Brett Romero

Theme by Anders NorenUp ↑