Search This Blog

Monday 17 May 2021

Why you should not blindly trust statistics on per capita GDP based on PPP

Everybody knows that Gross Domestic Product (GDP) should be adjusted for the different level of prices if you want to compare different regions or countries. That is why the GDP based on Purchasing Power Parity (PPP) was created. However, this measure can be quite misleading, and I explain you why.

First of all, price levels are often measured in a bogus way, as I have argued in a previous post. But another fact is even more important, and it is that if a large firm establishes its headquarter in an area that does not have a very large population, its revenues are going to considerably distort the value of the GDP based on PPP. This is especially true if the the given area is not very rich.

Let's consider the map of the GDP of european regions in PPS: [1,2]

You can see there are regions in central-eastern Europe that are apparently wealthier than many western european regions. Is this really the case? Is the Bucarest region wealthier than Finland and large parts of Germany? Not quite.

So how can we get a realistic picture? There are better measures, like the GfK purchasing power index: [3]

Now everything makes much more sense. The eastern european areas that are classified as having a GDP in PPS way above the european average turn out to be relatively poor areas compared to most of western europe, which is what real world experience tells us.

[1] PPS stands for Purchasing Power Standard. Here we can ignore the technicalities about the difference between PPP and PPS. Interested readers can find some details on the eurostat website.

[2] The map on GDP in PPS was taken from here.

[3] The map on GfK Purchasing Power was taken from here.

Tuesday 8 September 2020

Average inflation rate, substitution effect, and other convenient tricks

The FED has recently announced a major policy change: instead of aiming for an inflation rate of 2%, it will aim for an average inflation of 2%. This means that if in some periods the inflation is measured below that value, the FED will allow it to rise above 2% to compensate. Most of you probably do not know it, but this is not the first trick central banks use to manipulate the markets more and more while pretending no distortions on the prices are produced. The most subtle and at the same time simple of these tricks lies in the way they measure inflation.

Let's keep the focus on the FED. The FED uses the Personal Consumption Expenditure (PCE) as inflation index. Why using that index and not the Consumer Price Index (CPI)? There are several reasons, but one in particular is of interest for us now. As you might know, an inflation index is computed as a weighted average of the price changes of a set of goods and services. The PCE and the CPI use two different sets, but the most important difference is that the PCE is computed accounting for the "substitution effect". Basically, this means that if the price of a certain good goes up, but there is a cheaper good the guys who compute the index think can substitute the other (according to them!!), they kick out from the index the good whose price increased and they include instead the good whose price is lower. This of course leads to an underestimation of inflation, although for some reasons obscure to me, the general consensus is that it's CPI which is biased for not accounting for the substitution effect, and not the other way around. So, if there is a certain good you like and you regularly buy, and its price increases, you HAVE to swap it with something cheaper according to those guys. Ehr...ok. Obviously, the CPI is consistently higher than the PCE [1].


I could go on and mention the fact that many goods whose price regularly increases are never included in those indices. For example, in many european countries the price of alcoholic drinks and tobacco doubled in the last 15 years, but this was not even registered in national inflation indices, because they are not included in the set of goods used to compute them. Apparently, those guys are concerned with your health and think you should not consume those goods anyway, so why bother including them?

So, long story short, if you want to know what the real inflation rate is, take the official rates and add 1 or 2 percentage points, and you might get some realistic figures.

This sums it up regarding inflation that affects "real" goods and services. What about inflation on the financial markets? In case you did not notice, we are in the middle of one of the worst economic crisis ever, and stock markets, after an initial dramatic crash, mostly recovered, and the NASDAQ is even breaking new records. "Maybe" it has something to do with the tons of money central banks are throwing in?

P.S. Aside from the questionable way inflation in computed, I think central banks should aim for a 0% inflation rate, but that's another story.

[1] The CPI vs PCE figure was originally posted here.

Sunday 28 June 2020

Rejuvenation industry: will it dwarf the dot-com bubble?


About twenty years passed since Dr Aubrey De Grey started talking about his plan to put ageing under medical control. The idea of this computer scientist turned biologist is relatively simple. Ageing is the result of an accumulation of damage that the body does to itself as a result of the normal metabolism operations. We can't realistically expect to manipulate the metabolism in order to make it produce less damage (the traditional approach of biogerontology) without doing more harm than good, because metabolism is extremely complicated and we don't know nearly enough about it. And we also can't expect to attack the consequences of this damage accumulation (the traditional approach of geriatrics) with any significant success, because far too things go wrong all at the same time as we get old. So, he proposes a sort of "preventative geriatrics" approach that aims at repairing the damage in order to prevent it from reaching a pathological level. While the processes that produce the damage are extremely complicated, the damage itself is relatively simple: all of it can be classified in just seven broad categories. These categories are:

- cell loss/atrophy
- division-obsessed cells (basically cancer)
- death-resistant cells
- mitochondrial mutations
- intracellular waste products
- extracellular waste products
- extracellular matrix stiffening

In principle, all of these types of damage are potentially treatable. De Grey thinks we can find a way to do it, and in this way we would cure ageing and stay young indefinitely.

