How to Invest like a Data Scientist

  1. When it works
  2. When it doesn’t work

2. Be Careful of Cryptos and Penny Stocks → Demonstrated by Game Theory

Bitcoin Charts from

You may have heard about the craziness of cryptocurrencies in 2017 when Bitcoin increased its value by 20 times within a year, followed by a big crash till today.

Let us start with a simplified example and you may see how to invest in volatile markets in the future:

  1. Sofia invites Noah to play a game that each of them is given a coin
  2. In each round, both of them show a side of the coin
  3. If the result is 2 heads, Noah wins $3 dollars
  4. If the result is 2 tails, Noah wins $1 dollar
  5. If the result 1 head and 1 tail, then Noah loses $2 dollars

It is not hard to imagine that the result of tossing a coin is 50–50, so there are 25% of the times the result is 2 heads, 25% 2 tails, and 50% 1 head and 1 tail.

Probability of tossing 2 coins
Rewards of different results

Therefore, the expectation of Noah and Sofia’s reward is $0:

25% × $3 + 25% × $1 - 50% × $2 = $0

Yes, it seems to be a fair game plus Noah always wants to play a game with a charming lady, like Sofia, so why not playing. But, after hours of the gaming date, the outcome shows that Noah has almost lost everything in his wallet, including the wallet. How did that happen?

The trick is: instead of randomly showing the coin every round, Sofia gets to control the probability. What strategy did she use? Here is what Sofia did:

Let’s say A represent the event in which Sofia shows the head, B for the event Noah shows the head.

The expectation of Noah’s reward:

Plotting this equation:

Plotting the function of Noah’s reward

The areas under the flat surface represent the negative E(Noah), and there is a certain range of P(A), Sofia’s probability of showing head, that makes the E(Noah) always negative! This is Sofia’s trick. The code below reveals the range:

Code to make Noah lose money
[0.34 0.35 0.36 ... 0.38 0.39 0.4]

That’s it. If Sofia manages to force the probability falls between 0.34 and 0.4, she will always make Noah lose money!

This game is a problem in game theory. It can be a perfect analogy teaching us how one can get tricked from a “fair” game. Here, the game can be seen as an investment, Noah represents the individual investors, and Sofia represents the institutional investors, a.k.a., big whales. In small capital investments, such as cryptocurrency and penny stocks, big whales can easily manipulate the market with a big amount of money, i.e., big sell-out or buy-in. Individual investors can make money if they luckily follow the movement of the “whales”, but ultimately individual investors will lose because they are just being manipulated.

3. Always “Give Up” Sooner than You Think → Objective Thinking

Picture from

During an investment, it is the most common thing that one will both win and lose at different points of time. When you are winning, never get greedy (proved earlier). When you are losing, cut the loss wisely.

Sam has been holding a stock which worths $10k. Recently the company hasn’t been in the wrong hands and the stock price suddenly dropped to below the purchase price, now it only worths $8k.

Should Sam cut the loss?

If Sam keeps holding or adding positions, 90% of chances he will lose more. Obviously cutting the loss is the way to go. However, many people fail to do this, even they were presented with the stats beforehand. This is all due to human egos, such as “You can’t lose money if you never sell”, “Never lose money”. Do NOT be dogmatic about these words.

Picture from

Setting the ego aside, a.k.a., objective thinking, is not as simple as it seems, it requires regular training and one’s persistence. This skill is a fundamental requisite for any scientists and researchers.

When the loss is not recoverable, e.g., the company is a scam/bubble, do NOT hope it may get better anytime soon, admit the loss has already become a sunk cost, and pull out immediately. Although sometimes the loss might get recovered by HODLing, considering the opportunity cost, the time you spend waiting till the investment gets back to the previous level, you may have already doubled your position if you chose to move the money somewhere else.

When it comes to investment survival, it’s always recommended to conduct more research about the stock and do some calculations to support the investment decision. Another simple and smart way is to treat the stock was given to you for FREE. You will find the decision becomes much easier to make if Sam received a free $10k stock but one day the stock dropped to $8k with very little chance to come back up.

4. See through the “Expectation” → Monte Carlo Simulation

Picture from Marvel (Cyclops) and

There are countless good and bad ways to evaluate an investment, and three of the worst ones are listed above. For individual investors, value investing, discounting, scorecard, PB + PE + PEG are great ways to start. I won’t elaborate on them in this article, please click through the links and you will discover how useful they are.

What I would like to call out is an interesting and sometimes counter-intuitive way that lots of people including professionals rely TOO MUCH on — Expected Return. Below shows when it does and doesn’t.

When it works

Say there is a coin-tossing game. Every round, if it is the head, the player makes $1, if it is the tail, the player makes $2. How much should (s)he pay for playing one round of this game?

The expected return is $1.5 so the game is worth playing only if the entry fee is less than $1.5.

When it doesn’t work

Say you have $X, there are 50% of chances it will become 0.9 × $X and 50% 1.11 × $X in the next unit time. Is it rationale to all-in every time?

This means, in the next unit time, you are expected to gain 0.5% from the $X you have. That is to say, every time you invest, you would make a profit, so of course, you should all-in every time!

However, in reality, you are would lose everything if you do so. Counter-intuitive right? Below shows you why.

With Monte Carlo simulation, I created 10,000 investors over 500 time units, all start at $100.

Each point on the graph represents the return of an investor at a particular time unit. From it, we can see that a few investors have achieved very significant return as time moves on, while the majority of the investors are not so lucky.

How unlucky are they? 88.56% of the investors have a return lower than where they started at, $100. What is more unfortunate is that 84.76% of the 10,000 investors end up with $0. Yes, the majority of the investors lose every single cent in the end.

It seems that the investment is extremely optimistic, and one should theoretically gain an infinite amount of money if (s)he keeps playing, but there is almost NO real winner in the market.

Below code reproduces the simulation:

Code to demonstrate when Expected Return doesn’t work

In case you are not 100% convinced, below explains why from a mathematical lens:

We already know that the Expected Return is

How about one’s Limit of Return:


Thanks to the law of large numbers


Boom! Counter-intuitive again! The Expected Return is positive but the Limit is zero. This is because some of the Xs are very large in the end, but that is extremely hard to achieve. The average return is dragged to positive due to these very few large Xs, but the truth is the majority of the Xs are almost zero.

While investing, one should use the tools wisely. Expected Return is a simple and useful tool but overly relying on it will make you ignore certain important information, which could be fatal sometimes.