In a recent post on the 2012 performance of the 33 different sectors that make up the TOPIX index, I showed a chart of TOPIX versus the yen-dollar rate and invited you to judge for yourself whether the currency has any impact on the market. The chart (reproduced below) sparked a comment to the effect that such judgements are entirely subjective. Well, as it turns out, there is some objective as well as intuitive evidence that the yen drives the TOPIX.

Logically, I would expect the currency to affect the TOPIX index because the yen-dollar rate has a significant impact on the earnings of some of Japan’s largest stocks by market capitalisation (such as Toyota in 1st place, Honda in 3rd place and Canon in 5th place). Some domestic sectors, such as Fishery, Agriculture & Forestry, may have little exposure to currency fluctuations, but the weighting of such sectors is typically small: for Fishery, Agriculture & Forestry it’s about 0.08% of the total market cap of companies listed on the first section of the Tokyo Stock Exchange. Even the Construction sector, which includes more than 170 companies, only accounts for 2.6% of the capitalisation of the market, which was 296.4 trillion yen at the end of December 2012.

## Correlation

So the theory is that the yen affects the earnings of some companies and that market participants act to buy or sell stocks more aggressively as they incorporate the fluctuations of the currency into their expectations. However, my expectation would be for the effects of currency fluctuations to be short-lived, given that investors tend to react to *changes* in the forex rate rather than absolute levels. Once the change has been incorporated into market expectations it should lose its impact.

First let’s find the correlation between the Japanese yen/US dollar rate and the TOPIX in 2012. Using the raw daily prices for this is a bad idea. We could take the percentage change in daily prices, but another common approach is to take the change in the log of the prices. You could use a spreadsheet like Excel for this, but statistical tools like SAS, Stata or the open-source R statistical programming language (used here) are perhaps more suited to the job. If ‘topix’ is a variable holding the closing prices for the TOPIX index and ‘jpy’ holds daily closes for the yen in 2012 then this line of R will do the job:

cor( diff( log(jpy) ), diff( log(topix) ) )

## Rolling with it

For 2012 as a whole, the R-squared value was just 0.10, denoting very weak relationship between the two data series over that time period. Going by the theory presented above this is not surprising because we assume that the effects of changes in the yen-dollar rate on TOPIX are short-lived. According to our hypothesis, any impact on stocks will be incorporated rapidly and will certainly not persist for a full year.

Instead of calculating the correlation for all the 250-plus trading days 2012, let’s take each day and calculate the correlation for the previous *n* days. What should *n* be? If *n* were 1, we would be estimating correlation every day, which would likely be extremely noisy. If *n* were 22, that would be equivalent to about a month of trading. Given that some of the moves in the TOPIX index in 2012 were short (such as the rally from 4 June to 4 July 2012, which took only 23 days), a figure of *n* = 22 would make the correlation slow to react. I’m going to use *n* = 10 here, which in effect means that we look back over the previous 2 trading weeks and derive the r-squared for that 10-day period.

The result of this rolling 10-day calculation is shown in the chart below. In 2012 the correlation 10-day rolling R-squared between the difference in the daily price of the TOPIX index and the difference in the daily price of the yen topped 0.6 several times, indicating a sporadic but strong correlation.

## Caveats

Some things to keep in mind. First, correlation is not causation (see here for a more rigorous recap). Second, in the chart above the values for the R-squared of the yen and TOPIX are displaced by 10 trading days (a white vertical line is drawn every 10 days to give some idea of the scale). For example, the R-squared of nearly 0.67 recorded in mid-March 2012 refers not to the correlation between the yen and TOPIX at that time but to the correlation at the beginning of the month.