Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 21

Bounding Expected Engagement with Jensen's Inequality

Recommended resources

Welcome back, Detective.

In our last session, we proved that we don't need complete data to draw powerful conclusions. By applying the Markov and Chebyshev inequalities to fragmented financial records, we established firm, provable bounds on client spending patterns, effectively putting a ceiling on a rival studio's exaggerated claims. You've demonstrated that even with just a mean, or a mean and variance, a sharp statistical mind can cut through the fog of incomplete information.

As we closed that file, we flagged another anomaly in the studio's archives: a cryptic note from a previous analyst about "client engagement hours." Instead of a simple average, the note reports the average of the logarithm of the hours. This is a peculiar choice. Why would someone transform data before averaging it? What does tell us, and how does it relate to ? Is this an error, or a sophisticated attempt to convey something subtle—or perhaps to conceal something?

Today, we'll solve this puzzle by exploring Jensen's inequality, a fundamental principle that governs the relationship between the expectation of a transformed random variable and the transformation of its expectation. This will not only allow us to decipher the analyst's note but also give us a new tool for setting bounds on unknown quantities, a crucial skill in any investigation built on partial evidence.

The Flaw of Averages

Before diving into the mathematics, let's build some intuition. We often assume that if we know the average of some input, we can just plug that average into a formula to get the average of the output. As you might suspect, reality is more complex. When the formula, or function, is non-linear, this intuition breaks down. This is often called the "flaw of averages."

The following video provides an excellent introduction to this concept, showing why 'average in' does not always lead to 'average out'.

Why Averages Are (Almost) Always Wrong: Jensen's Inequality and the Flaw of Averages

This video, "Why Averages Are (Almost) Always Wrong" from the RiskByNumbers channel, uses memorable examples to build a strong foundation for understanding Jensen's inequality.

First, watch the introduction, which uses a driving speed example to illustrate the core problem from the start. Then, follow the clear explanation of how non-linear functions behave differently from linear ones using a dice-roll game as an example. Finally, the video provides a superb visual definition of convex functions and a visual proof of the inequality that follows.

As the video demonstrated, the relationship between and depends entirely on the "shape" of the function . This is where the concepts of convexity and concavity become our primary clues.

  • A convex function is "bowl-shaped" upwards, like . A line segment connecting any two points on its graph lies above the function.
  • A concave function is "bowl-shaped" downwards, like or . A line segment connecting any two points on its graph lies below the function.

Jensen's inequality formalizes this relationship:

For a random variable and a function :

  1. If is convex, then .
  2. If is concave, then .

The function of the average is always "pulled" towards the flatter part of the curve, while the average of the function accounts for the more extreme values produced by the function's curvature.

This graph illustrates the inequality for the convex function \(\varphi(x)=x^2\). The green point, \(\varphi(E[X])\), is the function of the average. The magenta point, \(E[\varphi(X)]\), is the average of the function's values. As the inequality states for a convex function, the green point is below the magenta point.

To solidify this concept, the next video offers a crisp, elegant visual walkthrough of the inequality and its proof.

Jensen's Inequality

This video from the Mutual Information channel provides a concise and visually clear explanation of Jensen's inequality.

Watch the segment from the definition to see how the two sides of the inequality are calculated and visualized. Then, the video gives a brilliant intuitive proof from this point, explaining that the "gap" in the inequality is related to the function's curvature and the variable's variance.

Given your background, you may also appreciate a more formal, analytical proof. The following reading uses a Taylor series expansion to prove the inequality, a common technique in mathematical statistics.

Reminders

These notes from a Princeton course provide a rigorous proof and connect the inequality to the economic concept of risk aversion, which is relevant to your work in Bayesian Decision Theory.

Start by skimming the section Risk Aversion to see the connection to utility functions. Then, carefully study the section titled Jensen's Inequality for its concise definition and proof via Taylor's theorem.


Cracking the Analyst's Code

