To illustrate the concept of log returns, we are going to demonstrate the concepts with the help of two Python libraries: pandas and NumPy. To begin w

How to illustrate log returns vs simple returns

submited by
Style Pass
2024-03-30 00:00:08

To illustrate the concept of log returns, we are going to demonstrate the concepts with the help of two Python libraries: pandas and NumPy.

To begin with, the key benefit of using financial returns instead of prices is normalization which allows us to measure and compare all financial instruments and assets. This is also a requirement for many multidimensional statistical analyses and advanced machine-learning techniques.

In Pandas, we calculate simple returns with an in-built pandas function pct_change that calculates percentage change and use numpy log to calculate log returns in addition to pandas diff, which takes the difference of the time series.

We call Pandas DataFrame describe method to generate descriptive statistics. The output of this method will provide detailed statistics in the form of mean, standard deviation, median, and quartiles.

The main advantage of log returns is that we can easily aggregate them across time, unlike simple returns. For instance, the log return for a year is the sum of the log returns of the days within the year. Additionally, log returns are symmetric around 0, and log return values can range from minus infinity to plus infinity. whereas simple returns' downside is limited to -100%, a negative movement of -25% (movement from 100 USD to 75 USD) does not reverse the losses by going +25% (75 USD to 93.75 USD).

Leave a Comment