Most people called him mad. Admittedly, his bizarre look didn't help:


However, he didn't give up, and he founded a non-profit organization called SENS with a handful of other scientists in order to conduct scientific research inspired by his idea. Slowly, things started to change, and year after year his approch became more and more mainstream. Here is one of the many talks De Grey gave about his plan and the progress that have been done.

A few years ago, the magic happened: private investors became interested, and many startups were created. Some of them grew enough to go public. So now there is a growing industry in which you can easily invest. Should you? Let's give a better look at this.

Biotechnology startups have a huge high risk - high reward factor: the value of a stock can skyrocket if things go well, or go to zero if they don't, often very suddenly. The success or failure of a clinical trial can write the fate of a company almost overnight. If this is true in general, you can imagine how much this applies to an avveniristic and early stage market like the one focusing on rejuvenation. If this idea works, people who bet on it will be rich, no doubt. Of course, it could also fail, or at least take more time than expected. De Grey is very optimistic: he thinks we could be less than 20 years away from achieving robust human rejuvenation, and less than 5 years away to achieve robust mouse rejuvenation (which would serve as proof of concept for human rejuvenation, and therefore attract huge interest from investors, which would make the market skyrocket). However, even he admits that we might not have robust human rejuvenation for another hundred years.

Lots of speculative thinking so far. Let's get more down to earth and see how this market has performed so far. Here is a list of American public companies that, to the best of my knowledge, make up the bulk of this market:

- AgeX Therapeutics
- Alector
- Athersys
- Cohbar
- Denali Therapeutics
- resTORbio
- Scholar Rock
- Unity Biotechnology

Starting from November 29, 2018 (the day AgeX Therapeutics, which is the last of these companies to go public, was listed on the NYSE), the following graph shows what would have happened to one unit of wealth invested in each of these companies:
We can notice two things. The first one is that only two of these stocks now trade at a value higher than at the end of November 2018. The second is the very high volatility. Look for example at the vertical fall that the blue line experienced. That is what happened to the value of the resTORbio stocks after the company announced the failure of the Phase 3 trial for their main drug candidate.

So what if you had a portfolio with your wealth equally split among these eight stocks? Here is what would have happened to your money:
So, at a certain point in time, the losses would have amounted to half the value of the investment. This is a reminder of how risky this stuff is. However, in the last few months there have been some big gains, although there still is a 20% loss on the initial investment. It is also interesting to notice the low correlation with the main market indices, with the value of the portfolio going down while the S&P 500 and NASDAQ were breaking record after record. This is because the fate of these companies has little to do with the general state of the economy, and everything to do with the results of their clinical trials (and until results are announced, with how much investors trust these clinical trials will be completed successfully).

To sum it up, here is what I think. This is very high risk - high reward stuff. You don't want to invest a very big fraction of your savings into this because the risk of huge losses is just too big. However, it is also undeniably fascinating stuff. If this works, the world will never be the same again, and if you invested in it, you would be rich. So, if you have some money that you are willing to risk, you might give this a try. I would simply place an equal amount of money on each of the stocks in the rejuvenation industry, and then wait. It is especially important to not be emotional: you have to be ready to look at a -50% return without panic selling. Just buy and wait a few years. If things go as hoped, you'll celebrate on your yacht.

Monday 22 June 2020

How to recreate the matrix of prices from the matrix of returns in R

It is very easy, in R, to obtain a matrix of returns starting from a matrix of prices. The opposite procedure, however, is slightly more complicated. Let's say you have a matrix of returns that starts at time t, and a vector of the prices at time t-1. How can you obtain the full matrix of prices that has been used to generate the matrix of returns? I'm going to illustrate you how to do it.

Let us start by generating some prices (5 periods for 3 assets), in order to put together a working example. We also store in a separate object the prices in the first period.

prices <- abs(matrix(rnorm(15,mean=0,sd=1),5,3))
prices_1 <- prices[1,]

We then compute the simple and log returns. 

simple_returns <- diff(as.matrix(prices))/prices[-nrow(prices),]
log_returns <- diff(log(prices))

Now, imagine you were only given the vector of prices at the first period and the matrix of simple or log returns, and you want the matrix of prices. If you were given simple returns, you can do it with this code:

prices_new1 <- rbind(prices_1,simple_returns)
for(i in 2:(nrow(simple_returns)+1)){
  prices_new1[i,] <- prices_new1[i-1,]+prices_new1[i-1,]*prices_new1[i,]
}
row.names(prices_new1) <- 1:nrow(prices_new1)


With log returns, the code is as follows:

prices_new2 <- rbind(prices_1,exp(log_returns))
for(i in 2:(nrow(log_returns)+1)){
  prices_new2[i,] <- prices_new2[i-1,]*prices_new2[i,]
}
row.names(prices_new2) <- 1:nrow(prices_new2)


As you can easily check, the objects prices, prices_new1 and prices_new2 contain exactly the same values.

An Introduction to Stock Investing with R: Second Edition