Now, let's apply this to the case. The cryptic note concerns the "Enigma" client group and reads: "Average of log-engagement-hours: 3.5". The studio management, unaware of the "flaw of averages," has interpreted this to mean the average engagement is simply hours. They are preparing a report based on this number. Let's verify their conclusion.

  1. The Random Variable: Let be the engagement hours of a randomly selected "Enigma" client.
  2. The Clue: We are given .
  3. The Function: The transformation is .
  4. The Function's Shape: The natural logarithm function is concave.
  5. Applying the Tool: For a concave function, Jensen's inequality states:
  6. Substituting and Solving: We substitute the value from the note: To solve for , we exponentiate both sides:

The Revelation: The management's assumption is wrong. The true average engagement, , is not equal to 33.1 hours, but is greater than or equal to 33.1 hours. The value reported by the analyst provides a lower bound for the true average engagement. This is a subtle but critical distinction. The analyst wasn't trying to hide a low number; their note, when correctly interpreted, actually suggests the average engagement is at least 33.1 hours.

This specific application of Jensen's inequality with the log function is famously used to prove the inequality of arithmetic and geometric means (AM-GM). The following reading explores this exact scenario.

A Gentle Introduction to Jensen's Inequality

This article from Machine Learning Mastery provides a practical walkthrough of several applications of Jensen's inequality.

Please read the section titled Arithmetic and Geometric Means Example. It directly addresses the case of a logarithmic transformation and shows how it relates the arithmetic mean (E[X]) to the geometric mean (\exp(E[\log X])).


A Second Clue: The Bonus Payout Puzzle

Let's test our understanding on another fragment of data. For the "Shadow" client group, we have a simple average: their mean engagement is 20 hours. A new incentive program promises a bonus payout to consultants proportional to the square of their client engagement hours. A manager has estimated the average bonus payout by simply squaring the average engagement: . Is this estimate accurate, or is it an over- or underestimate?

  1. The Random Variable: = engagement hours, with .
  2. The Function: The bonus is tied to .
  3. The Function's Shape: The square function is convex.
  4. Applying the Tool: For a convex function, Jensen's inequality states:
  5. Substituting:

The Revelation: The manager's estimate of 400 is an underestimate. The true average bonus payout, , is guaranteed to be greater than or equal to 400. The gap between and is, in fact, the variance of . The manager's simple calculation completely ignored the impact of variability in engagement hours, which will always push the average of the squared values higher.


Conclusion

Our investigation today has added a powerful and subtle tool to your arsenal. By understanding Jensen's inequality, we can now correctly interpret summary statistics that involve non-linear transformations and establish rigorous bounds on unknown quantities. This moves us beyond simple averages into a more nuanced understanding of how distributions behave under transformation.

Here are the key takeaways for your case file:

  • The "Flaw of Averages": For a non-linear function , plugging in the average input, , does not give you the average output, .
  • Jensen's Inequality provides the correction. The direction of the inequality depends on the function's shape:
    • For convex functions (, etc.): . The function of the average provides a lower bound on the average of the function.
    • For concave functions (, , etc.): . The function of the average provides an upper bound on the average of the function.
  • This principle allows a detective to spot misleading claims and derive bounds from transformed data, turning a potentially confusing clue into a piece of hard evidence.

Preview of the Next Lesson

We have now concluded our analysis of the static data in the "Arrangement Dispute" case file. From satisfaction scores to spending and engagement metrics, we have squeezed every drop of insight from these summary statistics.

But many of the mysteries at Elysian Moments unfold over time. In our next module, "The Booking Pattern Conspiracy," we will shift our focus from static snapshots to dynamic processes. We will begin by learning how to model the arrival of events—such as photoshoot booking requests—over time. This will allow us to ask crucial new questions: Is a sudden flurry of bookings a sign of success, or something more suspicious? Is a long silence between clients normal, or a signal of trouble? Our investigation is about to enter the dimension of time.