Know Your Time Series

I recently saw this chart (below) from PNAS.  It’s one of those popular psych studies that asks “does having more money make people happier?”  They discovered that higher annual income does indeed make people happier, but in a logarithmic relationship.  This reinforces something I wrote in Sensitivity Testing Model Assumptions, namely: know your time series.

In today’s post, I’ll explain about log scales using an example from stock trading, and then circle back to the happiness data.  I’ll wind up with an example from my own experience, contrasting exponential versus polynomial functions.  You may also want to check out my earlier posts on seasonal adjustment, and Bayesian probability.

“When interpreting these results, it bears repeating that well-being rose approximately linearly with log(income), not raw income”

Reported “life satisfaction” and “well-being” increase linearly with log income, not straight income.  That is, the next notch up in happiness requires an order of magnitude more money.  Previous studies had found a plateau around $75,000, with little or no increase in happiness after that.

So, this is a new finding – or is it?  Take another look at that income scale.  If that were a straight scale, the chart would show diminishing returns from additional income.  To enjoy steadily increasing happiness, you have to earn exponentially increasing income.

Log Scaling for Stock Charts

Here is a chart of Carvana during 2018, when the stock was rising rapidly.  Comparing the tiny candles in March with the longer ones in June and beyond, you might conclude that the stock had become more volatile.  The average daily trading range increased from one dollar to three over the period.

But a dollar when the stock is at $20 is not the same as a dollar when the stock is at $60.  To have the candles represent percentage change, you must set the price scale to logarithmic.  See, in the chart below, how the price intervals get closer together as they proceed up the scale.

Whenever a stock chart covers a wide price range, you’re better off using a logarithmic scale.  You may recall from school that adding logs is the same as multiplying the numbers.  So, a linear scale shows additive change, and a log scale shows relative change.

log ab = log a + log b

Take another look at the first Carvana chart above.  Stock traders call that “going parabolic.”  Parabolic growth, also known as “quadratic,” is another rapid growth trend, easily confused with exponential growth.  I did a quick regression analysis, and both models fit the Carvana data pretty well.

Pro tip: Never use “exponential” to describe something that’s not a time series.  Some people seem to think it just means “big,” as in “last month was exponential!”

The point to “know your time series” is to understand the mechanisms underlying your data.  Exponential growth comes from compounding, like if you increase sales by ten percent, and then you increase the new, higher, base by another ten percent – and you keep doing that.

Steadily Increasing Happiness

I’ll provide an example of quadratic growth later, but first let’s finish up the PNAS chart.  I think of this as a time series because I picture someone earning steadily more income over their career (the data is actually different people at different income levels).

When I say “steadily more income,” I mean exponentially.  Note that each tick mark on the PNAS income scale doubles the value.  This is a log scale, like the Carvana price scale, above.

Many real-world metrics are based on log scales, like decibels and the Richter scale.  An earthquake of magnitude 6.0 on the Richter scale is ten times as powerful as a 5.0.

The chart below shows what this blessed career looks like.  If you start making $15,000 at age 18 and double your salary every six years or so, then you will experience steadily increasing “well-being.”  My red line is the same red line as in the PNAS chart.

I think showing the data as someone’s career is a good way to tell the story.  Income and well-being are shown together, with straight scales, and mediated by the hypothetical age.  On the other hand, the correlation has disappeared.  To show that, we must apply a log scale to the income series:

This is why the authors make clear that, to enjoy steadily increasing (linear) happiness, you must earn steadily increasing (exponential) income.  To put it another way, if you only earn increasing (linear) income, then you will have only increasing (log) happiness.

Many real-world metrics are based on log scales, like decibels and the Richter scale.  An earthquake of magnitude 6.0 on the Richter scale is ten times as powerful as a 5.0.

Polynomial versus Exponential Functions

Once upon a time, way back when databases had size constraints, I observed that parabolic growth in BMW Financial lease transactions would pose a danger to the database.  I ran a regression analysis, calculated when the database would fail, and sent a memo to my boss.

I also worked out a mitigation strategy, but let’s stick with, “the database will blow up on April 21,” for dramatic effect.  Instantly my office filled up with expensive auditors and consultants.

“No, it’s not a malfunction.”

“No, it’s not growing exponentially.”

Lease transactions were growing quadratically, which is why I chose this example.  If new leases are steady at 1,200 per month, that’s a flat line.  Total rows in the lease table will thus increase by 1,200 per month.  That’s a sloping line.

Now, if each lease generates roughly two transactions per month, then total transactions will be a parabola.  Readers with a little calculus will recognize this as integrating, twice, from the constant rate of new leases to the second-order rate of transactions.

This is the essence of “know your time series.”  The regression analysis showed quadratic growth, unequivocally, and it was also supported by how we expected the data to behave.

The auditors milled around for a while, charged us about a million bucks, and decided I was panicking over nothing because the database wasn’t really going to blow up until April 29.  Not to mention my mitigation strategy.

Big O Notation

In the example above, I showed that a linear function of a linear function is a parabola, also known as a “quadratic” or second-order polynomial.  Compose another linear function on top of that, and it’s a third-order polynomial.

Excel has a handy feature, shown below, for fitting polynomial functions of different order.  This is a little dangerous, because you can easily find a fit without thinking about it.  It’s not enough to get a good R-Square (fit) value.  You must understand why the data behaves as it does.

This “order” thing is sufficiently important to data analysts that they have a notation for it, called “Big O.”  The quadratic example we just worked through would be O(n2) or “order n-squared.”  I notice that Excel will also fit a Power Law, or “Pareto” series.  That will have to wait for a later post.

Author: Mark Virag

Management consultant specializing in software solutions for the auto finance industry.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: