[ About | Licence | Contacts ]
Written by Oleksandr Gavenko (AKA gavenkoa), compiled on 2023-03-19 from rev c18d218b854e.

Continuous random variables

Probability density function

Probability density function (PDF) for continuous random variable x is function:

CDF(a ≤ X ≤ b) = P(a ≤ X ≤ b) = a, b fX(x) dx
fX(x) ≥ 0
 − ∞,  + ∞ fX(x) dx = 1

fX(x) funtion maps values x from sample space to real numbers.

For continuous random variable:

P(X = a) = 0

Expectation

Expectation of continuous random variable is:

μ = E[X] =  − ∞,  + ∞ x·fX(x) dx

Properties:

E[X + Y] = E[X] + E[Y]
E[a·X] = a·E[X]
E[a·X + b] = a·E[X] + b

Variance

Variance of continuous random variable is:

var[X] =  − ∞,  + ∞ (x − μ)²·fX(x) dx

Properties:

var[a·X + b] = a²·var[X]
var[X] = E[X²] − E²[X]

Standard deviation

Standard deviation of continuous random variable is:

σΧ = sqrt(var[X])

Cumulative distribution functions

Cumulative distribution functions (CDF) of random variable X is:

FX(x) = P(X ≤ x) =  − ∞, x fX(t) dt

So:

P(a ≤ X ≤ b) = FX(b) − FX(a) + fX(a) = a, b fX(x) dx
FX( − ∞) = 0
FX( + ∞) = 1

and FX(a) ≤ FX(b) for a ≤ b.

Relation between CDF and PDF:

(d(CDF(t)) ⁄ dt)(x) = PDF(x)

Conditional probability

Conditional probability of continuous random variable is:

P(X ⊆ B|A) = B fX|A(x) dx = AB fX(x) dx ⁄ P(A)

Conditional expectation of continuous random variable is:

E[X|A] =  x·fX|A(x) dx

Properties:

