Site icon R-bloggers

Returns with negative net asset values

[This article was first published on Portfolio Probe » R language, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

How are returns calculated when net asset value goes negative?

Previously

In “A tale of two returns” we highlighted the similarities and differences of log returns versus simple returns.

Positive valuation

We create — in R — an example of net asset value at four times:

> nav1 <- c(1000, 900, 950, 1010)
> nav1
[1] 1000  900  950 1010

Now we can compute the log (continuously compounded) returns:

> lret1 <- diff(log(nav1))
> lret1
[1] -0.10536052  0.05406722  0.06124363

For log returns the sum of sub-period returns is the whole period return:

> sum(lret1)
[1] 0.009950331
> diff(log(nav1[c(1,4)]))
[1] 0.009950331

We can also compute the simple returns:

> sret1 <- nav1[-1]/nav1[-4] - 1
> sret1
[1] -0.10000000  0.05555556  0.06315789

Combining sub-period returns is a little more involved for simple returns:

> prod(sret1 + 1) - 1
[1] 0.01
> nav1[4]/nav1[1] - 1
[1] 0.01

The range of possible log returns is minus infinity to plus infinity. When the final price is zero, then the log return is minus infinity.

Minus infinity to infinity in log returns maps into minus one to plus infinity for simple returns. When the final price is zero, then the simple return is minus 1.

Negative net asset value

The view so far is that you can not lose more than you have.

If only.

Here is an example where the net asset value dips below zero:

> nav2 <- c(1000, 400, -200, 300)
> nav2
[1] 1000  400 -200  300

We can try to compute log returns:

> lret2 <- diff(log(nav2))
Warning message:
In log(nav2) : NaNs produced
> lret2
[1] -0.9162907        NaN        NaN

NaN stands for Not-a-Number — that is, there was a calculation of indeterminate value.

The image we get from this is that negative net asset value is a black hole — once we cross that event horizon there is no coming back.  That may or may not be true.

We can compute simple returns:

> sret2 <- nav2[-1]/nav2[-4] - 1
> sret2
[1] -0.6 -1.5 -2.5

The second return, -1.5,  is a reasonable answer — in that period we lost 1.5 times the value we started with.  The last return is problematic though; conventional thinking says it should be positive — it is not.

Does time aggregation work for the simple returns?

> prod(sret2 + 1) - 1
[1] -0.7
> nav2[4]/nav2[1] - 1
[1] -0.7

Yes.  Even though we had a questionable value, something is going right.

Going Farther

So far in negative-NAV land we have log returns bombing out and simple returns seeming a little flaky.

The problem with log returns was that we were trying to take the logarithm of a negative number.  That can be done if you allow complex numbers.  Let’s try it:

> lret2c <- diff(log(as.complex(nav2)))
> lret2c
[1] -0.9162907+0.000000i -0.6931472+3.141593i  
[3]  0.4054651-3.141593i

Now we get something that looks weird but seems promising:

> sum(lret2c)
[1] -1.203973+0i
> diff(log(nav2[c(1,4)]))
[1] -1.203973

The imaginary part is keeping track of whether we are going from positive to negative, negative to positive, or neither.

Here are more examples:

> nav3 <- c(1000, -200, -250, -100, 300)
> lret3c <- diff(log(as.complex(nav3)))
> lret3c
[1] -1.6094379+3.141593i  0.2231436+0.000000i
[3] -0.9162907+0.000000i  1.0986123-3.141593i
> nav4 <- c(1000, -200, -250, -400, 300)
> lret4c <- diff(log(as.complex(nav4)))
> lret4c
[1] -1.6094379+3.141593i  0.2231436+0.000000i
[3]  0.4700036+0.000000i -0.2876821-3.141593i

The sign of the real part of the log returns is determined by the relative size of the absolute values of the valuations.

There is a formula for switching from log returns to simple returns. What happens when we do this with our complex-valued log returns?

> sret2c <- exp(lret2c) - 1
> sret3c <- exp(lret3c) - 1
> sret4c <- exp(lret4c) - 1
> sret2c
[1] -0.6+0i -1.5+0i -2.5-0i
> sret3c
[1] -1.20+0i  0.25+0i -0.60+0i -4.00-0i
> sret4c
[1] -1.20+0i  0.25+0i  0.60+0i -1.75-0i
> nav3[-1]/nav3[-5] - 1
[1] -1.20  0.25 -0.60 -4.00
> nav4[-1]/nav4[-5] - 1
[1] -1.20  0.25  0.60 -1.75
> prod(sret2c + 1) - 1
[1] -0.7+0i
> prod(sret3c + 1) - 1
[1] -0.7-0i
> prod(sret4c + 1) - 1
[1] -0.7+0i

It works (modulo weird signs).

Exact zeros are problematic, however.

> nav5 <- c(1000, 200, 0, 300)
> diff(log(as.complex(nav5)))
[1] -1.609438+0i      -Inf+0i       Inf+0i
> sum(diff(log(as.complex(nav5))))
[1] NaN+0i
> nav5[-1]/nav5[-4] - 1
[1] -0.8 -1.0  Inf
> prod(nav5[-1]/nav5[-4]) - 1
[1] NaN

Beautiful equation

The complex-valued log returns may remind you of what some people consider the most beautiful equation in mathematics:

e + 1 = 0

known as Euler’s identity.

Summary

It’s better to keep your NAV positive.

Appendix R

A more general way of computing simple returns (one of many) is:

tail(nav1, -1)/head(nav1, -1) - 1

This form works not only on vectors but also on matrices where the rows correspond to times and the columns are assets (or portfolios).

To leave a comment for the author, please follow the link and comment on their blog: Portfolio Probe » R language.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.