Stock markets are plummeting as the Corona virus has turned into a global pandemic. During the short periods of recovery one can hear those stock market reporters on TV talking about a **tennis ball effect**. The idea is that what goes down has to come up again and vice versa. So should you wait for the next big drop and then buy all the stocks you can get because it is inevitable that markets will bounce back on the next day? Lets look at some evidence.

## Getting and visualizing the data

We first download historical prices of the *Dow Jones Industrial Average* and the German stock market index *DAX* and combine the data in a tidy dataframe.

```
suppressPackageStartupMessages({
library(tidyverse)
library(tidyquant)
})
DOW <- tq_get("^DJI", get = "stock.prices", from = "2006-01-01")
DAX <- tq_get("^GDAXI", get = "stock.prices", from = "2006-01-01")
df <- bind_rows("DAX" = DAX, "DOW" = DOW, .id = "index") %>%
select(date, index, adjusted) %>%
rename(price = adjusted)
```

The data comes from *Yahoo Finance* and is freely available, so you can have a go and play around with it. We select the column with the adjusted price. Stock market data usually has many irregularities due to dividend payments or stock splits that cause huge changes of the nominal price, but are not due to actual movements of the market. Adjusted prices are corrected for these effects so that the data is comparable over time.

We then create new colums with the return (percentage change relative to the previous day) and the *lagged price* and *lagged return*. The **lagged return** is simply the return from the day before. This will make it easier down the line to see whether there is dependence such as a tennis ball effect between subsequent returns.

```
df <- df %>%
group_by(index) %>%
mutate(lag_price = lag(price),
return = (price - lag_price)/ lag_price,
lag_return = lag(return)) %>%
na.omit()
df %>% glimpse()
```

```
## Observations: 7,157
## Variables: 6
## Groups: index [2]
## $ date 2006-01-04, 2006-01-05, 2006-01-06, 2006-01-09, 2006…
## $ index "DAX", "DAX", "DAX", "DAX", "DAX", "DAX", "DAX", "DAX…
## $ price 5523.62, 5516.53, 5536.32, 5537.11, 5494.71, 5532.89,…
## $ lag_price 5460.68, 5523.62, 5516.53, 5536.32, 5537.11, 5494.71,…
## $ return 1.152603e-02, -1.283639e-03, 3.587407e-03, 1.427011e-…
## $ lag_return 1.963346e-03, 1.152603e-02, -1.283639e-03, 3.587407e-…
```

```
df %>%
ggplot(aes(x=date, y=price))+
geom_line(aes(col=index))
```

When we look at the historical prices, we can still see the Subprime mortgage crisis of 2008/2009 at the beginning of the sample. The current crash is on the right hand side. The DOW is back to the level it had in 2017 and the DAX is back to its level from 2016.

One can also see that the markets generally move in similar patterns, since the value of firms in the USA and Germany generally depends on the same global trends.

When we look at the returns from one day to the other, we can see that there are periods when markets are more volatile and fluctuate more, and periods when they are more calm. This pheanomenon is called *volatility clustering* and it is a typical feature of financial data.

```
df %>%
ggplot(aes(x=date, y=return))+
geom_line(aes(col=index))
```

In the graph above, the first and biggest clustering of large returns can be seen on the left during the financial crisis of 2008. The next clusters are due to the European sovereign debt crisis. On the far right, we can see that we were in a relatively calm period before the latest turbulences started, but the magnitude of the changes that we have seen recently are huge.

## Is there a tennis ball effect?

What would we expect to see in the data if there was a tennis ball effect, so that the market goes up if it went down the day before and vice versa? Well exactly that! We would be able to see this in a simple scatter plot, if we put the return of the previous day on the x-axis and the return of the current day on the y-axis. If the tennis ball theory was correct, there would be a tendency that very big negative movements on the left are followed by high returns on the top and very high returns on the right should be followed by very low returns on the bottom.

```
df %>%
ggplot(aes(x=lag_return, y=return))+
geom_point(aes(col=index), alpha = 0.3)+
geom_abline(intercept = 0, slope = -1, lty = 2, col=3)
```

So if there was a tennis ball effect there would be a clustering of points along the green diagonal line that I added to the plot. As you can see, there is no such thing. There is no evidence that stock market returns depend on the previous days return in any way.

But let’s see if we can tease out the effect if we look at it in a different way. If the tennis ball theory would be right, then we should see a higher probability of markets to go up, after very small returns. To test whether this is the case, we divide the data into bins according to the percentiles. That means the first bin contains the one percent of the smallest lagged returns, the second bin contains the 1 percent of the second smallest lagged returns and so on. For each of those bins we then calculate the mean of the lagged returns and the proportion of positive returns.

```
N <- 100
df_cuts <- df %>%
group_by(index) %>%
mutate(bin = cut(lag_return,
quantile(lag_return,
probs = seq(1 / N, 1 - 1 / N, 1 / N))) %>%
as.character()) %>%
group_by(index, bin) %>%
summarize(pos = mean(return > 0),
mid = mean(lag_return))
df_cuts %>% glimpse()
```

```
## Observations: 198
## Variables: 4
## Groups: index [2]
## $ index "DAX", "DAX", "DAX", "DAX", "DAX", "DAX", "DAX", "DAX", "D…
## $ bin "(-0.000265,-6.06e-05]", "(-0.000545,-0.000265]", "(-0.000…
## $ pos 0.6111111, 0.4722222, 0.5555556, 0.6388889, 0.5277778, 0.6…
## $ mid -0.0001630913, -0.0004051533, -0.0006507164, -0.0008338777…
```

With this dataset, we can now plot the mean value of the lagged returns in the bins against the proportion of positive returns.

```
df_cuts %>%
ggplot(aes(x=mid, y=pos))+
ylim(0,1)+
geom_point(aes(col = index), alpha=0.5, size=5)+
geom_hline(yintercept=0.5, col=2)+
xlab("bin_mid")+
ylab("proportion positive")
```

As one can see, all of the points are centered around the horizontal line at 0.5. This is where a positive and a negative return are equally likely. For the tennis ball effect to be true, we would have to see that the points on the left (where the lagged return was very low) tend to be above the line. This is not the case. There is no such thing as a tennis ball effect. When you hear a stock market reporter confidently claming that, you should stop listening to that person. And if you are planning to buy after the next drop, do not do it because you think it must come up again. Do it if you think the company is more valuable then implied by its current price.

[…] Stock markets are plummeting as the Corona virus has turned into a global pandemic. During the short periods of recovery one can hear those stock market reporters on TV talking about a tennis ball effect. The idea is that what goes down has to come up again and vice versa. So should you wait for … Continue reading Stock market crisis: is there a tennis ball effect? […]

LikeLike

[…] article was first published on R – first differences, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here) […]

LikeLike

[…] article was first published on R – first differences, and kindly contributed to R-bloggers]. (You can report issue about the content on this page […]

LikeLike

[…] article was first published on R – first differences, and kindly contributed to R-bloggers]. (You can report issue about the content on this page […]

LikeLike