First of all, the symbol: U (0,1)-Uniform distribution, "~" is to obey the XXX distribution, F (x), for the need to generate a random number distribution function, INVF (x) to represent the inverse distribution function, then the algorithm steps are as follows:
Step 1: Generate U~u (0,1)
Step 2: Calculate X=INVF (U)
So x is the random number that obeys the distribution function f (x), a simple proof:
Proof: P (x<y) =p (INVF (U) <y) =p (u<f (y)) =f (y); The certificate is completed.
You're going to feel so easy, yes, it's very simple, here's the usual exponential distribution.
First, the distribution function of the exponential distribution:
F (x) =1-exp (-lamda*x); x>0 (Lamda as parameter)
So the inverse distribution function:
INVF (x) =-(1/LAMDA) *ln (1-x); 0<x<1
So the random number generation process:
Step 1: Generate U~u (0,1)
Step 2: Calculate X=-ln (1-u)
Get random numbers
X <-runif (+) Lamda <-0.1U <-runif (+) Lamda <-0.1X <- -1/lamda * log (U) hist (X,prob=t,col=gray (0.9), Mai N= "exp from uniform") curve (Dexp (X,LAMDA), add=t,col= "Red")
Generation of random numbers (exponential distribution) by inverse distribution function method R language implementation