Change of measure: Girsanov, martingale representation and conditioned processes
Change probability measures on paths with Girsanov and Novikov, calculate KL divergence between diffusion laws, apply importance sampling to rare events, and study martingale representation and Doob's h-transform.
After this lesson you can
- Prove constant-drift Girsanov and apply it to change Brownian drift.
- Verify Novikov in examples and construct a strict-local-martingale counterexample.
- Calculate KL divergence between diffusions and connect it to a learned-drift loss.
- Estimate rare path-event probabilities with importance sampling and reduce variance.
- Derive Brownian bridge drift as an h-transform and simulate endpoint-conditioned diffusions.
Before you start
- 26Doléans-Dade stochastic exponentialItô's lemmaBrownian martingalesStochastic differential equationInfinitesimal generator of a diffusionKolmogorov backward equationBrownian bridgeLocalization and local martingales
- 04Radon-Nikodym theoremChange of measure
- 07Kullback-Leibler divergence (relative entropy)
- 29Importance sampling for rare events
- 09Monte Carlo error and confidence intervals
Changing path probabilities
In risk simulation you may need an event so rare that almost no path reaches it. In valuation you may work under another measure; in generative models you may compare complete path laws. In all three cases, changing measure assigns new weights to the same possible outcomes.
On a finite space, if , a new law is constructed by : for any function , and . Highly unequal weights do not change the identity, but make it difficult to estimate with a finite sample.
From a normal to Brownian motion with drift
Let be Brownian under and fix . For constant , define
The normal moment-generating function shows ; since , and are equivalent on . Completing the square in the density of gives under . For any partition, factorizes over independent Brownian increments; each increment shifts by and remains independent. By continuity, is Brownian under . This proof uses the law of every increment, not just one terminal distribution.
The figure uses terminal weights for earlier dates too: , so . The normalized weighted mean of a finite sample is a random ratio and is not generally unbiased. Effective sample size measures weight concentration, not guaranteed accuracy for every functional.
Girsanov and Novikov
Let be predictable, with almost surely. The stochastic exponential
is a positive local martingale. A sufficient condition for it to be a true martingale on is Novikov’s condition:
Then and Girsanov’s theorem states that is Brownian under defined by . Novikov is sufficient, not necessary. The general proof uses Itô’s product rule: after localization, covariation compensation turns into a local martingale under . Its quadratic variation is ; Lévy’s characterization identifies it as Brownian motion. For localization and integrability details see Lawler, chapter 5.
A local exponential need not have expectation one. Let be a three-dimensional Bessel process starting at 1. Its inverse satisfies and is a positive local stochastic exponential. However,
Therefore it is a strict local martingale: by itself it does not define a probability density with mass one. This example and its expectation appear in Föllmer and Protter; the Bessel calculation is also treated in Lawler, section 4.2. Here Novikov cannot hold on the horizon, because it would imply a true martingale. A sample average near one proves neither Novikov nor the martingale property.
Divergence between path laws
KL divergence between path laws quantifies separation between complete processes. Consider a nondegenerate scalar diffusion with coefficients measurable in time and state, the same initial law and . If under the process satisfies and under has drift , equivalence conditions and necessary integrability give
Here is a function of state and noise is recovered from the path through the equation. Direction matters: expectation is under , the numerator law. In several dimensions, with square invertible diffusion matrix, use . The stochastic integral under must have zero expectation for this equality; formally writing the square is insufficient. If initial laws differ, initial KL also appears. With noise unobservable in , KL of observed paths can be smaller than that of the underlying noise space.
For example, if is a reference law with known drift and a model with drift , the same initial law and common scalar diffusion , minimizing is equivalent, under the same assumptions, to minimizing expectation under of . This explains a diffusion-weighted quadratic drift loss. Applying the idea to a generative model requires identifying its reference law, time direction and boundary terms; swapping measures is insufficient.
Quadratic variation is a path property. An equivalent measure does not change an almost-sure quadratic-variation identity: for example, Brownian motions with two distinct positive constant volatilities have singular laws on continuous path space because their deterministic quadratic variations differ. This does not justify claiming singularity for every pair of distinct coefficients without analyzing the laws.
Importance sampling in path space
Path importance sampling uses, for event , if is absolutely continuous with respect to . To simulate a rare rise, can shift drift toward the barrier; each path is corrected with its likelihood ratio. Excessive shifting can produce highly unequal weights and increase variance. The ideal zero-variance proposal would be the conditional law of given : it weights the measure restricted to , since is not absolutely continuous with respect to that proposal outside the event. Constructing it requires information we normally seek to estimate.
The figure uses exact OU transitions at the nodes and stops the weight at the first observed crossing. It estimates the grid event, which may miss a continuous crossing. A standard error calculated from few hits can be unreliable; zero hits do not prove zero probability. In the lab below we use a Brownian-specific conditional correction for continuous crossing.
In rare-event simulation you will again choose proposals and measure bias, variance and cost jointly.
Representation and conditioning
The martingale representation theorem says that in the usual augmentation of the Brownian natural filtration, every square-integrable martingale admits
with predictable and unique except on sets of measure zero. In finance, under a pricing measure and complete market with nondegenerate discounted-asset volatility, that integrand constructs a replicating portfolio. A richer filtration or incomplete market requires additional assumptions.
The Doob h-transform reweights a diffusion to describe conditioning. For Brownian motion starting at and ending at at , take , the transition density to . Then
The product rule introduces the Hessian cross term; for time-dependent , the backward equation of cancels additional time terms. Since here , the resulting drift is
Drift grows approaching the end and is not evaluated at . Since , the bridge is defined through a regular conditional distribution, not division by that probability. An exact construction at nodes is ; it satisfies and has covariance .
The same principle describes a diffusion conditioned to exit through part of the boundary: with and , drift changes to , with , until exit under suitable assumptions. For the bridge, also depends on remaining time. Time reversal of generative diffusions and Schrödinger bridges also change path laws, with their own conditions and terms; they are not automatically this Brownian bridge. Control as inference connects decisions and changes of measure when model and cost assumptions hold.
Lab: weights, Novikov and divergence
Construct complete paths under and evaluate at three dates. For constant , Novikov is checked analytically: its expectation is . Mean weights and weighted mean in a simulation illustrate the identity but do not replace proof. The theoretical variance of is .
import numpy as np
from scipy.stats import norm
rng=np.random.default_rng(2929)
m,steps,T,theta=6000,64,2.,.6
dt=T/steps
increments=rng.normal(size=(m,steps))*np.sqrt(dt)
paths=np.column_stack((np.zeros(m),np.cumsum(increments,axis=1)))
for i in (16,32,64):
t=i*dt
z=np.exp(theta*paths[:,i]-.5*theta**2*t)
weighted=np.sum(z*paths[:,i])/np.sum(z)
print("t, media de pesos, media ponderada, objetivo, ESS:",
t,z.mean(),weighted,theta*t,z.sum()**2/np.sum(z*z))
print("Novikov exacto y varianza exacta de Z_T:",
np.exp(.5*theta**2*T),np.expm1(theta**2*T))The next cell directly simulates law to estimate . The same calculation with expectation under would have another direction and sign.
m=50000
terminal_q=theta*T+np.sqrt(T)*rng.normal(size=m)
log_density=theta*terminal_q-.5*theta**2*T
kl_sample=log_density.mean()
kl_se=log_density.std(ddof=1)/np.sqrt(m)
kl_exact=.5*theta**2*T
print("KL(Q||P), error estándar y valor exacto:",kl_sample,kl_se,kl_exact)
assert abs(kl_sample-kl_exact)<5*kl_seThe norm of a three-dimensional Brownian motion starts at . Its reciprocal at has expectation strictly less than one, although it is a positive local martingale. The exact formula lets us check the example without interpreting a sample estimate as proof.
vectors=rng.normal(size=(80000,3))
vectors[:,0]+=1.
inverse=1/np.linalg.norm(vectors,axis=1)
exact=2*norm.cdf(1)-1
se=inverse.std(ddof=1)/np.sqrt(len(inverse))
print("inverso Bessel, media, error estándar y esperanza exacta:",
inverse.mean(),se,exact)
assert abs(inverse.mean()-exact)<5*seLab: ruin and a continuous barrier
Consider reserves and ruin before if . After changing sign and scale, this is equivalent to reaching , with . We simulate only and use the conditional crossing probability of a bridge to integrate crossings between dates exactly.
Under the proposal, and ratio is . Given the endpoint, the bridge does not depend on constant drift. If , conditional crossing probability is ; if it equals one. Multiplying by that probability is a conditional Monte Carlo version: it reduces variance for each proposal, but does not guarantee every improves on the original proposal.
x0,c,sigma,T=3.,.3,1.,1.
a=x0/sigma
mu=-c/sigma
sample_size=60000
def crossing_contribution(theta,size,rng):
y=(mu+theta)*T+np.sqrt(T)*rng.normal(size=size)
bridge=np.ones(size)
below=y<a
bridge[below]=np.exp(-2*a*(a-y[below])/T)
weights=np.exp(-theta*(y-mu*T)+.5*theta**2*T)
return weights*bridge
direct=crossing_contribution(0.,sample_size,rng)
shifted=crossing_contribution(2.5,sample_size,rng)
truth=norm.cdf((mu*T-a)/np.sqrt(T))+np.exp(2*mu*a)*norm.cdf((-mu*T-a)/np.sqrt(T))
for name,values in (("directo",direct),("propuesta",shifted)):
se=values.std(ddof=1)/np.sqrt(len(values))
print(name,"media, error estándar y error relativo estimado:",
values.mean(),se,se/values.mean())
assert abs(values.mean()-truth)<5*se
print("probabilidad continua exacta:",truth)
print("cociente de varianzas muestrales directo/propuesta:",
direct.var(ddof=1)/shifted.var(ddof=1))The printed ratio applies to this configuration and sample: it compares contribution variances with equal simulation counts and can change when the proposal changes. This bridge formula is exact for a constant barrier of Brownian motion with constant drift. Do not transfer it to OU or a moving barrier without proof. If computing weights over many steps, use logarithms to control overflow and retain independence between paths.
Exercises
Step 1 of 3. How is the density factor of an increment ΔB of duration h expressed?
Step 1 of 3. What is the spatial derivative of log h?
import numpy as np
def is_hitting_probability(level,T,theta,n,seed=29):
passGirsanov changes drift by reweighting equivalent laws, while quadratic variation remains tied to the path. Controlling normalization and weight variance is as important as applying the formula; conditioning a diffusion requires specifying the imposed event or endpoint.
print("KL con deriva 0,5 en [0,1]:",.5*.5**2)