Chapter 2: Random Variables Experiment: Procedure + Observations Observation is an outcome Assign a number to each outcome: Random variable 1
Three ways to get an rv: Random Variables The rv is the observation The rv is a function of the observation Thervisafunctionofarv 2
Discrete Random Variables S X range of X (set of possible values) = X is discrete is S X is countable Discrete rv X has PMF P X (x) = P[X = x] 3
PMF Properties P X 0 (x) x2sx P X (x) = 1 For an event B S X, P[B] = P[X 2 B] = x2bp X (x) 4
Bernoulli RV Get the phone number of a random student. Let X = 0 if the last digit is even. Otherwise, let X = 1. P X (x) = 8 >< >: 1, p x = 0 p x = 1 0 otherwise 5
Binomial RV Test n circuits, each circuit is rejected with probability p independent of other tests. K = no. of rejects P K (k) = 8 < k = 0;1;:::;n, n k p k (1 p), n,k 0 otherwise K is the number of successes in n trials: : 6
Binomial: p = 0:2, n = 10 P K (k) = 8 <, 10 (0:2) k k 10,k k = 0;1;:::;10 (0:8) 0 otherwise : 0.4 P K (k) 0.2 0 0 5 10 k 7
Geometric RV Circuit rejected with prob p. Y is the number of tests up to and including the first reject. p r Y =1 p r Y =2 p r Y =3 1,p a 1,p a 1,p a ::: 8
From the tree, P[Y = 1] = p, P[Y = 2] = p(1, p), P Y (y) = 8 <, p) p(1 y,1 = 1;2;::: y 0 otherwise : 9
Geometric: p = 0:2 P Y (y) = 8 < y,1 y = 1;2;::: (0:2)(0:8) 0 otherwise : 0.2 P Y (y) 0.1 0 0 10 20 y 10
Pascal RV No. of tests, L, needed to find k rejects. P[L = l] = P[AB] A = fk, 1 rejects in l, 1testsg B = fsuccess on attempt lg Events A and B are independent 11
Pascal continued P[B] = p and P[A] is binomial: P[A] = P[k, 1 succ. in l, 1trials] = l, 1 k, 1 p k,1 (1, p) l,1,(k,1) P L (l) = P[A]P[B] (1) 8 <, l,1 = : k,1 p k (1 p), l,k = l + 1;::: k;k 0 otherwise (2) 12
Pascal: p = 0:2, k = 4 P L (l) = 8 <, l,1 (0:2) 3 4 l,4 l = 4;5;::: (0:8) otherwise: 0 : 0.1 P L (l) 0.05 0 0 10 20 30 40 l 13
Summary Bernoulli No. of succ. on one trial Binomial No. of succ on n trials Geometric No. of trials until first succ. Pascal No. of trials until succ k 14
Poisson rv Counts arrivals of something. Arrival rate λ, interval time T. With α = λt, P X (x) = 8 < : α x e,α =x! = 0;1;2;::: x 0 otherwise 15
Poisson: α = 0:5 P J ( j) = 8 < j e,0:5 = j! j = 0;1;::: (0:5) 0 otherwise : 1 P J (j) 0.5 0 0 2 4 j 16
Poisson: α = 5 P J ( j) = 8 < 5 j e,5 j! j = 0;1;::: = 0 otherwise : 0.2 P J (j) 0.1 0 0 5 10 15 j 17
Cumulative Distribution Functions The cumulative distribution function (CDF) of random variable X is F X (x) = P[X x] 18
CDF Example 1 1 P R (r) 0.5 F R (r) 0.5 0 1 0 1 2 3 r 0 1 0 1 2 3 r At the discontinuities r = 0andr = 2, F R (r) is the upper values. (right hand limit) 19
CDF Properties For any discrete rv X, range S X = fx 1 ;x 2 ;:::g satisfying x 1 x 2 :::, F X (, ) = 0andF X ( ) = 1 For all x 0 x, F X (x ) F X (x) 0 For x i S 2 X and small > ε 0, F X (x i ), F X (x i, ε) = P X (x i ) F X (x) = F X (x i ) for x i x < x i+1 20
Expected Value The expected value of X is E[X] = µ X = x2s X xp X (x) Also called the average of X. 21
Average vs. E[X] Average of n samples: m n = 1 n n i=1 x(i) Each x(i) 2 S X. If each x 2 S X occurs N x times, m 1 n = n N N x x x = x2s X x2s X n x xp X (x) x2s X! 22
Derived Random Variables Each sample value y of a derived rv Y is a function g(x) of a sample value x of a rv X. Notation: Y = g(x) Experimental Procedure 1. Perform experiment, observe outcome s. 2. Find x,thevalueofx 3. Calculate y = g(x) 23
PMF of Y = g(x) P Y (y) = P X (x) x:g(x)=y 24
Problem 2.6.5 Source transmits data packets to receiver. If rec d packet is error-free, rec vr sends back ACK, otherwise NAK sent. For each NAK, the packet is resent. Each packet transmission is independently corrupted with prob q. Find the PMF of X, no. of times a packet is sent 25
Each packet takes 1 msec to transmit. Source waits 1 msec to receive ACK. T equal the time req d until the packet is received OK. What is P T (t)? 26
Expected value of Y = g(x) Thm: Given rv X with PMF P X (x), the expected value of Y = g(x), is E[Y ] = µ Y = x2s X g(x)p X (x) Example: Y = ax + b: E[Y ] = x2s X (ax + b)p X (x) = ae[x] + b 27
Variance and Std Deviation Variance: = Y, (X µ 2 X ) E[Y ] = x2s X (X, µ X ) 2 P X (x) = Var[X] Variance measures spread of PMF p Standard Deviation: σ X = Var[X] Units of σ X are the same as X. 28
Properties of the variance If Y = X + b, Var[Y ] = Var[X]. If Y = ax, Var[Y ] = a 2 Var[X]. 29
Conditional PMF of X given B Given B, with P[B] > 0, P XjB (x) = P[X = xjb] Two kinds of conditioning. 30
Conditional PMFs - version 1 Probability model tells us P XjBi for possible (x) B i. Example: In the ith month of the year, the number of cars N crossing the GW bridge is Poisson with param α i. 31
Conditional PMFs - version 2 B is an event defined in terms of X. B is a subset of S X such that for each 2 x S X, either 2 x B or 62 x B. P XjB (x) = P[X = x;b] P[B] = 8 < : P X (x) P[B] x 2 B 0 otherwise 32
Contional PMF Example Example: X is geometric with p = 0:1. What is the conditional PMF of X given event B that X > 9? 33
Replace P X (x) with P XjB (xjb) E[XjB] = x xp XjB (x) E[g(X)jB] = x g(x)p XjB (x) Var[XjB] = E (X, E[XjB]) 2 Conditional Expectations 34