HOME

TheInfoList



OR:

Inverse transform sampling (also known as inversion sampling, the inverse probability integral transform, the inverse transformation method, Smirnov transform, or the golden ruleAalto University, N. Hyvönen, Computational methods in inverse problems. Twelfth lecture https://noppa.tkk.fi/noppa/kurssi/mat-1.3626/luennot/Mat-1_3626_lecture12.pdf) is a basic method for
pseudo-random number sampling Non-uniform random variate generation or pseudo-random number sampling is the numerical practice of generating pseudo-random numbers (PRN) that follow a given probability distribution. Methods are typically based on the availability of a unifo ...
, i.e., for generating sample numbers at
random In common usage, randomness is the apparent or actual lack of pattern or predictability in events. A random sequence of events, symbols or steps often has no order and does not follow an intelligible pattern or combination. Individual ran ...
from any
probability distribution In probability theory and statistics, a probability distribution is the mathematical function that gives the probabilities of occurrence of different possible outcomes for an experiment. It is a mathematical description of a random phenomenon ...
given its
cumulative distribution function In probability theory and statistics, the cumulative distribution function (CDF) of a real-valued random variable X, or just distribution function of X, evaluated at x, is the probability that X will take a value less than or equal to x. Eve ...
. Inverse transformation sampling takes uniform samples of a number u between 0 and 1, interpreted as a probability, and then returns the largest number x from the domain of the distribution P(X) such that P(-\infty < X < x) \le u. For example, imagine that P(X) is the standard
normal distribution In statistics, a normal distribution or Gaussian distribution is a type of continuous probability distribution for a real-valued random variable. The general form of its probability density function is : f(x) = \frac e^ The parameter \mu ...
with mean zero and standard deviation one. The table below shows samples taken from the uniform distribution and their representation on the standard normal distribution. We are randomly choosing a proportion of the area under the curve and returning the number in the domain such that exactly this proportion of the area occurs to the left of that number. Intuitively, we are unlikely to choose a number in the far end of tails because there is very little area in them which would require choosing a number very close to zero or one. Computationally, this method involves computing the
quantile function In probability and statistics, the quantile function, associated with a probability distribution of a random variable, specifies the value of the random variable such that the probability of the variable being less than or equal to that value equ ...
of the distribution — in other words, computing the
cumulative distribution function In probability theory and statistics, the cumulative distribution function (CDF) of a real-valued random variable X, or just distribution function of X, evaluated at x, is the probability that X will take a value less than or equal to x. Eve ...
(CDF) of the distribution (which maps a number in the domain to a probability between 0 and 1) and then inverting that function. This is the source of the term "inverse" or "inversion" in most of the names for this method. Note that for a discrete distribution, computing the CDF is not in general too difficult: we simply add up the individual probabilities for the various points of the distribution. For a continuous distribution, however, we need to integrate the
probability density function In probability theory, a probability density function (PDF), or density of a continuous random variable, is a function whose value at any given sample (or point) in the sample space (the set of possible values taken by the random variable) ca ...
(PDF) of the distribution, which is impossible to do analytically for most distributions (including the
normal distribution In statistics, a normal distribution or Gaussian distribution is a type of continuous probability distribution for a real-valued random variable. The general form of its probability density function is : f(x) = \frac e^ The parameter \mu ...
). As a result, this method may be computationally inefficient for many distributions and other methods are preferred; however, it is a useful method for building more generally applicable samplers such as those based on
rejection sampling In numerical analysis and computational statistics, rejection sampling is a basic technique used to generate observations from a distribution. It is also commonly called the acceptance-rejection method or "accept-reject algorithm" and is a type of ...
. For the
normal distribution In statistics, a normal distribution or Gaussian distribution is a type of continuous probability distribution for a real-valued random variable. The general form of its probability density function is : f(x) = \frac e^ The parameter \mu ...
, the lack of an analytical expression for the corresponding quantile function means that other methods (e.g. the Box–Muller transform) may be preferred computationally. It is often the case that, even for simple distributions, the inverse transform sampling method can be improved on: see, for example, the ziggurat algorithm and
rejection sampling In numerical analysis and computational statistics, rejection sampling is a basic technique used to generate observations from a distribution. It is also commonly called the acceptance-rejection method or "accept-reject algorithm" and is a type of ...
. On the other hand, it is possible to approximate the quantile function of the normal distribution extremely accurately using moderate-degree polynomials, and in fact the method of doing this is fast enough that inversion sampling is now the default method for sampling from a normal distribution in the statistical package R.


Definition

The probability integral transform states that if X is a
continuous random variable In probability theory and statistics, a probability distribution is the mathematical function that gives the probabilities of occurrence of different possible outcomes for an experiment. It is a mathematical description of a random phenomenon ...
with
cumulative distribution function In probability theory and statistics, the cumulative distribution function (CDF) of a real-valued random variable X, or just distribution function of X, evaluated at x, is the probability that X will take a value less than or equal to x. Eve ...
F_X, then the random variable Y=F_X(X) has a
uniform distribution Uniform distribution may refer to: * Continuous uniform distribution * Discrete uniform distribution * Uniform distribution (ecology) * Equidistributed sequence See also * * Homogeneous distribution In mathematics, a homogeneous distribution ...
on , 1 The inverse probability integral transform is just the inverse of this: specifically, if Y has a uniform distribution on , 1and if X has a cumulative distribution F_X, then the random variable F_X^(Y) has the same distribution as X .


Intuition

From U \sim \mathrm ,1/math>, we want to generate X with CDF F_X(x). We assume F_X(x) to be a strictly increasing function, which provides good intuition. We want to see if we can find some strictly monotone transformation T: ,1mapsto \mathbb, such that T(U)\oversetX. We will have F_X(x)=\Pr(X\leq x)=\Pr(T(U)\leq x) = \Pr(U\leq T^(x))=T^(x), \text x\in \mathbb, where the last step used that \Pr(U \leq y) = y when U is uniform on (0,1). So we got F_X to be the inverse function of T , or, equivalently T(u)=F_X^(u), u\in ,1 Therefore, we can generate X from F_X^(U).


The method

The problem that the inverse transform sampling method solves is as follows: *Let X be a
random variable A random variable (also called random quantity, aleatory variable, or stochastic variable) is a mathematical formalization of a quantity or object which depends on random events. It is a mapping or a function from possible outcomes (e.g., the po ...
whose distribution can be described by the
cumulative distribution function In probability theory and statistics, the cumulative distribution function (CDF) of a real-valued random variable X, or just distribution function of X, evaluated at x, is the probability that X will take a value less than or equal to x. Eve ...
F_X. *We want to generate values of X which are distributed according to this distribution. The inverse transform sampling method works as follows: # Generate a random number u from the standard uniform distribution in the interval ,1/math>, e.g. from U \sim \mathrm ,1 #Find the inverse of the desired CDF, e.g. F_X^(x). # Compute X=F_X^(u). The computed random variable X has distribution F_X(x). Expressed differently, given a continuous uniform variable U in ,1/math> and an invertible cumulative distribution function F_X, the random variable X = F_X^(U) has distribution F_X (or, X is distributed F_X). A treatment of such inverse functions as objects satisfying differential equations can be given. Some such differential equations admit explicit power series solutions, despite their non-linearity.


Examples

* As an example, suppose we have a random variable U \sim \mathrm(0,1) and a
cumulative distribution function In probability theory and statistics, the cumulative distribution function (CDF) of a real-valued random variable X, or just distribution function of X, evaluated at x, is the probability that X will take a value less than or equal to x. Eve ...
: \begin F(x)=1-\exp(-\sqrt) \end : In order to perform an inversion we want to solve for F(F^(u))=u : \begin F(F^(u))&=u \\ 1-\exp\left(-\sqrt\right) &= u \\ F^(u) &= (-\log(1-u))^2 \\ &= (\log(1-u))^2 \end : From here we would perform steps one, two and three. * As another example, we use the
exponential distribution In probability theory and statistics, the exponential distribution is the probability distribution of the time between events in a Poisson point process, i.e., a process in which events occur continuously and independently at a constant average ...
with F_X(x)=1-e^ for x ≥ 0 (and 0 otherwise). By solving y=F(x) we obtain the inverse function : x = F^(y) = -\frac\ln(1-y). :It means that if we draw some y_0from a U \sim \mathrm(0,1) and compute x_0 = F_X^(y_0) = -\frac\ln(1-y_0), This x_0 has exponential distribution. : The idea is illustrated in the following graph: : : Note that the distribution does not change if we start with 1-y instead of y. For computational purposes, it therefore suffices to generate random numbers y in , 1and then simply calculate : x = F^(y) = -\frac\ln(y).


Proof of correctness

Let ''F'' be a continuous
cumulative distribution function In probability theory and statistics, the cumulative distribution function (CDF) of a real-valued random variable X, or just distribution function of X, evaluated at x, is the probability that X will take a value less than or equal to x. Eve ...
, and let ''F''−1 be its inverse function (using the
infimum In mathematics, the infimum (abbreviated inf; plural infima) of a subset S of a partially ordered set P is a greatest element in P that is less than or equal to each element of S, if such an element exists. Consequently, the term ''greatest lo ...
because CDFs are weakly monotonic and right-continuous): :F^(u) = \inf\;\ \qquad (0 ''Claim:'' If ''U'' is a
uniform A uniform is a variety of clothing worn by members of an organization while participating in that organization's activity. Modern uniforms are most often worn by armed forces and paramilitary organizations such as police, emergency services, ...
random variable on (0, 1) then F^(U) has ''F'' as its CDF. ''Proof:'' : \begin & \Pr(F^(U) \leq x) \\ & = \Pr(U \leq F(x)) \quad &(\textF,\text) \\ & = F(x)\quad &(\text\Pr(U \leq y) = y,\text(0,1)) \\ \end


Truncated distribution

Inverse transform sampling can be simply extended to cases of truncated distributions on the interval (a,b] without the cost of rejection sampling: the same algorithm can be followed, but instead of generating a random number u uniformly distributed between 0 and 1, generate u uniformly distributed between F(a) and F(b), and then again take F^(u).


Reduction of the number of inversions

In order to obtain a large number of samples, one needs to perform the same number of inversions of the distribution. One possible way to reduce the number of inversions while obtaining a large number of samples is the application of the so-called Stochastic Collocation Monte Carlo sampler (SCMC sampler) within a polynomial chaos expansion framework. This allows us to generate any number of Monte Carlo samples with only a few inversions of the original distribution with independent samples of a variable for which the inversions are analytically available, for example the standard normal variable.L.A. Grzelak, J.A.S. Witteveen, M. Suarez, and C.W. Oosterlee. The stochastic collocation Monte Carlo sampler: Highly efficient sampling from “expensive” distributions. https://ssrn.com/abstract=2529691


See also

* Probability integral transform * Copula, defined by means of probability integral transform. *
Quantile function In probability and statistics, the quantile function, associated with a probability distribution of a random variable, specifies the value of the random variable such that the probability of the variable being less than or equal to that value equ ...
, for the explicit construction of inverse CDFs. *
Inverse distribution function In probability and statistics, the quantile function, associated with a probability distribution of a random variable, specifies the value of the random variable such that the probability of the variable being less than or equal to that value equ ...
for a precise mathematical definition for distributions with discrete components.


References

{{DEFAULTSORT:Inverse Transform Sampling Monte Carlo methods Non-uniform random numbers