Continuous Random Variables
Uniform Real Distribution
https://en.wikipedia.org/wiki/Continuous_uniform_distribution
Definition
has a Uniform real distribution, denoted as , if
where . The distribution function is
Normal (Gaussian) Distribution
https://en.wikipedia.org/wiki/Normal_distribution
Definition
has a Normal (or Gaussian) distribution with parameters and , denoted , if
where and . We say that has a standard Normal distribution if and . We also denote the PDF of a standard Normal as and the CDF as . Note that there is no closed form for .
Theorem
If , then . It also follows that
Thus, we can compute any probability we want as long as we can compute the CDF for a standard Normal.
Theorem
if , then .
Theorem
If for are independent, then
Generating Normal Samples
// Box-Muller transform
template <typename T>
auto normal(T mu, T std, Generator gen) -> T {
const auto u1 = uniform_real_sample(0, 1, gen);
const auto u2 = uniform_real_sample(0, 1, gen);
// log(1 - u1) for u \in [0, 1) ensures log(> 0)
const auto r = std::sqrt(static_cast<T>(-2) * std::log1p(-u1));
const auto theta = static_cast<T>(2) * std::numbers::pi_v<T> * u2;
const auto z1 = r * std::sin(theta);
return std * z1 + mu;
}
Exponential Distribution
https://en.wikipedia.org/wiki/Exponential_distribution
Definition
The exponential distribution is the probability distribution of the distance (waiting times) between events in a Poisson point process. has an exponential distribution with parameter , denoted by , if
where .
Generating Exponential Samples
template <typename T>
auto normal(T lambda, Generator gen) -> T {
const auto u = uniform_real_sample(0, 1, gen);
return -std::log1p(-u) / lambda;
}
Gamma Distribution
https://en.wikipedia.org/wiki/Gamma_distribution
Distribution
The Gamma distribution is a versatile two-parameter family of continuous probability distributions. The exponential distribution, Erlang distribution, and chi-squared distribution are special cases of the gamma distribution. For , the Gamma function is defined by
has a Gamma distribution with parameters and , denoted by , if
where .
Theorem
If , then has an exponential distribution with rate .
Theorem
If , then has a chi-squared distribution with rate degrees of freedom.
Theorem
If are independent, then
Beta Distribution
https://en.wikipedia.org/wiki/Beta_distribution
Definition
The Beta distribution is a family of distributions defined on the interval in terms of two parameters and , and is often used to model random behavior of percentages and proportions. In Bayesian inference, the beta distribution is the conjugate prior probability distribution for the Bernoulli distribution, binomial distribution, and geometric distribution. has a Beta distribution with parameters and , denoted , if
Student’s t-Distribution
https://en.wikipedia.org/wiki/Student%27s_t-distribution
Definition
The distribution is a generalization of the standard normal distribution, which has heavier tails and the amount of mass in the tails is controlled by the parameter. has a distribution with degrees of freedom, written , if
The Normal distribution corresponds to with , and the Cauchy distribution is a special case of the distribution corresponding to .
Cauchy Distribution
https://en.wikipedia.org/wiki/Cauchy_distribution
Distribution
The Cauchy Distribution is a special case of the t-distribution with . The density is given by
Chi-Squared Distribution
https://en.wikipedia.org/wiki/Chi-squared_distribution
Definition
The distribution with degrees of freedom is the distribution of a sum of the squares of independent standard normal distributions. has a distribution with degrees of freedom, denoted , if
If are independent standard Normal random variables, then .