Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Probability distribution
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Random number generation== {{Main|Pseudo-random number sampling}} Most algorithms are based on a [[pseudorandom number generator]] that produces numbers <math>X</math> that are uniformly distributed in the [[half-open interval]] {{closed-open|0, 1}}. These [[random variate]]s <math>X</math> are then transformed via some algorithm to create a new random variate having the required probability distribution. With this source of uniform pseudo-randomness, realizations of any random variable can be generated.<ref name=":0">{{Citation|last1=Dekking|first1=Frederik Michel| title=Why probability and statistics?|date=2005|work=A Modern Introduction to Probability and Statistics| pages=1–11| publisher =Springer London|isbn=978-1-85233-896-1|last2=Kraaikamp|first2=Cornelis| last3=Lopuhaä|first3=Hendrik Paul| last4=Meester| first4=Ludolf Erwin| doi=10.1007/1-84628-168-7_1}}</ref> For example, suppose {{mvar|U}} has a uniform distribution between 0 and 1. To construct a random Bernoulli variable for some {{math|0 < p < 1}}, define <math display="block">X = \begin{cases} 1& \text{if } U<p\\ 0& \text{if } U\geq p. \end{cases}</math> We thus have <math display="block">P(X=1) = P(U<p) = p, \quad P(X=0) = P(U\geq p) = 1-p.</math> Therefore, the random variable {{mvar|X}} has a Bernoulli distribution with parameter {{mvar|p}}.<ref name=":0"/> This method can be adapted to generate real-valued random variables with any distribution: for be any cumulative distribution function {{mvar|F}}, let {{math|''F''{{sup|inv}}}} be the generalized left inverse of <math>F,</math> also known in this context as the ''[[quantile function]]'' or ''inverse distribution function'': <math display="block">F^{\mathrm{inv}}(p) = \inf \{x \in \mathbb{R} : p \le F(x)\}.</math> Then, {{math|''F''{{sup|inv}}(''p'') ≤ ''x''}} if and only if {{math|''p'' ≤ ''F''(''x'')}}. As a result, if {{mvar|U}} is uniformly distributed on {{math|[0, 1]}}, then the cumulative distribution function of {{math|''X'' {{=}} ''F''{{sup|inv}}(''U'')}} is {{mvar|F}}. For example, suppose we want to generate a random variable having an exponential distribution with parameter <math>\lambda</math> — that is, with cumulative distribution function <math>F : x \mapsto 1 - e^{-\lambda x}.</math> <math display="block">\begin{align} F(x) = u &\Leftrightarrow 1-e^{-\lambda x} = u \\[2pt] &\Leftrightarrow e^{-\lambda x } = 1-u \\[2pt] &\Leftrightarrow -\lambda x = \ln(1-u) \\[2pt] &\Leftrightarrow x = \frac{-1}{\lambda}\ln(1-u) \end{align}</math> so <math>F^{\mathrm{inv}}(u) = -\tfrac{1}{\lambda}\ln(1-u)</math>, and if {{mvar|U}} has a uniform distribution on {{math|[0, 1)}} then <math>X = -\tfrac{1}{\lambda}\ln(1-U)</math> has an exponential distribution with parameter <math>\lambda.</math><ref name=":0" /> Although from a theoretical point of view this method always works, in practice the inverse distribution function is unknown and/or cannot be computed efficiently. In this case, other methods (such as the [[Monte Carlo method]]) are used.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)