The second edition of my book is ready. It is available on the Kindle Store at the same price of the first edition. I thoroughly revised and expanded it, and it now features more in depth explanations where was needed, it provides more codes, and it uses an updated dataset. Don't miss this opportunity to learn how to invest on your own quickly, effectively and with minimum costs. And please, leave a review on Amazon if you liked the book!

Tuesday 19 May 2020

The great coronavirus market crash



So it happened. The markets stopped their bull run. Sure, I didn't expect it to be suddenly replaced by one of the worst economic crisis ever, but here we are. So, what now? Well, let me put it straight: we are facing doomsday scenario here. Actually, things might even get worse, at least in some countries.

Let's go with order. The general consensus, with which I happen to agree, is that there will be no V-Shaped Recovery, but rather an L-Shaped Recovery. This is hardly surprising: the virus is still around, only a minority of the world population have been infected and are immune to it, and so we simply cannot go back to normal. We have to travel with the v-brake (pun intended) activated, which would be bad for the economy in normal times, let alone after months during which billions of dollars of wealth have not produced because of the lockdowns. Sure, central banks and governments are throwing in the usual monetary and fiscal stimulus, and more of it might arrive. However, this is not going to help much: in order for a stimulus to work, you need something to stimulate. If businesses cannot go back working at full speed because of the COVID-19 containement measures, not much can be done. Hopefully we will have a vaccine by next year, but it may also be that we won't have one anytime soon and we will have to wait for global herd immunity...

So, we are the middle of the desert, with a punctured tire which we can't repair or substitute, only blow air in it that will come out in a matter of minutes, and the nearest place where we can get some help is many km away. How could things be worse? Well, we might run out of water because we've drank all of it earlier, thinking we would arrive at our destination safely with no accidents. That's the situation highly indebted countries with a sluggish economy are in. Their economy may completely sink, which implies falling tax revenues, and at the same time their public expenditure will go up. Their public debt would become unsustainable. A particularly interesting situation can be found in the EU: countries that kept their expenditures in check during good times will suffer from the crisis, but have the means to survive. Those who didn't...well, they can only ask the former to help them stay afloat. And that's the kind of solution we're going to see. Is this going to end well? I don't think so.

Thursday 26 March 2020

How to compute a semicovariance matrix with R

Most of you are probably familiar with the covariance matrix. Its less known brother, the semicovariance matrix, might however be new to you. The semicovariance matrix is pretty much like a covariance matrix, with the difference that it is computed accounting only for the variability below a certain benchmark, which is set by the investor (e.g. negative returns, or returns lower than the risk-free rate or any other cut-off the investor sets).

Why would you want to use it? Well, if you think about it, it's the most natural thing to do: why consider all variability as risk, while in fact it is only the possibility of incurring into losses (or at least to earn less than expected) that worries you? Returns higher than the mean increase the volatility, but the possibility of achieving them can hardly be classified as risk. Therefore, it makes more sense to measure risk using not the standard deviation (which is the square root of the variace), but rather the downside deviation (the square root of the semivariance). If asset returns are symmetrically distributed, targeting either one or the other measure of risk makes no difference (well, technically, that's not always completely true, but let's make this almost innocuos assumption for the sake of simplicity). That's the logic behind the strategies that target the downside risk, and using the semicovariance matrix instead of the covariance matrix turns mean-variance optimization into mean-semivariance optimization, which is one way to target downside risk.

However, the semicovariance matrix suffers from one problem: endogeneity. Since it is computed by looking at the periods in which the portfolio underperforms the benchmark, but this set of periods is affected by the weights of the portfolio, any change in the portfolio weights changes the elements of the semicovariance matrix! This makes optimization problems that use the semicovariance matrix intractable. Luckily, there is a way around this problem. This paper describes a simple solution that consists into computing an approximated exogenous semicovariance matrix by looking at when the single assets, and not the portfolio as a whole, underperform the benchmark. The paper also describes in much greater detail what a semicovariance matrix is, so you should definitely give it a look.

The question now is: how can you compute this matrix in R? There are no built-in functions in R that perform this task, so let me show you how to write one. Let's call this function "scov"; the following code will give you what you need:

scov <- function(mydata,B){ #mydata = matrix of past returns; B = chosen benchmark
  D <- mydata - B #subtract the benchmark from the returns
  Z <- matrix(data=0, nrow=nrow(mydata), ncol=ncol(mydata)) #matrix of zeros
  D <- pmin(D,Z) #pick the minimum value between D and 0
  SM <- (nrow(mydata))^(-1)*t(D)%*%D  #approximated semicovariance matrix
  return(SM)
}


Done! It wasn't difficult, right? You can then use SM instead of the covariance matrix, in order to compute a mean-variance or minimum semivariance portfolio. Still, you might want to take it easy, as this approximation of the semicovariance matrix is not always a good approximation...

Bibliography

  1. Estrada, J. (2008), Mean-Semivariance Optimization: A Heuristic Approach, Journal of Applied Finance, 18(1)
  2. Cheremushkin, S. V. (2009), Why D-CAPM is a Big Mistake? The Incorrectness of the Cosemivariance Statistics, SSRN Electronic Journal