Uniform Distribution | |
---|---|
f(x) =
1/(b - a) for a <= x <= b Continuous: X = a + (b - a)*R Integers only: |
Exponential Distribution | ||
---|---|---|
X = - a*ln(R) |
Normal Distribution | ||
---|---|---|
x1 = 2*R1 - 1 x2 = 2*R2 - 1 xx = x12 + x22 if xx < 1 then Z = x1 * (-2*ln(xx)/xx)0.5 X = μ + Z * σ |
Log-normal Distribution | ||
---|---|---|
Z = N(0,1) from normal distribution x = eμ + Z * σ |
Weibull Distribution | ||
---|---|---|
x = α(-ln(R))β |
Gamma Distribution | |
---|---|
f(x) =
(1/Γ(a))xa - 1e-x for x >= 0 case: 0 < a < 1 U = R1 c = (e + a)/e where e=exp(1) P = cU If P <= 1 then x = P1/a V = R2 accept x if V <= e-x If P > 1 then x = - ln((c - P)/a) accept x if x >= 0 case: a = 1 x = - ln(R) case: a > 1 Y = - ln(R1) U = R2 If ln U <= (a - 1)(1 - Y + ln Y) then accept x = aY |
Beta Distribution | |
---|---|
f(x) =
(1/Β(a, b)))xa - 1(1 - x)b - 1 for
0<=x<=1, a>0, b>0 Y1 = Gamma(a) variate Y2 = Gamma(b) variate x = Y1/(Y1 + Y2) |
Binomial Distribution | |
---|---|
P(X=x) =
(n!/x!(n-x)!)px(1 - p)n - x for 0<=p<=1,
n=1,2,3... Let Xi = 1 if U <= p otherwise, let Xi = 0 x = X1 + X2 + ... + Xn note: for large n use normal approx. |
Geometric Distribution | |
---|---|
P(X=x) =
p(1 - p)x - 1 for 0 < p < 1, n=1,2,3... 1. Let x = 1 2. U=U(0,1) 3. If U > p, let x = x + 1 and go to step 2; otherwise finish |
Poisson Distribution | |
---|---|
P(X=x) =
λxe-λ/x! for λ > 0, x = 0, 1, 2, ... 1. Let p = e-λ, s = p, x = 0 2. U=U(0,1) 3. If U > s set x = x + 1, p = pλ/x, s = s + p and go to 2 Otherwise, finish. note: for large n use normal approx. |