
Member-only story
Data Science, Editorial, Machine Learning, Programming, Statistics
Moment Generating Function Tutorial
A tutorial diving into the Moment Generation Function for probability distribution with a complete derivation and code examples in Python
Author(s): Pratik Shukla, Roberto Iriondo
Last updated, January 8, 2021
This tutorial’s code is available on Github and its full implementation as well on Google Colab.
Table of Contents:
- Moments in Statistics.
- Raw Moments.
- Centered Moments.
- Standardized Moments.
- Moment Generating Function.
- Proof of Moment Generating Function.
- Derivation of Relationship between Raw and Central Moments.
- Python Implementation.
📚 Check out our editorial suggestions on the best machine learning books. 📚
What is a Moment in Statistics?
We generally use moments in statistics, machine learning, mathematics, and other fields to describe the characteristics of a distribution.
Let’s say the variable of our interest is X then, moments are X’s expected values. For example, E(X), E(X²), E(X³), E(X⁴),…, etc.

Moments in statistics:
1) First Moment: Measure of the central location.
2) Second Moment: Measure of dispersion/spread.
3) Third Moment: Measure of asymmetry.