Functions of Random Variables and Random Variable Generation
Core Titles
Key headlines and terms for quick recall- Transformation
- Discrete case:
- Continuous, monotonic :
- Inverse Transform Sampling with
- Common transformations: linear, square, exponential
Basic Idea
What it is, why it matters, how it worksWhy transform RVs?
We model with simple RVs (e.g., uniform, normal) and then transform them to get the distribution we need. Examples:
- Standardising .
- Generating samples from any distribution from uniform random numbers.
- Variance-stabilising transformations.
Discrete case
For with discrete:
Continuous case (monotonic )
If is differentiable and strictly monotonic with inverse :
For non-monotonic , split the domain into monotonic pieces and add contributions.
Linear transformation
():
If then .
Inverse-transform sampling
Goal: generate samples from any distribution with CDF .
Method.
- Sample .
- Compute .
Then has CDF , since .
Example. Exponential(): , so . Generate , return .
Why this matters in Data Science
Monte Carlo simulation, parametric bootstrap, random sampling from any distribution, generative models.
Mind Map
Visual structure of the conceptFUNCTIONS OF RANDOM VARIABLES
├── Y = g(X)
├── Discrete
│ └── P(Y=y) = Σ_{x: g(x)=y} P(X=x)
├── Continuous (monotonic g)
│ └── f_Y(y) = f_X(g⁻¹(y)) · |d g⁻¹/dy|
├── Linear Y = aX + b
│ └── f_Y(y) = (1/|a|) f_X((y−b)/a)
└── Inverse-Transform Sampling
├── U ~ Uniform(0,1)
├── X = F⁻¹(U)
└── X has CDF F
Exam Q&A
Part A (2 marks) and Part B (20 marks) style questionsPart A (2 marks each)
Q1. State the change-of-variable formula for continuous monotonic transformation. .
Q2. If , find the distribution of . .
Q3. What is inverse-transform sampling? A technique to sample from distribution with CDF : take and set .
Q4. Generate an exponential sample. For Exp(), with .
Part B (20 marks)
Q. Derive the change-of-variable formula for a continuous random variable. Explain the inverse-transform sampling method with proof. Show how to generate samples from Exp() using a uniform RV.
Change-of-variable formula.
Let have density and let be a strictly monotonic, differentiable function with inverse . Define . The CDF of :
Case increasing: .
Differentiating both sides w.r.t. using the chain rule: .
Case decreasing: the inequality flips, giving a minus sign. Combining:
Inverse-transform sampling.
Theorem. If is a continuous strictly increasing CDF and , then has CDF .
Proof. For any , (the last step uses ). Hence has CDF . ∎
Generating Exp().
CDF: , .
Invert: set ⇒ .
Algorithm.
- Draw .
- Return .
Then . (Equivalently works because is also uniform on .)