Statistics [25]: From Uniform to General Distributions
Published:
General practice of converting a uniform distribution to a general distribution.
Theorem
Assume , function is a monotone increasing function, and for ,
Then, the probability distribution function of is .
Example 1
Generate an exponential distribution with parameter from uniform distribution .
Firstly, the probability distrbution function of the exponential function is
It can be easily verified that is a monotone increasing function, hence
which can be used to generate random number conforming an exponential distribution with parameter .
To test this,
This proved the conclusion.
# uniform to exponential
lambdaE = 1
x = np.random.random(10000)
y = -np.log(1-x)/lambdaE
plt.hist(y,bins=50)
plt.show()
Example 2 - Box-Muller Method
Assume are independent, make the transform and , then are also independent and follow the standard normal distribution.
Proof is easy and is thus omitted here.
# uniform to normal
x = np.random.random(10000)
y = np.random.random(10000)
U = (-2*np.log(x))**0.5*np.cos(2*np.pi*y)
V = (-2*np.log(x))**0.5*np.sin(2*np.pi*y)
plt.figure()
plt.hist(U,bins=50)
plt.title('U')
plt.show()
plt.figure()
plt.hist(V,bins=50)
plt.title('V')
plt.show()
Von Neumann Rejection Sampling
Generate random numbers with probability density function .
Suppose that we know an upper bound for and a proposal distribution , so that there is such that .
Here is the algorithm:
Draw a sample u ~ U[0,1]
Draw a sample x ~ q(x)
if p(x) / (cq(x)) >= u then
accept x
else
reject it and repeat
endif
Theorem
Assume and , and are independent, then
Proof. Use the law of total probability.
Table of Contents
- Probability vs Statistics
- Shakespear’s New Poem
- Some Common Discrete Distributions
- Some Common Continuous Distributions
- Statistical Quantities
- Order Statistics
- Multivariate Normal Distributions
- Conditional Distributions and Expectation
- Problem Set [01] - Probabilities
- Parameter Point Estimation
- Evaluation of Point Estimation
- Parameter Interval Estimation
- Problem Set [02] - Parameter Estimation
- Parameter Hypothesis Test
- t Test
- Chi-Squared Test
- Analysis of Variance
- Summary of Statistical Tests
- Python [01] - Data Representation
- Python [02] - t Test & F Test
- Python [03] - Chi-Squared Test
- Experimental Design
- Monte Carlo
- Variance Reducing Techniques
- From Uniform to General Distributions
- Problem Set [03] - Monte Carlo
- Unitary Regression Model
- Multiple Regression Model
- Factor and Principle Component Analysis
- Clustering Analysis
- Summary
Comments