Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Engineering Statistics - IE 261 Chapter 3 Discrete Random Variables and Probability Distributions URL:

Similar presentations


Presentation on theme: "1 Engineering Statistics - IE 261 Chapter 3 Discrete Random Variables and Probability Distributions URL:"— Presentation transcript:

1 1 Engineering Statistics - IE 261 Chapter 3 Discrete Random Variables and Probability Distributions URL: http://home.npru.ac.th/piya/ClassesTU.html http://home.npru.ac.th/piya/webscilab

2 2 3-1 Discrete Random Variables

3 3 Example 3-1

4 4 3-2 Probability Distributions and Probability Mass Functions Figure 3-1 Probability distribution for bits in error.

5 5 3-2 Probability Distributions and Probability Mass Functions Definition

6 6 Example 3-5

7 7 Example 3-5 (continued)

8 8 3-3 Cumulative Distribution Functions Definition

9 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 10 Example 3-7 (Solution)

11 11 Example 3-8

12 12 Example 3-8 Figure 3-4 Cumulative distribution function for Example 3- 8.

13 13 3-4 Mean and Variance of a Discrete Random Variable Definition

14 14 3-4 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 15 Proof of Variance:

16 16 3-4 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 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) = 0.6561P(X = 1) = 0.2916P(X = 2) = 0.0486 P(X = 3) = 0.0036P(X = 4) = 0.0001 Find the mean and the variance of X

18 18 Example 3-9 (Solution) SCILAB -->x = [0 1 2 3 4]; -->fx = [0.6561 0.2916 0.0486 0.0036 0.0001]; -->MeanX = sum(x.*fx) MeanX = 0.4 -->VarX = sum((x.^2).*fx) - MeanX^2 VarX = 0.36

19 19 Example 3-9 (Solution)

20 20 Example 3-11 -->x = [10:15]; fx = [0.08 0.15 0.3 0.2 0.2 0.07]; -->MeanX = sum(x.*fx) MeanX = 12.5 -->VarX = sum((x.^2).*fx) - MeanX^2 VarX = 1.85

21 21 3-4 Mean and Variance of a Discrete Random Variable Expected Value of a Function of a Discrete Random Variable

22 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 = [0 1 2 3 4]; -->fx = [0.6561 0.2916 0.0486 0.0036 0.0001]; -->EX2 = sum((x.^2).*fx) EX2 = 158.1

23 23 Summary: Mean & Variance Mean: Variance:

24 24 3-5 Discrete Uniform Distribution Definition

25 25 3-5 Discrete Uniform Distribution Example 3-13

26 26 3-5 Discrete Uniform Distribution Figure 3-7 Probability mass function for a discrete uniform random variable.

27 27 3-5 Discrete Uniform Distribution Mean and Variance

28 28 Proof of Mean Hint:

29 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.

30 30 3-6 Binomial Distribution Random experiments and random variables

31 31 3-6 Binomial Distribution Random experiments and random variables

32 32 3-6 Binomial Distribution Definition

33 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 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 35 Example 3-18 -->n=18; p=0.1; -->y = binomial(p, n); -->X = 2; Y_X = y(X+1) Y_X = 0.2835121

36 36 Example 3-18 -->n=18; p=0.1; y=binomial(p, n); -->X = 4; Y_X = sum(y(X+1:$)) Y_X = 0.0981968 -->Y = sum(y(4:7)) Y = 0.2650319

37 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

38 38 3-6 Binomial Distribution Mean and Variance

39 39 Proof of Mean & Variance:

40 40 3-6 Binomial Distribution Example 3-19

41 41 3-7 Geometric and Negative Binomial Distributions Example 3-20

42 42 3-7.1 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

43 43 3-7.1 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)

44 44 3-7.1 Geometric Distribution Example 3-21 -->exec('geometric.sci') -->p=0.01; x=125; -->fx = geometric(p, x) fx = 0.0028471

45 45 3-7.1 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]

46 46 3-7.1 Geometric Distributions Lack of Memory Property

47 47 3-7.2 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

48 48 3-7 Geometric and Negative Binomial Distributions Figure 3-10. 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)

49 49 3-7 Geometric and Negative Binomial Distributions Figure 3-11. Negative binomial random variable represented as a sum of geometric random variables.

50 50 3-7.2 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

51 51 3-7 Geometric and Negative Binomial Distributions Example 3-25

52 52 3-7.2 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

53 53 3-8 Hypergeometric Distribution Definition

54 54 3-8 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

55 55 3-8 Hypergeometric Distribution Figure 3-12. 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)

56 56 3-8 Hypergeometric Distribution Example 3-27

57 57 3-8 Hypergeometric Distribution Example 3-27

58 58 3-8 Hypergeometric Distribution Mean and Variance same as binomial dist.

59 59 3-8 Hypergeometric Distribution Finite Population Correction Factor

60 60 3-8 Hypergeometric Distribution Figure 3-13. 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.

61 61 3-9 Poisson Distribution Example 3-30

62 62 3-9 Poisson Distribution Definition

63 63 3-9 Poisson Distribution Consistent Units function fx = poisson(Lambda, x) num = exp(-Lambda)*(Lambda^x); den = factorial(x); fx = num./den; endfunction

64 64 Example 3-33 SCILAB: -->exec('poisson.sci'); -->Lambda=10; x=12; -->fx = poisson(Lambda, x) fx = 0.0947803

65 65 Example 3-33 = 0.792 SCILAB: -->exec('poisson.sci'); -->Lambda=10; x=0:12; -->Fx = sum(poisson(Lambda, x)) Fx = 0.7915565

66 66 3-9 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


Download ppt "1 Engineering Statistics - IE 261 Chapter 3 Discrete Random Variables and Probability Distributions URL:"

Similar presentations


Ads by Google