liveBook · Manning

Logarithmic return

As explained in Statistics Every Programmer Needs

A log return is the natural logarithm of the ratio of an asset's current price to its previous price, representing a compounded proportional price change.

A logarithmic return measures a compounded proportional price change by taking the natural logarithm of an asset’s current closing price divided by its previous closing price: ln(Pt / Pt−1). It supports multi-period compounding and provides a useful statistical representation of price movements. section 9.5.1 section 9.5.3

Compute and assess a daily log-return series as follows:

  • Align each closing price with the preceding price using shift(1), calculate np.log(Close / shifted Close), and remove the first missing value with dropna(). section 9.5.3
  • Inspect the distribution: values commonly cluster near zero, while longer tails indicate occasional larger positive or negative price changes. section 9.5.3
  • Estimate the mean as the average daily return and the standard deviation as daily volatility, then use both to generate simulated future returns. section 9.5.4

GM daily returns

For GM closing prices from July through December 2023, the estimated mean log return is approximately −0.00061 and the standard deviation is approximately 0.02005, indicating a slight downward historical trend and moderate daily volatility. section 9.5.4

How Statistics Every Programmer Needs covers it

How deep it goes
Defines the formula, implements it in Python, examines its distribution, and estimates mean and volatility for simulation.
Examples
Uses GM closing prices, a pandas log-return column, a density plot, and estimated mean and standard deviation.
What it assumes
Assumes historical closing-price data and basic Python data-frame operations while explaining the calculation from the price ratio.
What you can do after
Apply it via NumPy and pandas, then use estimated returns and volatility in a Monte Carlo forecast.
How it connects
Connects price changes with compounding, normal distributions, volatility, and Monte Carlo simulation.

Also explained in

Compare how 2 books explain logarithmic return →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Statistics Every Programmer Needs. The section links point to the parts of the book it draws on.