Define and sample a truncated normal

Read the full interview experience this question came from →

Quick Overview

This question evaluates proficiency with probability distributions and Monte Carlo sampling techniques in the Statistics & Math domain, focusing on the truncated normal distribution, its normalized pdf/cdf, and the design and comparison of samplers for moderate and extreme tail regimes.

Define and sample a truncated normal

Company: Google

Role: Data Scientist

Category: Statistics & Math

Difficulty: medium

Interview Round: Technical Screen

Define the truncated normal Z | a < Z < b for Z ~ N(0,1): write the normalized pdf and cdf. Then design efficient samplers for three cases: (i) a = 1, b = +∞; (ii) a = 4, b = 4.05; (iii) a = 4, b = +∞. For each, compare inverse-CDF sampling (draw U ~ Uniform(Φ(a), Φ(b)), set X = Φ^{-1}(U)) to simple rejection sampling from N(0,1) by computing the expected acceptance rate (1−Φ(1), Φ(4.05)−Φ(4), 1−Φ(4)). Propose an algorithm suitable for extreme tails (e.g., exponential or half-normal proposals with acceptance–rejection), discuss numerical stability when evaluating Φ and Φ^{-1} near machine precision, and explain how you would validate the sampler (KS test on back-transformed uniforms, moment checks).

Overview: This question evaluates proficiency with probability distributions and Monte Carlo sampling techniques in the Statistics & Math domain, focusing on the truncated normal distribution, its normalized pdf/cdf, and the design and comparison of samplers for moderate and extreme tail regimes.

Read the full Google Data Scientist interview experience this question came from

Google logo
Google
Oct 13, 2025
mediumData ScientistTechnical ScreenStatistics & Math
9
0

Define the truncated normal Z | a < Z < b for Z ~ N(0,1): write the normalized pdf and cdf. Then design efficient samplers for three cases: (i) a = 1, b = +∞; (ii) a = 4, b = 4.05; (iii) a = 4, b = +∞. For each, compare inverse-CDF sampling (draw U ~ Uniform(Φ(a), Φ(b)), set X = Φ^{-1}(U)) to simple rejection sampling from N(0,1) by computing the expected acceptance rate (1−Φ(1), Φ(4.05)−Φ(4), 1−Φ(4)). Propose an algorithm suitable for extreme tails (e.g., exponential or half-normal proposals with acceptance–rejection), discuss numerical stability when evaluating Φ and Φ^{-1} near machine precision, and explain how you would validate the sampler (KS test on back-transformed uniforms, moment checks).