## Archive for the ‘**Visualization**’ Category

## Visualizing Market Risk: A Physicist’s Perspective

Physicists learn at an early age (sometimes while still in diapers) about vectors. In fact, I supported myself financially through undergrad largely by explaining vectors to physical therapy students. Physics was the “weeder” course and PT students basically needed an “A” to get into the program. Tutoring them was quite lucrative, but that is another story. Here, I present a very neat way to visualize market risk in terms of arrows… err… I mean vectors.

#### What is a vector?

A vector can be thought of conceptually as an “arrow”.

What is the information contained in an arrow? There are two basic bits of information contained in an arrow

- Length or magnitude
- Direction

In terms of direction, probably what is more useful than “absolute” direction, is the “relative” direction, which can be quantified as the angle between two arrows.

#### Multiplying a Vector by a Number

The next thing you need to know about vectors is that you can multiply a vector by a number to get another vector .

Multiplying a vector by a number merely “rescales” the arrow, i.e. changes its length, while keeping the direction unchanged.

#### Adding Vectors

Next, given two vectors and , there is a rule for adding the arrows to get a new vector . There are a couple different ways to visualize the addition of arrows. One involves drawing the vectors “tail to tail” and forming a parallelogram. The new vector is the arrow going across the diagonal as shown below

Alternatively, but equivalently, you can draw the vectors “head to tail” and the new vector is the arrow pointing from the tail of the first arrow to the head of the second arrow as shown below

It doesn’t matter which you choose. Just remember that the addition of arrows is a little funky and involves parallelograms.

If I haven’t lost anyone up to this point, I will be quite impressed if you stick around for what comes next.

#### The Dot Product

Both the length and relative direction of a vector, or arrow, can be determined by something that we lovingly refer to as the “dot product”. Later in academic life, I learned that the “dot product” was actually a twice covariant symmetric non-degenerate tensor, but I digress. For our purposes, we just need know that the dot product takes two arrows and spits out a number (in a bilinear fashion). In other words, if

and ,

then

A fundamental property of the dot product is that when you take the dot product of a vector with itself, the result is the square of the length of the vector, i.e.

.

Therefore, the dot product provides us with one of the most important characteristics of a vector: it’s length. To whet your appetite a little, I hope that the expression above makes you think of “variance” or more specifically “standard deviation/volatility”. That is no coincidence!

The dot product of two distinct vectors also gives some very useful information

or

.

Note that lies between +1 and -1. Kind of like correlation. Again, not a coincidence!

#### Projecting One Arrow Onto Another

Once you start doodling with a bunch of arrows, you may start to think about the relationship between two arrows and, like a shadow, how might one arrow project onto another as shown below

If you recall a bit of trigonometry, the length of is given by

,

which may be written in terms of the dot product as

.

How about the ratio of that projection? That is determined by simply dividing the above by |A|, i.e.

.

This ratio is particularly of interest in finance, as I will show below, and is related to “portfolio beta”.

#### Portfolio Return as an Arrow

Now the fun starts and I hope at least one person in the universe reads this far down π

The return of a portfolio is a vector.

What?!?

Well, hear me out. Consider a portfolio consisting on securities. The return of the portfolio can be expressed in terms of the returns of the securities as follows

,

where is the weight of the th security in the portfolio.

Hmm, the security returns are multiplied by numbers and then added together. That sounds a whole lot like a vector to me!

Ok. If returns can be thought of as arrows, what are the meanings of the length and relative directions of two returns?

As we saw above, to determine the length and relative direction, we needed a dot product. What would be a good dot product for the vector space of security returns?

#### Covariance as a Dot Product

Technically speaking, covariance does not satisfy all the axioms of a dot product, but fortunately physicists like to shoot from the hip and tend to be right under most practical circumstances and in exotic cases where we are not right, we can usually change things around a bit so that we are right. So technical arguments aside, I am simply going to tell you that covariance can be thought of as a dot product on the vector space of security returns.

Woohoo! That is great. Why? Because all the nice pictures above can be re-interpreted in the context of portfolios of securities.

Here is an arrow depicting the return of a portfolio

What information is conveyed by the length of this arrow? Recall that

,

but if the dot product is covariance, then we get the very interesting association

,

i.e. **the length of the arrow is the volatility of the return**.

Next, consider the return of a benchmark against which this portfolio is to be measured. The benchmark return can similarly be represented as an arrow and we have

What is the meaning of the angle between the “portfolio arrow” and the “benchmark arrow”? Recall that

.

However, we also just learned that

so that the above expression can be rewritten as

,

which you might recognize as the definition of correlation. **The correlation between the portfolio return and the benchmark return is the cosine of the angle between the portfolio arrow and the benchmark arrow**.

That is pretty neat, eh? We now have a nice way to visualize both the volatility and correlation of security returns. The length of a “return arrow” is its volatility and the angle between two returns relates to their correlation. I couldn’t make up a better story if I tried π

But what can we do with this knowledge?

#### Tracking Error

The excess return of a portfolio of its benchmark is simply

,

which we can trivially rearrange as

The right hand side of the equation of above represents the addition of two arrows, which we already described above. Therefore, we can represent the expression visually as

This little trick seems kind of neat, but fairly trivial, so what did it give us? Recall that the length of an arrow is its volatility. Recall also that tracking error is defined as the volatility of the excess return, therefore we have the very cool consequence

.

We have a very concise way to visualize tracking error that captures both the volatility of the portfolio and the volatility of the benchmark as well as the correlation between the two in one simple diagram.

#### Portfolio Beta

“Now how much would you pay? But wait! There’s more!”

The same diagram above that gave you tracking error also gives you your portfolio beta. To see this, simply recall the definition of the projection of an arrow along another arrow and reinterpret that in terms of returns

or

,

where is the correlation between the portfolio and benchmark returns.

Next, if we consider the ratio of this projection to the length of the benchmark arrow, we have

,

which you might recognize as the definition of the portfolio beta! Therefore,

.

#### Conclusion

We’ve demonstrated, first, that returns can be visualized as arrows where the length of the arrow represents its volatility and the angle between two arrows represents the correlation of the two respective returns. Second, by comparing the portfolio and benchmark returns pictorially, we automatically get a very informative picture of both tracking error and portfolio beta (in one shot) that also contains information about the absolute market risk in terms of the volatilities (lengths) of the portfolio and benchmark arrows as well as the correlation between them.