Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Random Variable and Probability Distribution Random Variable Definition: If S is a sample space with a probability measure and X is a real-valued function defined over the elements of sample space S, then X is called a random variable. [ X(s) = x ] Random Variable and Probability Distributions Random variables are usually denoted by capital letter. X, Y, Z, ... 1 Why Random Variable? Discrete Random Variable Example: (Toss a balanced coin) X = 1, if Head occurs, and X = 0, if Tail occurs. Probability Bar Chart 1/2 P(Head) = P(X = 1) = P(1) = .5 P(Tail) = P(X = 0) = P(0) = .5 Probability mass function: f(x) = P(X = x) =.5 , if x = 0, 1, and 0 elsewhere. 0 Lower case of letters are usually for denoting a element or a value of the random variable. 2 1 • A simple mathematical notation to describe an event. e.g.: X < 3, X = 0, ... • Mathematical function can be used to model the distribution through the use of random variable. e.g.: Binomial, Poisson, Normal, … • Types of random variables: – Discrete – Continuous 3 4 Probability Mass Function (or Probability Distribution) The probability mass function (p.m.f.) f(x) of a discrete random variable X is a function that satisfies the following properties: a) 0 ≤ f(x) ≤ 1 b) SxS f(x) = 1 (Total probability equals 1.) Discrete Distributions Random Variables of the Discrete Type (Random variables that assume discrete values by chance.) * Some places use p(x) instead of f(x). 5 6 DD1 - 1 Random Variable and Probability Distribution Uniform Distribution Checking Distribution (Uniform Distribution) If random variable X has a Discrete Uniform Distribution over first m integers, x = 1, 2, …, m, then X has a p.m.f. f(x) = 1 . m 7 X=x -100 f (x) = P(X = x) = 1/6, if x = 1, 2, 3, 4, 5, or 6, and 0 elsewhere. Actual Data 1 2 3 4 5 6 8 Is it a profitable insurance premium? f (x) .1 .75 -1 .25 .50 11 ? .65 .25 Probability line chart Random Variables of the Continuous Type -100 -1 11 Probability Mass Function Distribution: f (-100) = .1 f (-1) = .25, f (11) = .65, .65 , if f ( x) .25 , if .1 , if x 11 x -1 x -1009 Density Curve Percent Continuous Distributions 10 Density Curve f(x) Percent A smooth curve that fit the distribution f(x) A smooth curve that fit the distribution Density function, f (x) Test scores 10 20 30 40 50 60 70 80 90 100 110 11 Probability Density Function, f (x) Shows the probability density for all values of x. Test scores 10 20 30 40 50 60 70 80 90 100 110 Probability density is not probability! Use a mathematical model to describe the variable. 12 DD1 - 2 Random Variable and Probability Distribution Meaning of Area Under Curve Continuous Distribution Probability Density Function (p.d.f.) of a random variable X of continuous type with a space S is an integrable function, f(x), that satisfying the following conditions: Example: What percentage of the distribution is in between 72 and 86? f(x) 1. f (x) 0, x S, 2. S f(x) dx = 1, (Total area under curve is 1.) b 3. For a and b in S, P ( a X b ) f ( x ) dx P(72 X 86) a f(x) 72 86 a b x 13 Meaning of Area Under Curve X (Height) P(X = 72) = 0, density is not probability. 14 Uniform Distribution Example: What percentage of the distribution is in between 72 and 86? P(72 X 86) = P(72 < X < 86) f(x) = P(72 X <86) = P(72 < X 86) The continuous random variable X has a uniform distribution if its p.d.f. is equal to a constant on its sample space, S. If tS is the interval [a, b], then its p.d.f. is f ( x) 1 , b-a a x b. It is usually denoted as U(a, b). 72 86 X (Height) 15 f(x) 1 b-a 0 a b 16 Uniform Distribution Example: An index score is uniformly distributed between 4 to 8. What percentage of the distribution is in between 4 and 7? Mean and Standard Deviation of a Random Variable ¼ x (7 - 4) = 3/4 f(x) (Mathematical Expectation) 1/4 4 5 6 7 8 X (Index) 17 18 DD1 - 3 Random Variable and Probability Distribution Expected Value Expected Value Empirical study: Play the game 1000 times, if head turns you win $1, otherwise, you win $0. On average, how much money do you win per game? Outcome Frequency x Empirical study: Play the game 1000 times, if head turns you win $1, otherwise, you win $0. On average, how much money do you win per game? Relative Frequency Average f (x) Head($1) 500 .5 Tail ($0) 500 .5 Total 1000 1 = (1 · 500 + 0 · 500) / 1000 = 500 / 1000 = .5 or f (x) = 1 · 500/1000 + 0 · 500/1000 = 1 · .5 + 0 ·.5 = .5 x 19 20 Mathematical Expectation Expected Value Empirical study: Play the game 1000 times, if head turns you win $1, otherwise, you win $0. On average, how much money do you win per game? If f (x) is the p.m.f. of a discrete random variable X, with sample space S, the mean (mathematical expectation) of X is Outcome, x Relative Frequency, f(x) Product, x·f (x) mx = E[X] = SS x ·f(x) Head($1) .5 1 · .5 Tail ($0) .5 0 · .5 and the mean (mathematical expectation) of u(X) is Total 1.0 .5 E[u(X)] = SS u(x) ·f(x) S x·f (x) 21 22 What is the probability distribution of rolling a die? Probability mass function: (Uniform Distribution) f (x) = P(X = x) = 1/6, if x = 1, 2, 3, 4, 5, or 6, and 0 elsewhere. x f(x) 1 1/6 mx = E[X] = ? 2 3 4 5 6 1/6 1/6 1/6 1/6 1/6 1 1 1 E[ X ] 1 2 3 6 6 6 1 1 1 21 4 5 6 3.5 6 6 6 6 23 Is it a profitable insurance premium? x f(x) f(x) x·f(x) f(x) -100 -100 .1 .1 -100 ·.1 -1 -1 .25 .25 -1·.25 .75 11 .65 11·.65 .50 11 .65 Probability line chart .25 -100 -1 11 The mean of the distribution is E[X] = (-100) · .1+ (-1) · .25+ 11 · .65 = -3.1 (Weighted by probabilities.) 24 DD1 - 4 Random Variable and Probability Distribution Example Example Let random variable X have the p.m.f. f (x) = 0.25 , x S, where x = -1, 0, 1, 2, find E[(X)]. Let random variable X have the p.m.f. f (x) = 0.25 , x S, where x = -1, 0, 1, 2. Let u(x) = 3x, find E[u(X)]. Sol: E[X] = 0.5 Sol: E[X] = -1 ·f(-1) + 0 ·f(0) + 1·f(1) + 2 ·f(2) E[u(X)]= u(-1)·f(-1) + u(0)·f(0) + u(1)·f(1) + u(2)·f(2) = -1 ·.25 + 0 ·.25 + 1 ·.25 + 2 ·.25 =3(-1)·f(-1) + 3·0·f(0) + 3·1·f(1) + 3·2·f(2) = 0.5 = -3 ·.25 + 0 ·.25 + 3 ·.25 + 6 ·.25 = 1.5 25 26 Example Let random variable X have the p.m.f. f (x) = 0.25 , x S, where x = -1, 0, 1, 2, find E[X 2]. The Mean, Variance and Standard Deviation of Random Variable Sol: E[X2] = (-1)2·f(-1) + (0)2·f(0) + (1)2·f(1) + (2)2·f(2) = 1·f(-1) + 0 ·f(0) + 1·f(1) + 4 ·f(2) = 1 ·.25 + 0 ·.25 + 1 ·.25 + 4 ·.25 = 1.5 27 Mean and Variance of a Random Variable 28 Measure of Center for a Continuous Distribution If f (x) is the p.m.f. of a discrete random variable X, with space S, then the mean of the random variable is The mean value (expected value) of a continuous random variable (distribution) X, denoted by mX or E[X] or just m is defined as m = E[X] = SS x ·f(x) and the variance of the random variable is m X x f ( x ) dx s 2 = E[(X - m)2] = SS (x - m)2 ·f(x) - Standard Deviation = s = ? E [( X - m ) 2 ] 29 30 DD1 - 5 Random Variable and Probability Distribution Measure of Spread for a Continuous Distribution A Short Cut formula for Variance of a Random Variable The variance of a continuous random variable (distribution) X, denoted by sX2 or just s2 (or Var[X]) is defined as s 2 = E[X 2] - m 2 s 2 E [( X - m ) 2 ] ( x - m ) 2 f ( x ) dx - The standard deviation of X is s s 2 E [( X - m ) 2 ] 32 31 Example Example: Variance x Let random variable X have the p.m.f. f (x) = 0.25 , x S, where x = -1, 0, 1, 2, find the variance of X f(x) x· x·f(x) f(x) .75 -100 .1 -100 ·.1 .50 -1 .25 -1·.25 .25 11 .65 11·.65 Sol: Probability line chart -100 -1 11 E[X] = 0.5 E[X2] = 1.5 E[X] = (-100) · .1+ (-1) · .25+ 11 · .65 = -3.1 E[X2] = (-100)2 · .1+ (-1) 2 · .25+ 112 · .65 = 1078.9 Variance, s 2 = E[X 2] – (E[X])2 = 1078.9 – (– 3.1)2 = 1069.29 s2 = E[X2] - m2 = 1.5 – 0.52 = 1.5 – 0.25 = 1.25 33 34 Linear Function of a Random Variable Example Let random variable X have the p.m.f. f (x) = 0.25, where x = -1, 0, 1, 2, find the mean and variance of Y = 3X + 2 Let X be a random variable with mean mX and variance sX 2, and let random variable Y be a linear function of the X, and Y = aX + b, then Sol: mY E[Y ] E[aX b] a E[ X ] b am X b mX = 0.5, sX2 = 1.25 from earlier example mY = 3 x 0.5 + 2 = 3.5 s Y2 E[(Y - mY ) 2 ] E[( aX b - am X - b) 2 ] sY2 = 32 x 1.25 = 11.25 E[a 2 ( X - m X ) 2 ] a 2s X2 35 What is the standard deviation? 36 DD1 - 6