
Section 5. Mean and Variance (LECTURE NOTES 4) 57 2.5 Mean and Variance The mean (or expected value) of a discrete random variable X with range R and pmf f(x) is, provided series converges absolutely, X µ = E(X) = xf(x): x2R The variance of discrete random variable X with range R and pmf f(x) is, provided series converges absolutely, X σ2 = V ar(X) = (x − µ)2f(x) = E[(X − µ)2] x2R X 2 = x2f(x) − µ2 = E(X2) − [E(X)] = E(X2) − µ2; x2R with associated standard deviation, σ. 1 For uniform random variable X with range R = f1; 2; : : : ; kg, and pmf f(x) = k , r k + 1 k2 − 1 k2 − 1 µ = E(X) = ; σ2 = V ar(X) = ; σ = ; 2 12 12 for binomial random variable, p µ = E(X) = np; σ2 = V ar(X) = npq; σ = npq; for Poisson random variable, p µ = E(X) = λ, σ2 = V ar(X) = λ, σ = λ. Exercise 2.5 (Mean and Variance) 1. Expected value, variance and standard deviation: seizures. The probability function for the number of seizures, X, of a typical epileptic person in any given year is given in the following table. x 0 2 4 6 8 10 f(x) 0.17 0.21 0.18 0.11 0.16 0.17 (a) Calculating the expected value. The expected value (mean) number of seizures is given by X E(X) = xf(x) = 0(0:17)+2(0:21)+4(0:18)+6(0:11)+8(0:16)+10(0:17) = x (i) 4:32 (ii) 4:78 (iii) 5:50 (iv) 5:75. 58 Chapter 2. Discrete Random Variables (LECTURE NOTES 4) P(X = x) P(X = x) P(X = x) 0.20 0.20 0.20 0.15 0.15 0.15 0.10 0.10 0.10 0 2 4 6 8 10 0 2 4 6 8 10 0 2 4 6 8 10 (a) (b) (c) Figure 2.11: Expected value: fulcrum point of balance x <- c(0,2,4,6,8,10) # values of random variable px <- c(0.17,0.21,0.18,0.11,0.16,0.17) # probabilities EX <- sum(x*px); EX # expected value [1] 4.78 (b) Understanding expected value: seizures. If the expected value is like a fulcrum point which balances the \weight" of the probability distribution, then the expected value is most likely close to the point of the fulcrum given in which of the three graphs above? (i) (a) 9 (ii) (b) 5 (iii) (c) 1. (c) Variance. The variance in number of seizures is given by σ2 = V ar[X] = E (X − µ)2 X = (X − µ)2f(x) x = (0 − 4:78)2(0:17) + (2 − 4:78)2(0:21) + ··· + (10 − 4:78)2(0:17) ≈ (i) 7:32 (ii) 8:78 (iii) 10:50 (iv) 12:07. VarX <- sum((x-EX)^2*px); VarX # variance [1] 12.0716 (d) Standard Deviation. The standard deviation in the number of seizures is p σ = pV ar(X) ≈ 12:07 ≈ (circle one) (i) 3:47 (ii) 4:11 (iii) 5:07 (iv) 6:25. SDX <- sqrt(VarX); SDX # standard deviation [1] 3.474421 In other words, we expect to see about µ ± σ = 4.78 ± 3.47 seizures according to the probability distribution given here. Section 5. Mean and Variance (LECTURE NOTES 4) 59 4.78 +- 3.47 4.78 +- 2.47 4.78 +- 1.47 P(Y = y) P(Y = y) P(Y = y) 0.20 0.20 0.20 0.15 0.15 0.15 0.10 0.10 0.10 0 2 4 6 8 10 0 2 4 6 8 10 0 2 4 6 8 10 (a) seizure distribution (b) another distribution (c) and another distribution Figure 2.12: Standard deviation: dispersion of distribution (e) Understanding standard deviation: \dispersion". The standard deviation measures the dispersion of a probability distribu- tion. The most dispersed distribution occurs in (i) (a) (ii) (b) (iii) (c). 2. Variance and standard deviation: rolling a pair of dice. If the dice are fair, the distribution of X (the sum of two rolls of a pair of dice) is x 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 5 4 3 2 1 f(x) 36 36 36 36 36 36 36 36 36 36 36 (a) Expected value, g(x) = x, X 1 1 µ = E(X) = xf(x) = 2 + ··· + 12 = 36 36 x (i) 4 (ii) 5 (iii) 6 (iv) 7. x <- 2:12 # values of random variable px <- c(1,2,3,4,5,6,5,4,3,2,1)/36 # probabilities EX <- sum(x*px); EX # E(X) [1] 7 (b) If g(x) = x2, X 1 1 E(X2) = x2f(x) = 22 + ··· + 122 = 36 36 x (i) 35:43 (ii) 47:61 (iii) 54:83 (iv) 65:67. EX2 <- sum(x^2*px); EX2 # E(X^2) [1] 54.83333 (c) Variance. σ2 = V [X] = E (X − µ)2 = E X2 − µ2 = 54:83 − 72 ≈ (i) 3:32 (ii) 5:83 (iii) 7:50 (iv) 8:07. 60 Chapter 2. Discrete Random Variables (LECTURE NOTES 4) VarX <- EX2 - EX^2; VarX # variance [1] 5.833333 (d) Standard deviation. p σ = pV ar(X) ≈ 5:83 ≈ (i) 2:42 (ii) 3:11 (iii) 4:07 (iv) 5:15. SDX <- sqrt(VarX); SDX # standard deviation [1] 2.415229 3. Uniform: die. Fair die has the following uniform pmf. x 1 2 3 4 5 6 1 1 1 1 1 1 f(x) 6 6 6 6 6 6 1 (a) Since pmf of uniform is f(x) = k , in this case, k = (i) 5 (ii) 6 (iii) 7 (iv) 8. (b) The expected value of die is X 1 1 1 1 1 1 µ = E(X) = xf(x) = 1 · + 2 · + 3 · + 4 · + 5 · + 6 · = 6 6 6 6 6 6 x (i) 2:5 (ii) 3:0 (iii) 3:5 (iv) 4:0, x <- 1:6 # values of random variable px <- rep(1/6,6) # probabilities: 1/6 repeated 6 times EX <- sum(x*px); EX # E(X) [1] 3.5 or, using the formula, the expected value of die is k + 1 6 + 1 µ = = = 2 2 (i) 2:5 (ii) 3:0 (iii) 3:5 (iv) 4:0. (c) If µ = 11, then k + 1 µ = 11 = 2 so k = (i) 11 (ii) 21 (iii) 22 (iv) 23 that is, the die has 21 sides. Section 5. Mean and Variance (LECTURE NOTES 4) 61 4. Another die question. Fair six-sided die is labelled in one of three ways: there are two sides labelled 1, three sides labelled 2 and one side labelled 3. If it costs $1 to play and you win $1 × result from die, what is the expected value of this game? die 1 2 3 x, payoff 1 − 1 2 − 1 3 − 1 2 3 1 f(x) 6 6 6 The expected value is X 2 3 1 µ = E(X) = xf(x) = 0 · + 1 · + 2 · = 6 6 6 x 1 3 5 7 (i) 6 (ii) 6 (iii) 6 (iv) 6 . x <- 0:2 # values of random variable px <- c(2,3,1)/6 # probabilities EX <- sum(x*px); EX # E(X) [1] 5/6 5. Binomial: Airplane engines. Each engine of four (n = 4) on an airplane fails 11% (p = 0:11; q = 1 − p = 0:89) of the time. Assume this problem obeys the conditions of a binomial experiment, in other words, X is b(4; 0:11). x 0 1 2 3 4 f(x) 0.310 0.058 0.005 0.000 (a) Fill in the blank: the chance no (zero) engines fail is 4 f(0) = 0:1100:894 = (i) 0:005 (ii) 0:058 (iii) 0:310 (iv) 0:627. 0 dbinom(0,4,0.11) # binomial pmf [1] 0.6274224 (b) The expected number of failures is X µ = E(X) = xf(x) = 0(0:627)+1(0:310)+2(0:058)+3(0:005)+4(0:000) ≈ x (i) 0:44 (ii) 0:51 (iii) 0:62 (iv) 0:73. or, using the formula, the expected number of failures is µ = np = 4(0:11) = (i) 0:44 (ii) 0:51 (iii) 0:62 (iv) 0:73. 62 Chapter 2. Discrete Random Variables (LECTURE NOTES 4) (c) The variance in number of failures is σ2 = V [X] = E (X − µ)2 X = (X − µ)2f(x) x = (0 − 0:44)2(0:627) + (1 − 0:44)2(0:0:310) + ··· + (4 − 0:44)2(0:000) ≈ (i) 0:15 (ii) 0:39 (iii) 0:51 (iv) 0:63. or, using the formula, the variance in number of failures is σ2 = npq = 4(0:11)(1 − 0:11) ≈ (i) 0:15 (ii) 0:39 (iii) 0:51 (iv) 0:63. (d) The pstandard deviation in number of failures is σ = 0:39 ≈ (i) 0:45 (ii) 0:56 (iii) 0:63 (iv) 0:83. 6. Bernoulli: mean and variance formulas. Bernoulli pmf is given by: x 0 1 f(x) 1 − p p (a) The expected value is X µ = E(X) = xf(x) = 0(1 − p) + 1(p) = x (i) p (ii) 1 − p (iii) (1 − p) (iv) p(1 − p). (b) The variance is X σ2 = V ar(X) = (x − µ)2f(x) = (0 − p)2(1 − p) + (1 − p)2(p) = x (i) p (ii) 1 − p (iii) (1 − p) (iv) p(1 − p). 7. Poisson: accidents.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages16 Page
-
File Size-