E[g(X)|A] =  g(xfX|A(x) dx

Independence

Random variable X, Y are independent if:

fX, Y(x, y) = fX(xfY(y)

Continuous uniform random variable

Continuous uniform random variable is fX(x) that is non-zero only on [a, b] with fX(x) = `1 ⁄ (b − a).

E[unif(a, b)] = (b + a) ⁄ 2
var[unif(a, b)] = (b − a)² ⁄ 12
σ = (b − a) ⁄ sqrt(12)

Proofs:

E[unif(a, b)] = a, b x·1 ⁄ (b − adx = x² ⁄ 2 ⁄ (b − a)|a, b = (b² − a²) ⁄ (b − a) ⁄ 2 = (b + a) ⁄ 2
E[unif²(a, b)] = a, bx²·1 ⁄ (b − adx = x³ ⁄ 3 ⁄ (b − a)|a, b = (b³ − a³) ⁄ (b − a) ⁄ 3 = (b² + b·a + a²) ⁄ 3
var[unif(a, b)] = E[unif²(a, b)] − E²[unif(a, b)] = (b² + b·a + a²) ⁄ 3 − (b + a)² ⁄ 4 = (b − a)² ⁄ 12

Note

In maxima:

(%i4) factor((b^2+b*a+a^2)/3 - (a+b)^2/4);
            2
     (b - a)
     --------
        12

Exponential random variables

Exponential random variables with parameter λ is:

fX(x) = λ·exp( − λ·x)

for x ≥ 0, and zero otherwise.

Properties:

E[exp(λ)] = 1 ⁄ λ
var[exp(λ)] = 1 ⁄ λ²

Proof:

 − ∞,  + ∞ fX(x) dx = 0,  + ∞ λ·exp( − λ·x) dx =  − exp( − λ·x)|0,  + ∞ = 1
E[exp(λ)] = 0,  + ∞ x·λ·exp( − λ·x) dx = 1 ⁄ λ
E[exp²(λ)] = 0,  + ∞ x²·λ·exp( − λ·x) dx = 1 ⁄ λ²

Note

From maxima:

(%i15) assume(lambda>0);
(%o15)                           [lambda > 0]

(%i16) integrate(lambda*%e^(-lambda*x),x,0,inf);
(%o16)                                 1

(%i17) integrate(x*lambda*%e^(-lambda*x),x,0,inf);
                                      1
(%o17)                              ------
                                    lambda

(%i18) integrate(x^2*lambda*%e^(-lambda*x),x,0,inf);
                                       2
(%o18)                              -------
                                          2
                                    lambda

Normal random variables

Normal random variables with parameters μ, σ and σ > 0 defined by PDF:

norm(μ, σ²) = 1 ⁄ sqrt(2·π) ⁄ σ·exp( − (x − μ)² ⁄ σ² ⁄ 2)

Properties:

E[norm(μ, σ²)] = μ
var[norm(μ, σ²)] = σ²

Summa of two normal r.v.

If Z = X + Y and X and Y is independent normal r.v. then:

norm(μz, σz²) = norm(μx + μy, σx² + σy²)

Proof:

norm(μz, σz²) = x fX(xfY(z − x) dx
 = x 1 ⁄ sqrt(2·π) ⁄ σx·exp( − (x − μx)² ⁄ σx² ⁄ 2)·1 ⁄ sqrt(2·π) ⁄ σy·exp( − (z − x − μy)² ⁄ σy² ⁄ 2) dx
 = 1 ⁄ sqrt(2·π·(σx² + σy²))·exp( − (x − μx − μy)² ⁄ (σx² + σy²) ⁄ 2)

Linear function of distribution

If Y = a·X + b then fY(y) = 1 ⁄ |afX((y − b) ⁄ a).

Proof, for y > 0:

FY(Y ≤ y) = FX(a·X + b ≤ y) = FX(X ≤ (y − b) ⁄ a)

so:

fY(y) = d ⁄ dy FY(Y ≤ y) = d ⁄ dy FX(x ≤ (y − b) ⁄ a) = 1 ⁄ a·fX((y − b) ⁄ a)

For y < 0:

FY(Y > y) = FX(a·X + b > y) = FX(X < (y − b) ⁄ a)
FY(Y <  = y) = 1 − FY(Y > y) = 1 − FX(X < (y − b) ⁄ a)
d ⁄ dy fY(y) =  − 1 ⁄ a·fX((y − b) ⁄ a)

Combining expression for a ≠ 0 gives us result.

If X is uniform distribution with parameters c, d then a·Y + b also is uniform distribution with parameters a·c + b, a·d + b.

If X is exponential distribution with parameters λ then a·Y also is exponential distribution with parameters λ ⁄ a for a > 0.

If X is normal distribution with parameters μ, σ² then a·Y + b also is normal distribution with parameters a·μ + b, (a·σ.

Proofs.

When Χ exp(λ) and Y = a·X then:

fY(y) = 1 ⁄ a·fX(y ⁄ a) = λ ⁄ a·e − λ·y ⁄ a exp(λ ⁄ a)

When Χ norm(μ, σ²) and Y = a·X + b then:

fY(y) = 1 ⁄ a·fX((y − b) ⁄ a) = 1 ⁄ a·1 ⁄ sqrt(2·π) ⁄ σ·e − λ·((y − b) ⁄ a − μ)² ⁄ σ² ⁄ 2
 = 1 ⁄ sqrt(2·π) ⁄ (a·σe − λ·(y − (a·μ + b))² ⁄ (a·σ)² ⁄ 2 =  norm(a·μ + b, (a·σ)²)

Monotonic function of distribution

Let's Y = g(X) and g is monotonic function on range [a, b]. So there is inverse function h(Y) = X on range [g(a), g(b)] (if g is increasing values) or on range [g(b), g(a)] (if g is decreasing values). In that case:

fY(y) = fX(h(y))·(d h(t) ⁄ dt)(y)

Proof. Let g is monotonically increasing function. Thus:

FY(Y ≤ y) = FX(g(X) ≤ y) = FX(X ≤ h(y)) = FX(h(y))

and so:

fY(y) = (d FY(t) ⁄ dt)(y) = (d FX(h(t)) ⁄ dt)(y) = fX(h(y))·(d h(t) ⁄ dt)(y)

Convolution formula

If Z = X + Y and X and Y is independent r.v. then:

fZ(z) = x fX(xfY(z − xdx

Proof:

Consider Z at conditional event X = x:

fZ|X(z|X = x) = fz|X = x(z|X = x)

Becasue of independence of X and Y:

fZ|X(z|X = x) = fX + Y|X = x(z|X = x) = fx + Y(z) = fY(z − x)

Joint PDF of X and Z is:

fX, Z(x, z) = fX(xfZ|X(z|X = x) = fX(xfY(z − x)

By integrating by x we get:

fZ(z) = x fX, Z(x, z) dx = x fX(xfY(z − x) dx

Covariance

Covariance of two r.v. is:

cov(X, Y) = E[(X − E[X])·(Y − E[Y])]

Properties:

cov(X, Y) = E[X·Y] − E[XE[Y]
cov(X, X) = var(X)
cov(a·X + b, Y) = a·cov(X, Y)
cov(X, Y + Z) = cov(X, Y) + cov(X, Z)
var(X + Y) = var(X) + var(Y) + 2·cov(X, Y)

Covariance of two independent r.v. is zero.

Proofs:

cov(X, Y) = E[(X − E[X])·(Y − E[Y])] = E[X·Y − X·E[Y] − E[XY + E[XE[Y]]
 = E[X·Y] − E[X·E[Y]] − E[E[XY] + E[E[XE[Y]]
 = E[X·Y] − E[XE[Y] − E[XE[Y] + E[XE[Y] = E[X·Y] − E[XE[Y]
cov(a·X + b, Y) = E[(a·X + b − E[a·X + b])·(Y − E[Y])]
 = E[(a·X + b − (a·E[X] + b))·(Y − E[Y])] = E[(a·X + a·E[X])·(Y − E[Y])]
 = a·E[(X + E[X])·(Y − E[Y])] = a·cov(X, Y)
cov(X, Y + Z) = E[(X − E[X])·(Y + Z − E[Y + Z])] = E[(X − E[X])·(Y − E[Y] + Z − E[Z])]
 = E[(X − E[X])·(Y − E[Y]) + (X − E[X])·(Z − E[Z])]
 = E[(X − E[X])·(Y − E[Y])] + E[(X − E[X])·(Z − E[Z])] = cov(X, Y) + cov(X, Z)
var(X) + var(Y) + 2·cov(X, Y) = E[X²] − (E[X])² + E[Y²] − (E[Y])² + 2·E[X·Y] − 2·E[XE[Y]
 = E[X² − X·E[X] + Y² − Y·E[Y] + 2·X·Y − X·E[Y] − Y·E[X]]
 = E[(X + Y)² − (X·E[X] + Y·E[Y] + X·E[Y] + Y·E[X])]
 = E[(X + Y)²] − E[(X + Y)·(E[X] + E[Y])] = E[(X + Y)²] − E[X + YE[X + Y] = var(X + Y)

For independent r.v. X and Y:

cov(X, Y) = E[(X − E[X])·(Y − E[Y])] = E[(X − E[X])]·E[(Y − E[Y])] = 0

Correlation coefficient

Dimensionless version of covariance:

ρ(Χ, Υ) = E[(X − E[X]) ⁄ σΧ·(Y − E[Y]) ⁄ σY] = cov(X, Y) ⁄ (σX·σY)

It is defined only for cases when σX ≠ 0 and σY ≠ 0.

Obviously  − 1 ≤ ρ(Χ, Υ) ≤  + 1 and ρ(Χ, X) = 0.

For independent r.v. ρ(Χ, Y) = 0.

If |ρ(X, Y)| = 1 then X and Y is have linear dependencies X = Y or X =  − Y.

Properties:

ρ(a·X + b, Y) = sign(aρ(X, Y)

Conditioned expectation

E[X|Y] = X x·fX|Y(x|Y) dx

Law of total expectation

E[X] = E[E[X|Y]]

Proof:

.. math::

E[E[X|Y]] = ∫_Yf_Y(y)·∫_Xx·f_{X|Y}(x|y)dx·dy

= ∫_Y∫_Xx·f_Y(y)·f_{X|Y}(x|y)dx·dy = ∫_Y∫_Xx·f_{X,Y}(x,y)dx·dy

= ∫_Xx·∫_Yf_{X,Y}(x,y)dy·dx = ∫_Xx·f_X(x)dx = E[X]

Iterated expectations with nested conditioning sets

E[X|A] = E[E[X|B]|A]

Conditional variance

var(X|Y = y) = E[(X − E[X|Y = y])²|Y = y]

Law of total variance

var(X) = E[var(X|Y)] + var(E[X|Y]) = EY[varX(X|Y)] + varX(EY[X|Y])

Proof:

var(X) = E[X²] − (E[X])² = E[E[X²|Y]] − (E[E[X|Y]])²
 = E[var(X|Y) + (E[X|Y])²] − (E[E[X|Y]])²
 = E[var(X|Y)] + E[(E[X|Y])²] − (E[E[X|Y]])² = E[var(X|Y)] + var(E[X|Y])

Law of total covariance

Sum of normally distributed random variables

For X norm(μX, σX²) and Y norm(μY, σY²) random variable X + Y is also has normal distribution with parameters:

norm(μX + μY, σX² + σY²)

https://en.wikipedia.org/wiki/Sum_of_normally_distributed_random_variables

Sum of random number of i.i.r.v.

Let Y = X1 + ... + XN is a sum of r.v. N and all Xi are i.i.r.v. Thus:

E[Y] = E[NE[X]
var[Y] = E[Nvar(X) + var(N)·(E[N])²

Proofs:

E[Y] = E[i = 1..N Xi] = E[E[i = 1..n Xi|N = n]] = E[i = 1..n E[Xi|N = n]]
 = E[i = 1..n E[X]] = E[N·E[X]] = E[NE[X]
var[Y] = E[var(Y|N)] + var(E[Y|N]) = E[var(i = 1..n Xi|N = n)] + var(E[i = 1..n Xi|N = n])
 = E[N·var(X)] + var(N·E[X]) = E[Nvar(X) + var(N)·(E[X])²