Integrals
An integral accumulates a quantity — most visually, the area under a curve. In epidemiology it is everywhere: the total number of cases over an outbreak is the area under the incidence curve, so cumulative incidence . In probability it is equally indispensable: the area under a density is a probability, the total area is , and an expected value is an integral.
Area under a curve
The definite integral of from to is the (signed) area between the graph of and the -axis:
It is defined as a limit of Riemann sums — slice into pieces of width , sum the rectangle areas, and let :
Definite vs. indefinite
- A definite integral is a number (an area).
- An indefinite integral is a function: the family of antiderivatives of , meaning . The constant appears because adding a constant does not change the derivative.
The Fundamental Theorem of Calculus
The FTC links the two operations of calculus. If is any antiderivative of (so ), then
In words: integration and differentiation are inverse processes. To find an area, find an antiderivative and evaluate it at the endpoints.
Worked example
Compute . An antiderivative of is (check: ). By the FTC,
Computing it
R
# Numeric integration with base R
f <- function(x) x^2
integrate(f, lower = 0, upper = 1)
# 0.3333333 with absolute error < 3.7e-15
Python
from scipy.integrate import quad
import sympy as sp
val, err = quad(lambda x: x**2, 0, 1)
print(val) # 0.33333333333333337
# Symbolic
x = sp.symbols("x")
print(sp.integrate(x**2, (x, 0, 1))) # 1/3
0.33333333333333337
1/3
Julia
using QuadGK
val, err = quadgk(x -> x^2, 0, 1)
println(val) # 0.3333333333333333
Why it matters for statistics
A continuous random variable has a probability density . Probabilities, the normalization condition, and the expected value are all integrals:
The cumulative distribution function is exactly an antiderivative of the density, so by the FTC . The same accumulation logic drives pharmacology: a drug’s total exposure (the AUC) is the integral of its concentration–time curve, .