Lecture 3 - Part 2
Contents
- Well-Known Distributions
- Revisiting Gaussian Distribution
- Understanding Covariance through Contour Plots
- Reference
Well-Known Distributions
In the last part, we covered most of the fundamental concepts which are required to understand the detection theory. The only remaining bit is introduction to some commonly encountered probability distribution and methods for simulating the random variables. We will start with these two concepts and then do a quick tour of detection theory in this part.
Bernoulli Distribution
P(X=1)=p,P(X=0)=1−p- Mean: p
- Variance: p(1−p)
Binomial Distribution
Number of successes in n independent Bernoulli trials:
P(X=k)=(kn)pk(1−p)n−k,k=0,1,…,n- Mean: np
- Variance: np(1−p)
Geometric Distribution
Number of trials until first success:
P(X=k)=(1−p)k−1p,k=1,2,…- Mean: p1
- Variance: p21−p
Poisson Distribution
Models rare events:
P(X=k)=k!λke−λ,k=0,1,2,…- Mean: λ
- Variance: λ
Uniform Distribution
fX(x)=b−a1,a≤x≤b- Mean: 2a+b
- Variance: 12(b−a)2
Normal (Gaussian) Distribution
fX(x)=2πσ21exp(−2σ2(x−μ)2)- Mean: μ
- Variance: σ2
Exponential Distribution
fX(x)=λe−λx,x≥0- Mean: λ1
- Variance: λ21
Rayleigh Distribution
A continuous probability distribution for non-negative random variables, often used to model the magnitude of a vector with two independent and identically distributed Gaussian components (e.g., fading in wireless channels).
PDF:
Gamma Distribution
A two-parameter family of continuous probability distributions that generalizes the exponential distribution and is often used to model waiting times.
PDF:
where Γ(k) is the Gamma function.
Chi-Square (χ²) Distribution
A special case of the Gamma distribution with shape parameter k/2 and scale parameter 2. It arises as the distribution of a sum of squares of k independent standard normal random variables.
PDF:
Generating Random Variables in Python
Method 1: Using Inverse Transform approach
Here’s how we do it:
- Step 1: Generate U∼Uniform(0,1)
- Step 2: Transform using the inverse CDF (quantile function) of the distribution.
Below is Python code for all 10 distributions using inverse transform sampling:
Method 1: Inverse Transform Sampling
No output yet. Click "Run Python" to execute.
Method 2: Using Library Functions
Not all RVs have closed-form PDF and CDFs, sometimes its better to perform Rejection Sampling to generate the variable. We do not dwell into the details in these notes. For the sake of this book, you can use builtin python libraries to generate the RVs as follows:
Method 2: Using Library Functions
No output yet. Click "Run Python" to execute.
Note
As a self-study task familiarise yourself with the cumulative distribution functions of these common random variables.
Revisiting Gaussian Distribution
The Gaussian probability density function (PDF) (also referred to as Normal PDF) is defined as
pX(x)=2πσ21exp(−2σ2(x−μ)2)−∞<x<∞,where μ is the mean and σ2 is the variance. It is denoted by N(μ,σ2) and we indicate X∼N(μ,σ2) to say that X follows Normal distribution. If μ=0 then the moments are given by:
E(Xn)={1⋅3⋅5⋅⋅⋅(n−1)σn0n is evenn is odd.If μ>0 then, we can define the nth moment as:
E((X+μ)n)=k=0∑n(kn)E(Xk)μn−k,with E(Xk) can be computed from the previous equation (Eq. (12)).
As can be seen from this interactive graph, changing the mean changes the location of the distribution, while changing the variance controls the spread. The cumulative distribution of standard Normal distribution (μ=0 and σ2=1) is given by:
Φ(z)=∫−∞z2π1exp(−21t2)dt.Often it is more convenient to use complementary CDF, i.e., 1−FX(z)=1−Φ(z) the probability that the X exceeds a certain value z. This is also known as right tail probability. Then we can express,
P{X>z}=Q(z)=1−Φ(z)=∫z∞2π1exp(−21t2)dt.Multivariate Gaussian Distribution
In previous section, we explored univariate Gaussian distribution. This can be generalised easily to multivariate distribution. Consider, x=[x1,x2,...,xn] where xi∼N(μi,σi2) then vector x has multivariate Gaussian distribution. Mathematically,
pX(x;μ,Σ)=(2π)2N∣Σ∣211exp(−2(x−μ)TΣ−1(x−μ)),where X=[x1,x2,...,xn] is the vector collection of RVs, μ=[μ1,μ2,...,μN] is a mean vector, and Σ is a N×N covariance matrix. We will come back to the covariance matrix in few moments. For now consider it to be matrix containing relationship between xi's. When N=2, we have special case of Bi-variate Gaussian distribution. A Bi-variate Gaussian distribution can be visualised in 3D as follows:
Method 2: Using Library Functions
No output yet. Click "Run Python" to execute.
In the plot above, try changing the 0.5 values to 0, and observe what happens to the shape of the distribution. To understand what is happening here, let us dive into concept of covariance.
Covariance Matrix
The covariance matrix's entries can be written as follows:
[C]i,j=Cov(xi,xj)=E((xi−E(xi))(xj−E(xj))), where i=1,...,N and j=1,...,N.So essentially, the co-variance matrix contains how two random variable say xi and xj change together. Covariance quantifies how much two variables are linearly related. The covariance only captures the linear relationship and not any other types of relationship between these random variables. Consider the term (xi−E(xi))(xj−E(xj)):
- If both xi and xj are above their respective mean values this term is positive. Showing that both of these variables move together, in a straight line sense. Essentially, Cov(xi,xj)>0.
- If one of these goes down while another one up, then they are negatively correlated. Essentially, Cov(xi,xj)<0.
- If both xi and xj are uncorrelated then Cov(xi,xj)=0. Notice that if two RVs are independent then Cov(xi,xj)=0 but other way around is not true.
Understanding Covariance through Contour Plots
Explore the figure below showing a contour plot. You can observe how the sign of covariance affects the shape and orientation of the contours.
Positive Covariance
- The contours are elliptical and tilted upward.
- This indicates that as X increases, Y tends to increase too.
- In other words, the two variables move together.
Negative Covariance
- The contours are elliptical but tilted downward.
- This indicates that as X increases, Y tends to decrease.
- The variables move in opposite directions.
Zero Covariance
- The contours are circular (or axis-aligned ellipses).
- This means there is no linear relationship between X and Y.
- They may still have non-linear dependence, but linearly they are independent.
You can also visualize the same covariance in a 3D surface plot, which makes the tilt of the density even more visually obvious.
When Σ=σ2IN with
IN=100⋮0010⋮0001⋮0⋯⋯⋯⋱⋯000⋮1we often say that the X has isotropic Gaussian distribution. We will come back to these concepts again when we look at Time-Series Analysis in future discussion. For now, we have explored the fundamental concepts to build our background and are all set to explore basic detection problems.
Reference
[1] Kay, Steven M. Fundamentals of statistical signal processing: Detection theory. Prentice-Hall, Inc., 1993. Read Chapter 2 to familiarise yourself with some of the concepts discussed here.