---
title: "Probability mass, density, cumulative distribution function, quantiles, and moments"
author:
  - name: "Fan Wang"
    affiliation: "Department of Economics, University of Houston"
    url: "https://fanwangecon.github.io/"
date: "2026-11-30"
---

**Part of [Math Camp: An Introduction to Mathematics and Statistics with Applications in Economics](https://fanwangecon.github.io/Stam4Econ/).**  
[Main Stam4Econ site](https://fanwangecon.github.io/Stam4Econ/) | [View this section in the book](https://fanwangecon.github.io/Stam4Econ/stats_random_variable/overview.html#probability-mass-density-cumulative-distribution-function-quantiles-and-moments) | [Author: Fan Wang](https://fanwangecon.github.io/) | [DOI: 10.5281/zenodo.24696926](https://doi.org/10.5281/zenodo.24696926)  
Date: 2026-11-30 | [HTML](https://fanwangecon.github.io/Stam4Econ/htmlpdfq/stats_random_variable/cdf_pdf_pmf.html) | [PDF](https://fanwangecon.github.io/Stam4Econ/htmlpdfq/stats_random_variable/cdf_pdf_pmf.pdf) | [QMD](https://fanwangecon.github.io/Stam4Econ/htmlpdfq/stats_random_variable/cdf_pdf_pmf.qmd)

## Probability mass, density, cumulative distribution function, quantiles, and moments

### Probability mass function (pmf)

For a discrete random variable $X$, the probability mass function (pmf) gives the probability of each possible value:

$$
p_X(x) = P(X = x)
$$

where $p_X(x)$ is the pmf of random variable $X$.
The masses are nonnegative and sum to one over the support of $X$.

### Cumulative distribution function (cdf)

For a discrete or continuous random variable $X$, the cumulative distribution function (cdf) is defined as

$$
F_X(x) = P(X \leq x)
$$

where $F_X(x)$ is the cdf of random variable $X$.

The empirical cumulative distribution function (ECDF), constructed from observations $X_1,\ldots,X_n$, is

$$
\widehat{F}_n(x)=\frac{1}{n}\sum_{i=1}^{n}\mathbf{1}\{X_i\leq x\}.
$$

For discrete data, it can be computed by:

1. Count observations at each distinct value.
2. Sort the values from lowest to highest.
3. Divide the counts by $n$ and take their cumulative sum.

### Probability density function

If the distribution of $X$ is absolutely continuous with respect to Lebesgue measure, it has a density $f_X$ satisfying

$$
F_X(x)=\int_{-\infty}^{x} f_X(t)\,dt.
$$

The density is nonnegative and integrates to one. Where the CDF is differentiable, its derivative equals the density (up to changes on sets of measure zero). A density value is not itself a probability; probabilities are areas under the density:

$$
P(a \leq X \leq b) = \int_{a}^{b} f_X(x) dx
$$

For a fair four-sided die, $p_X(x)=1/4$ for $x=1,2,3,4$. One way to generate this discrete outcome is to draw $U\sim\operatorname{Uniform}(0,1)$ and assign each of four equal-length intervals of $U$ to one die outcome. Each interval has probability $1/4$ under the uniform density. This construction illustrates how areas under a continuous density can produce discrete probabilities; a pmf value is not generally the height of a pdf.


### Quantiles

For $0<\tau<1$, a standard quantile definition is the generalized inverse of the CDF:

$$
Q_X(\tau)=\inf\{x:F_X(x)\geq\tau\}.
$$

When the CDF is continuous and strictly increasing at the quantile, this definition gives $F_X(Q_X(\tau))=\tau$. In finite samples, statistical software may implement different interpolation conventions.

### First, second, third, and fourth moments

The $n$th raw moment, when it exists, is the expectation:

$$
E[X^n].
$$

For a discrete variable this expectation is a sum; for an absolutely continuous variable it is an integral against its density.

For integer $n\geq 2$, the $n$th central moment, when it exists, is:

$$
E[(X-\mu)^n].
$$

where $\mu$ is the mean of $X$.

The first moment is the mean. If the second moment is finite, the second central moment is the variance, equal to the second raw moment minus the squared mean:

$$
Var(X) = E[X^2] - (E[X])^2
$$

If the third absolute moment is finite and $\sigma>0$, standardized skewness is:

$$
Skewness = \frac{E[(X - \mu)^3]}{\sigma^3}
$$

where $\sigma$ is the standard deviation of $X$. The skewness can be positive, negative, or undefined. The sign describes the direction of the standardized third central moment, but does not uniquely characterize tail lengths or symmetry. Zero skewness does not in general imply a symmetric distribution.

Kurtosis is the standardized fourth central moment:

$$
Kurtosis = \frac{E[(X - \mu)^4]}{\sigma^4}
$$

The normal distribution has kurtosis 3. Excess kurtosis is kurtosis minus 3, so its excess kurtosis is zero. Kurtosis summarizes standardized fourth-moment behavior; it does not by itself imply a sharper peak or uniformly heavier tails.

