1 Engineering Statistics - IE 261 Chapter 3 Discrete Random Variables and Probability Distributions URL:
2 3-1 Discrete Random Variables
3 Example 3-1
4 3-2 Probability Distributions and Probability Mass Functions Figure 3-1 Probability distribution for bits in error.
5 3-2 Probability Distributions and Probability Mass Functions Definition
6 Example 3-5
7 Example 3-5 (continued)
8 3-3 Cumulative Distribution Functions Definition
9 Example 3-7 Determine the probability mass function (pmf) of X from the following cdf: For example, find f(-2), f(0), and f(2)
10 Example 3-7 (Solution)
11 Example 3-8
12 Example 3-8 Figure 3-4 Cumulative distribution function for Example 3- 8.
Mean and Variance of a Discrete Random Variable Definition
Mean and Variance of a Discrete Random Variable Figure 3-5 A probability distribution can be viewed as a loading with the mean equal to the balance point. Parts (a) and (b) illustrate equal means, but Part (a) illustrates a larger variance.
15 Proof of Variance:
Mean and Variance of a Discrete Random Variable Figure 3-6 The probability distribution illustrated in Parts (a) and (b) differ even though they have equal means and equal variances.
17 Example 3-9 There is a chance that a bit transmitted through a digital transmission channel is received in error. Let X equal the number of bits in error in the next four bits transmitted. The possible values for X are {0, 1, 2, 3, 4} Suppose: P(X = 0) = P(X = 1) = P(X = 2) = P(X = 3) = P(X = 4) = Find the mean and the variance of X
18 Example 3-9 (Solution) SCILAB -->x = [ ]; -->fx = [ ]; -->MeanX = sum(x.*fx) MeanX = >VarX = sum((x.^2).*fx) - MeanX^2 VarX = 0.36
19 Example 3-9 (Solution)
20 Example >x = [10:15]; fx = [ ]; -->MeanX = sum(x.*fx) MeanX = >VarX = sum((x.^2).*fx) - MeanX^2 VarX = 1.85
Mean and Variance of a Discrete Random Variable Expected Value of a Function of a Discrete Random Variable
22 Example 3-12 In example 3-9, X is the number of bits in error in the next four bits transmitted. What is the expected value of square of the number of bits in error? (i.e., find E[X 2 ]) SCILAB -->x = [ ]; -->fx = [ ]; -->EX2 = sum((x.^2).*fx) EX2 = 158.1
23 Summary: Mean & Variance Mean: Variance:
Discrete Uniform Distribution Definition
Discrete Uniform Distribution Example 3-13
Discrete Uniform Distribution Figure 3-7 Probability mass function for a discrete uniform random variable.
Discrete Uniform Distribution Mean and Variance
28 Proof of Mean Hint:
29 Example 3-14 Let X denote the number of the 48 voice lines that are in use at a particular time. Assume that X is a discrete uniform random variable with a range of 0 to 48. Find the mean and the variance of X.
Binomial Distribution Random experiments and random variables
Binomial Distribution Random experiments and random variables
Binomial Distribution Definition
33 Binomial distribution probabilities pr = binomial(p,n) wherepr : row vector with n+1 components p : real number in [0,1] n : an integer >= 1 pr = binomial(p,n) returns the binomial probability vector, i.e. pr(k+1) is the probability of k success in n independent Bernouilli trials with probability of success p. In other words, pr(k+1) = probability(X=k), with X a random variable following the B(n,p) distribution, and numerically: / n \ k n-k / n \ n! pr(k+1) = | | p (1-p) with | | = \ k / \ k / k! (n-k)!
34 Figure 3-8 Binomial distributions for selected values of n and p. -->n=20; p=0.5; -->plot2d3(0:n, binomial(p,n)); -->n=10; p=0.1; -->plot2d3(0:n, binomial(p,n)); -->n=10; p=0.9; -->plot2d3(0:n, binomial(p,n));
35 Example >n=18; p=0.1; -->y = binomial(p, n); -->X = 2; Y_X = y(X+1) Y_X =
36 Example >n=18; p=0.1; y=binomial(p, n); -->X = 4; Y_X = sum(y(X+1:$)) Y_X = >Y = sum(y(4:7)) Y =
37 Generating data with Binomial distribution Y = grand(m, n, 'bin', N, p) generates random variates of size m-by-n from the binomial distribution with parameters N (positive integer) and p (real in [0,1]): number of successes in N independant Bernouilli trials with probability p of success COMMAND: cdfbin - cumulative distribution function Binomial distribution
Binomial Distribution Mean and Variance
39 Proof of Mean & Variance:
Binomial Distribution Example 3-19
Geometric and Negative Binomial Distributions Example 3-20
Geometric Distributions Definition function pr = geometric(p, n) // pr(n) = (1-p)^n*p where p is the probability of success pr = ((1-p).^n)*p; endfunction
Geometric Distributions Figure 3-9. Geometric distributions for selected values of the parameter p. SCILAB: -->exec('geometric.sci') -->p=0.1; x=1:20; -->fx = geometric(p, x); -->plot2d3(x, fx)
Geometric Distribution Example >exec('geometric.sci') -->p=0.01; x=125; -->fx = geometric(p, x) fx =
Geometric Distributions Definition Generating data with Geometric distribution Y = grand(m, n, 'geom', p) generates random variates from the geometric distribution with parameter p : number of Bernouilli trials (with probability success of p) until a succes is met. NOTE: p must be in [pmin,1]
Geometric Distributions Lack of Memory Property
Negative Binomial Distributions function fx = negative_binomial(p, x, r) temp = factorial(x-1)./(factorial(r-1).*factorial(x-r)); fx = (temp.*(p.^r)).*((1-p).^(x-r)); endfunction
Geometric and Negative Binomial Distributions Figure Negative binomial distributions for selected values of the parameters r and p. SCILAB: -->exec('negative_binomial.sci'); -->p=0.4; r=5; x=5:5:100; -->fx = negative_binomial(p, x, r); -->plot2d3(x, fx)
Geometric and Negative Binomial Distributions Figure Negative binomial random variable represented as a sum of geometric random variables.
Negative Binomial Distribution Generating data with Negative Binomial distribution Y = grand(m, n, 'nbn', N, p) generates random variates from the negative binomial distribution with parameters N (positive integer) and p (real in (0,1)) : number of failures occurring before N successes in independent Bernouilli trials with probability p of success. COMMAND: cdfnbn - cumulative distribution function negative binomial distribution
Geometric and Negative Binomial Distributions Example 3-25
Negative Binomial Distributions Example 3-25 SCILAB: -->exec('negative_binomial.sci'); -->x=3:5; p=0.0005; r=3; -->Fx = sum(negative_binomial(p, x, r)) Fx = 1.249D-09
Hypergeometric Distribution Definition
Hypergeometric Distribution function fx = hypergeometric(N, K, n, x) // / x-1 \ / N-K \ // f(x) = | | | | // \ r-1 / \ n-x / // // / N \ // | | // \ n / exec('combination_NR.sci'); num = combination_NR(K,x).*combination_NR(N-K,n-x); den = combination_NR(N, n); fx = num./den; endfunction
Hypergeometric Distribution Figure Hypergeometric distributions for selected values of parameters N, K, and n. SCILAB: exec('hypergeometric.sci'); N=10; n=5; K=5; x=0:5; fx = hypergeometric(N, K, n, x); plot2d3(x, fx)
Hypergeometric Distribution Example 3-27
Hypergeometric Distribution Example 3-27
Hypergeometric Distribution Mean and Variance same as binomial dist.
Hypergeometric Distribution Finite Population Correction Factor
Hypergeometric Distribution Figure Comparison of hypergeometric and binomial distributions. Sampling with replacement is equivalent to sampling from an infinite set because the proportion of success remains constant for every trial in the experiment. The finite population correction represents the correction to the binomial variance that results because the sampling is without replacement from the finite set of size N.
Poisson Distribution Example 3-30
Poisson Distribution Definition
Poisson Distribution Consistent Units function fx = poisson(Lambda, x) num = exp(-Lambda)*(Lambda^x); den = factorial(x); fx = num./den; endfunction
64 Example 3-33 SCILAB: -->exec('poisson.sci'); -->Lambda=10; x=12; -->fx = poisson(Lambda, x) fx =
65 Example 3-33 = SCILAB: -->exec('poisson.sci'); -->Lambda=10; x=0:12; -->Fx = sum(poisson(Lambda, x)) Fx =
Poisson Distribution Mean and Variance Y = grand(m, n, 'poi', mu) generates random variates from the Poisson distribution with mean mu (real >= 0.0) Command: cdfpoi - cumulative distribution function poisson distribution Generating data with Poison distribution