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
Eighth lecture Random Variables Consider the experiment of tossing a coin twice. . If we are interested in the number of heads that show on the top face, describe the sample space. Solution: S={ HH , HT , TH , TT } 2 1 1 0 w S X(w) R Definition (1): A random variable is a function that associates a real number with each element in the sample space. Remark: We shall use a capital letter, say X, to denote a random variable and its corresponding small letter, x in this case, for one of its values. Example (1): Two balls are drawn in succession without replacement from an urn containing 4 red balls and 3 black balls. The possible outcomes and the values y of the random variable Y, where Y is the number of red balls, are Sample Space RR RB BR BB y 2 1 1 0 Example(2) Two dice are rolled and we define the familiar sample space Ω= {(1, 1), (1, 2),….(6, 6)} containing 36 elements. Let X denote the random variable whose value for any element of Ω is the sum of the numbers on the two dice. Then the range of X is the set containing the 11 values of X: 2,3,4,5,6,7,8,9,10,11,12. Definition (2): If a sample space contains a finite number of possibilities or an unending sequence with as many elements as there are whole numbers , it is called a discrete sample space. Definition (3): If a sample space contains an infinite number of possibilities equal to the number of points on a line segment, it is called a continuous sample space. Types of random variables: 1. Discrete random variable. A random variable is called a discrete random variable if its set of possible outcomes is countable. 2. Continuous random variable. A random variable is called a continuous random variable when can take on values on a continuous scale . Example (3): Classify the following random variables as discrete or continuous: X: the number of automobile accidents per year in Virginia. Y: the length of time to play 18 holes of golf. M: the amount of milk produced yearly by a particular cow. N: the number of eggs laid each month by a hen. P: the number of building permits issued each month in a certain city. Q: the weight of grain produced per acre. Definition (4): The set of ordered pairs (x, f(x)) is a probability function, probability mass function, or probability distribution of the discrete random variable X if, for each possible outcome x, 1 f ( x ) 0, 2 f ( x ) 1, x 3 P (X Example(4): x ) f ( x ). consider random variable X with probabilities X 0 1 2 3 4 5 P(X=x) 0.05 0.10 0.20 0.40 0.15 0.10 You can observe that the probabilities sum to 1. The notation P(x) is often used for P(X = x). The notation f(x) is also used. In this example, P(4) = 0.15. The symbol P (or f) denotes the probability function, also called the probability mass function . The cumulative probabilities are given as F(x) = 𝒊≤𝒙 𝑷(𝒊). The interpretation is that F(x) is the probability that X will take a value less than or equal to x. The function F is called the cumulative distribution function (CDF). This is the only notation that is commonly used. For our example 4, F(3) = P(X ≤ 3) = P(X=0) + P(X=1) + P(X=2) + P(X=3) = 0.05 + 0.10 + 0.20 + 0.40 = 0.75 One can of course list all the values of the CDF easily by taking cumulative sums: X 0 1 2 3 4 5 P(X = x) 0.05 0.10 0.20 0.40 0.15 0.10 F(x) 0.05 0.15 0.35 0.75 0.90 1.00 The values of F increase. Definition(5): Let X a random variable with probability distribution f(x). The mean or expected value of X is E (x ) x f (x ) x If X is discrete, Definition(6): Let X be a random variable with probability distribution f(x). The expected value of the random variable g(x) is Definition(7): Let X a random variable with probability distribution f(x) and mean m. The variance of X is The positive square root of the variance, s, is called standard deviation of X. Theorem(1): The variance of a random variable X is From Example 4 A-The expected value of X is E( X ) = 𝑥 𝑥 P(x) = 𝑥 𝑥 P(X= x) The calculation for this example is E(X) = 0 × 0.05 + 1 × 0.10 + 2 × 0.20 + 3 × 0.40 + 4 × 0.15 + 5 × 0.10 = 0.00 + 0.10 + 0.40 + 1.20 + 0.60 + 0.50 = 2.80 B- The variance of X, is This is the expected square of the difference between X and its expected value, μ. We can calculate this for our example 4: X 0 1 2 3 4 5 x - 2.8 -2.8 -1.8 -0.8 0.2 1.2 2.2 (x − 2.8)2 7.84 3.24 0.64 0.04 1.44 4.84 P(X=x) 0.05 0.10 0.20 0.40 0.15 0.10 P(X=x) (𝑥−2.8)2 0.392 0.324 0.128 0.016 0.216 0.484 The variance is the sum of the final row. This value is 1.560. -There’s a simplified method, based on the result: This is easier because we’ve already found μ for our example, E(𝑋 2 )= 02 × 0.05 + 12 × 0.10 + 22 × 0.20 + 32 × 0.40 + 42 × 0.15 + 52 × 0.10 = 9.40. Then 𝛔𝟐 = 9.40 - (𝟐. 𝟖)𝟐 = 9.40 - 7.84 = 1.56. This is the same number as before The standard deviation of X is determined from the variance. Specifically, σ = 𝟏. 𝟓𝟔 ≈ 1.2490, Example (5): Suppose that the number of cars X that pass through a car wash between 4 p.m. and 5 p.m. on any sunny Friday has the following probability distribution: x 4 1 12 P(X=x) 5 1 12 6 1 4 7 1 4 8 1 6 9 1 6 Let g(X)=2X-1 represent the amount of money in dollars, paid to the attendant by the manager. Find the attendant’s expected earning for this particular time period. Solution: using definition 6 E(g(X))=E(2X-1)= 9𝑥=4 2𝑥 − 1 𝑓(𝑥) = 1 1 1 1 1 1 (7)( )+(9)( )+(11)( )+(13)( )+(15)( )+(17)( ) 12 12 4 4 6 6 = $12.67 The probability that X assumes a value between a and b is equal to the shaded area under the density function between the ordinates at x=a and x=b and from integral calculus is given f(x) b P (a X b ) f (x )dx a a b x Definition (8): The function f(x) is a probability density function for the continuous random variable X, defined over the set of real number R, if 1 f ( x ) 0, for all x R 2 f ( x )dx 1 b 3 P (a X b ) f (x )dx . a Example(6): Suppose X is a continuous random variable having the probability density function 5𝑒 −5𝑥 , 𝑥≥0 𝑓 𝑥 = 0, 𝑥<0 Find P(3≤ x ≤ 4) 4 4 P(3≤ x ≤ 4)= 3 5𝑒 −5𝑥 dx= −𝑒 −5𝑥 = −𝑒 −20 + 𝑒 −15 3 Example 7 Find the value of k for the following probability density function: (a) f(x)=1/k , a < x < b (b) 1- f(x)=k𝑒 −3𝑥 X>0 2- P(0.5 < x < 1) Definition (9): The cumulative distribution function F(x) of a continuous random variable X with density function f(x) is x F (x ) P ( X x ) f (t )dt , for x As an immediate consequence of Definition (9) one can write the two results, dF (x ) P (a X b ) F (b ) F (a ), and f (x ) dx If the derivative exists. Example(8): For the density function of Example (b7) find F(x) and use it to evaluate P(0.5≤ X ≤ 1) To find F(x) for f(x)=3𝑒 −3𝑥 , x>0 𝑥 𝑥 F(x)= −∞ 𝑓 𝑡 𝑑𝑡 = 0 3𝑒 −3𝑥 dt 𝑥 = −𝑒 −3𝑡 = −𝑒 −3𝑥 + 𝑒 0 = −𝑒 −3𝑥 +1 0 −3𝑥 = 1- 𝑒 0 , 𝐹 𝑥 = 1 − 𝑒 −3𝑥 , 𝑥≤0 𝑥>0 P(0.5 ≤ X ≤ 1) = F(1) – F(0.5) =1- 𝑒 −3 -(1-𝑒 −1.5 ) = - 𝑒 −3 + 𝑒 −1.5 = 0.173 Definition(10): Let X a random variable with probability distribution f(x). The mean or expected value of X is If X is continuous. E (x ) x f (x )dx Example(9): Let X be the random variable that denotes the life in hours of a certain electronic device. The probability density function is 20,000 , x 100 3 f (x ) x 0,elsewhere Find the expected life of this type of device. Solution: Using definition 10, we have ∞ ∞ 𝟐𝟎,𝟎𝟎𝟎 𝟐𝟎,𝟎𝟎𝟎 𝝁 = 𝑬 𝑿 = 𝟏𝟎𝟎 𝒙 𝟑 dx= 𝟏𝟎𝟎 𝟐 dx= 200. 𝒙 𝒙 Definition(11): Let X be a random variable with probability distribution f(x). The expected value of the random variable g(x) is g ( X ) E g ( X ) g (x ) f (x )dx If X is continuous. Example(10): Let X be a random variable with density function Find the expected value of g(X)=4X+3 Solution: E(4X+3)= 2 4𝑋+3 𝑥 2 −1 3 dx = 1 2 3 (4𝑥 3 −1 + 3𝑥 2 ) dx=8. Definition(12): Let X a random variable with probability distribution f(x) and mean . The variance of X is if X is continuous. s E ( X ) (x )2 f (x ) 2 2 The positive square root of the variance, s, is called standard deviation of X. Theorem(1): The variance of a random variable X is s 2 E (X 2 ) 2 Example(11): The weekly demand for Pepsi, in thousand of liters, from a local chain of efficiency stores, is a continuous random variable X having the probability density 2(x 1),1 x 2 f (x ) 0,eleswhere Find the mean and the variance of X. Theorem(2): If a and b are conestants, then E(aX+b)=aE(X)+b Corollary(1): Setting a=0, we see that E(b)=b Corollary(2): Setting b=0, we see that E(aX)=aE(X) Theorem(3): If a and b are conestants, then s2aX+b=a2s2X Corollary(1): Setting a=1, we see that s2X+b=s2X Corollary(2): Setting b=0, we see that s2aX=a2s2X