Numerical Approximation and Integration
Part of Math Camp: An Introduction to Mathematics and Statistics with Applications in Economics.
Main Stam4Econ site | View this section in the book | Author: Fan Wang | DOI: 10.5281/zenodo.24696926
Date: 2026-11-30 | HTML | PDF | QMD
1 Numerical Approximation and Integration
1.1 Expectation of the standard normal
The pdf of a standard normal distribution is:
\[ \phi(x) = \frac{1}{\sqrt{2\pi}} e^{-\frac{x^2}{2}} \]
The expected value of a standard normal random variable is:
\[ \int_{-\infty}^{\infty} x \cdot \phi(x) \, dx \]
We approximate this integral using numerical integration, specifically Gauss–Hermite quadrature, and also show that the exact value is zero because the integrand is an odd function over a symmetric interval.
1.2 Integration by point-wise simulation
Perhaps the most reliable method to integrate is to simulate. Integration is just a weighted average, with weights determined by area below the density curve in the case of a continuous random variable. If we draw randomly many times from the correct distribution, and then compute the relevant average statistics, we have approximated the integral.
How do we do this with the normal random variable? The value of \(x\) can be drawn from \(-\infty\) up to \(\infty\), how can we randomly draw? We start from the uniform:
- Draw randomly from the uniform distribution between 0 and 1, think about this as randomly drawing from quantile indexes.
- Map from uniform draws to random draws from the normal distribution, by inverting the uniform randomly drawn values via the inverse cumulative distribution function (CDF) of the normal distribution.
- Compute the average of the function values at these random draws to approximate the integral. The statistic for the expected value of the normal random variable is just the value of the random normal draw themselves, which we will average over.
In turns out that in many settings, we can draw randomly from the distribution we are interested in using the appropriate CDF inversion, note that the range of the CDF function is always between 0 and 1.
Generally integration by numerical simulation is reliable and helps us to integrate complex distributions with arbitrary shapes. But this is potentially expensive, requiring a large number of random draws and evaluation to achieve high accuracy.
1.3 Integration by polynomial approximation
Archimedes tells us that we can approximate the area of a circle by summing up the areas of many triangles. Riemann tells us that we can approximate the area below any curve as the sum of rectangles.
So a branch of calculus integrates by finding approximate sub-geometries whose area we know how to compute, and summing the areas of these sub-geometries to approximate the overall integral of interest.
Integration by Newton-Cotes quadrature follow these methods, except that they are not about the adding up of triangles and rectangles, but approximating unknown area with areas we can compute exactly when the curve follows a polynomial. Why polynomial? Because we know that \(\frac{d A X^{\alpha}}{dx} = \alpha A X^{\alpha-1}\), so we can integrate polynomials exactly. Remember that polynomials are linearly additive, a 3rd order polynomial is:
\[ y(x) \approx \widehat{y}(x) = a_0 + a_1 x + a_2 x^2 + a_3 x^3\,. \]
The integral of the above function between \(x=1\) and \(x=2\) is:
\[ \int_1^2 (a_0 + a_1 x + a_2 x^2 + a_3 x^3) \, dx = a_0 + \frac{3}{2} a_1 + \frac{7}{3} a_2 + \frac{15}{4} a_3 \]
If we have four points of \(x\) values between \(x=1\) and \(x=2\), we can evaluate the corresponding \(y\) values for \(y(x)\), and then pin down the coefficients \(a_0, a_1, a_2, a_3\). Now we have a polynomial, \(\widehat{y}(x)\), that exactly fits our four points, and that provides generally a good approximation of the actual curve \(f(x)\). So it turns out that polynomials are as convenient to deal with as rectangles and triangles in terms of finding areas.
Given \(N\) distinct nodes and the function values at those nodes, there is a unique interpolating polynomial of degree at most \(N-1\). Integrating that polynomial gives a quadrature approximation to the integral of the original function.
Gauss-Hermite quadrature is a Gaussian quadrature rule designed for integrals with a Gaussian weight, so its nodes are not equally spaced. With \(N\) nodes, the rule integrates exactly every polynomial of degree at most \(2N-1\) when the integrand is multiplied by the corresponding weight. This exactness is a property of the quadrature rule; it does not mean that the \(N\) sampled points determine a polynomial of degree \(2N-1\). For the standard normal expectation, a change of variables maps the normal density to the physicists’ Hermite weight, and the resulting nodes and weights provide an efficient approximation.