This is the density of N(θ,1). Hence under Q, X∼N(θ,1).
Part 3
EQ[X]=EP[ZX]=e−θ2/2EP[XeθX]. By differentiating the MGF: EP[XeθX]=d/dθ(eθ2/2)=θeθ2/2. So:
EQ[X]=e−θ2/2⋅θeθ2/2=θ.✓
EQ[X2]: second derivative of MGF at θ: d2/dθ2(eθ2/2)=(1+θ2)eθ2/2. So EP[X2eθX]=(1+θ2)eθ2/2, and EQ[X2]=(1+θ2).
Match to N(θ,1): E[X]=θ, E[X2]=θ2+1. ✓ ✓
Part 4
Importance-sampling simulation.
import numpy as np
rng = np.random.default_rng(0)
N = 100_000theta = 4# Under Q, X ~ N(theta, 1). Generate samples:X_Q = theta + rng.standard_normal(N)
# Importance-sampling weight:w = np.exp(-theta * X_Q + 0.5 * theta**2)
# Estimate of P(X > 4) under P:estimate = (w * (X_Q > 4)).mean()
print(estimate)
# 3.17e-05 — matches Phi(-4) exactly
Compare to naive Monte Carlo: for N=105 draws of N(0,1), the expected number of exceedances above 4 is 105⋅3.17⋅10−5≈3 — highly variable, likely 0 or 1. IS's variance is orders of magnitude smaller for this rare-event problem.
Takeaways
"Normal shift" is the discrete-time Girsanov. Multiplying the P-density by eθX−θ2/2 shifts the mean from 0 to θ.
EP[Z]=1 is the mandatory check. Every Radon-Nikodym derivative must integrate to 1 — else Q is not a probability measure.
Importance sampling is Radon-Nikodym made practical. Sample under the "easy" measure Q that puts mass where the event occurs, then re-weight by 1/Z to get an unbiased estimator for the rare event under P.
The variance reduction is exponential in θ2. For tail probabilities of order e−θ2/2, IS drops the Monte Carlo variance by the same exponential factor.