Home | Command Reference | Run Example

LOG Command

The LOG command transforms a time series by taking the natural logarithm of each observation. It is one of the most common transformations in economics and finance because it converts exponential growth into a more linear trend and makes percentage changes easier to analyze.

Main idea: Many economic series such as GDP, money supply, corporate earnings, and prices grow exponentially over time. Taking the logarithm compresses the scale and often reveals underlying growth patterns more clearly.

Example


LOG(GDP)

This example transforms Gross Domestic Product into its natural logarithm. The resulting series is often easier to visualize, model, and compare across long periods of time.

Syntax


LOG(series)

Mathematical Definition

For a time series X, the LOG function applies the natural logarithm (base e) to each observation, where e ≈ 2.71828.


LOG(Xt) = ln(Xt)

Why Use LOG?

Many financial and economic time series exhibit long-term exponential growth. Examples include GDP, stock market indices, money supply, and corporate revenues.

Applying LOG often converts these exponential trends into approximately linear trends, making visual analysis, regression modeling, and forecasting more effective.

In addition, differences of logarithms approximate percentage changes:


LOG(Xt) - LOG(Xt-1) ≈ Percentage Growth Rate

This property makes logarithmic transformations particularly useful when studying growth and returns.

Common Applications

Example: GDP Growth Linearized


LOG(GDP)

Instead of viewing GDP on its original exponential scale, the logarithmic transformation produces a series that often appears nearly linear, making long-term growth trends easier to interpret.

Script Example


LOG_GDP = LOG(GDP)
PLOT(LOG_GDP)

Related Commands