* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Variance and Standard Deviation - Penn Math
Pattern recognition wikipedia , lookup
Lambda calculus wikipedia , lookup
Value at risk wikipedia , lookup
Hardware random number generator wikipedia , lookup
Simulated annealing wikipedia , lookup
Fisher–Yates shuffle wikipedia , lookup
Birthday problem wikipedia , lookup
Risk aversion (psychology) wikipedia , lookup
Variance and Standard Deviation Christopher Croke University of Pennsylvania Math 115 Christopher Croke Calculus 115 Expected value The expected value E (X ) of a discrete random variable X with probability function f (xi ) is: E (X ) = Σi xi · f (xi ). Christopher Croke Calculus 115 Expected value The expected value E (X ) of a discrete random variable X with probability function f (xi ) is: E (X ) = Σi xi · f (xi ). This is a ”weighted average”. Christopher Croke Calculus 115 Expected value The expected value E (X ) of a discrete random variable X with probability function f (xi ) is: E (X ) = Σi xi · f (xi ). This is a ”weighted average”. For a uniform distribution, i.e. f (xi ) = N1 where N = #{xi }, then it is just the usual average: E (X ) = Christopher Croke ΣN i=1 xi . N Calculus 115 Expected value The expected value E (X ) of a discrete random variable X with probability function f (xi ) is: E (X ) = Σi xi · f (xi ). This is a ”weighted average”. For a uniform distribution, i.e. f (xi ) = N1 where N = #{xi }, then it is just the usual average: E (X ) = ΣN i=1 xi . N Problem: What is the expected number of heads in four tosses? Christopher Croke Calculus 115 Expected value of a continuous random variable For a continuous random variable with probability density function f (x) on [A, B] we have: Z B E (X ) = xf (x)dx. A Christopher Croke Calculus 115 Expected value of a continuous random variable For a continuous random variable with probability density function f (x) on [A, B] we have: Z B E (X ) = xf (x)dx. A Problem: Consider our random variable X which is the sum of the coordinates of a point chosen randomly from [0, 1] × [0, 1]? What is E (X )? Christopher Croke Calculus 115 Variance The first first important number describing a probability distribution is the mean or expected value E (X ). Christopher Croke Calculus 115 Variance The first first important number describing a probability distribution is the mean or expected value E (X ). The next one is the variance Var (X ) = σ 2 (X ). The square root of the variance σ is called the Standard Deviation. Christopher Croke Calculus 115 Variance The first first important number describing a probability distribution is the mean or expected value E (X ). The next one is the variance Var (X ) = σ 2 (X ). The square root of the variance σ is called the Standard Deviation. For continuous random variable X with probability density function f (x) defined on [A, B] we saw: Z B E (X ) = xf (x)dx. A Christopher Croke Calculus 115 Variance The first first important number describing a probability distribution is the mean or expected value E (X ). The next one is the variance Var (X ) = σ 2 (X ). The square root of the variance σ is called the Standard Deviation. For continuous random variable X with probability density function f (x) defined on [A, B] we saw: Z B E (X ) = xf (x)dx. A (note that this does not always exist if B = ∞.) Christopher Croke Calculus 115 Variance The first first important number describing a probability distribution is the mean or expected value E (X ). The next one is the variance Var (X ) = σ 2 (X ). The square root of the variance σ is called the Standard Deviation. For continuous random variable X with probability density function f (x) defined on [A, B] we saw: Z B E (X ) = xf (x)dx. A (note that this does not always exist if B = ∞.) The variance will be: Z B σ 2 (X ) = Var (X ) = E ((X − E (X ))2 ) = (x − E (X ))2 f (x)dx. A Christopher Croke Calculus 115 Variance The first first important number describing a probability distribution is the mean or expected value E (X ). The next one is the variance Var (X ) = σ 2 (X ). The square root of the variance σ is called the Standard Deviation. For continuous random variable X with probability density function f (x) defined on [A, B] we saw: Z B E (X ) = xf (x)dx. A (note that this does not always exist if B = ∞.) The variance will be: Z B σ 2 (X ) = Var (X ) = E ((X − E (X ))2 ) = (x − E (X ))2 f (x)dx. A Christopher Croke Calculus 115 Problem:(uniform probability on an interval) Let X be the random variable you get when you randomly choose a point in [0, B]. a) find the probability density function f . b) find the cumulative distribution function F (x). c) find E (X ) and Var (X ) = σ 2 . Christopher Croke Calculus 115 Problem:(uniform probability on an interval) Let X be the random variable you get when you randomly choose a point in [0, B]. a) find the probability density function f . b) find the cumulative distribution function F (x). c) find E (X ) and Var (X ) = σ 2 . Alternative formula for variance: σ 2 = E (X 2 ) − µ2 . Christopher Croke Calculus 115 Problem:(uniform probability on an interval) Let X be the random variable you get when you randomly choose a point in [0, B]. a) find the probability density function f . b) find the cumulative distribution function F (x). c) find E (X ) and Var (X ) = σ 2 . Alternative formula for variance: σ 2 = E (X 2 ) − µ2 . Why? Christopher Croke Calculus 115 Problem:(uniform probability on an interval) Let X be the random variable you get when you randomly choose a point in [0, B]. a) find the probability density function f . b) find the cumulative distribution function F (x). c) find E (X ) and Var (X ) = σ 2 . Alternative formula for variance: σ 2 = E (X 2 ) − µ2 . Why? E ((X − µ)2 ) = E (X 2 − 2µX + µ2 ) Christopher Croke Calculus 115 Problem:(uniform probability on an interval) Let X be the random variable you get when you randomly choose a point in [0, B]. a) find the probability density function f . b) find the cumulative distribution function F (x). c) find E (X ) and Var (X ) = σ 2 . Alternative formula for variance: σ 2 = E (X 2 ) − µ2 . Why? E ((X − µ)2 ) = E (X 2 − 2µX + µ2 ) = E (X 2 ) + E (−2µX ) + E (µ2 ) Christopher Croke Calculus 115 Problem:(uniform probability on an interval) Let X be the random variable you get when you randomly choose a point in [0, B]. a) find the probability density function f . b) find the cumulative distribution function F (x). c) find E (X ) and Var (X ) = σ 2 . Alternative formula for variance: σ 2 = E (X 2 ) − µ2 . Why? E ((X − µ)2 ) = E (X 2 − 2µX + µ2 ) = E (X 2 ) + E (−2µX ) + E (µ2 ) = E (X 2 ) − 2µE (X ) + µ2 = E (X 2 ) − 2µ2 + µ2 = E (X 2 ) − µ2 . Christopher Croke Calculus 115 Variance - Continuous case Problem Consider the problem of the age of a cell in a culture. We had the probability density function was f (x) = 2ke −kx on [0, T ] where k = ln(2) T . a) Find E (X ). Christopher Croke Calculus 115 Variance - Continuous case Problem Consider the problem of the age of a cell in a culture. We had the probability density function was f (x) = 2ke −kx on [0, T ] where k = ln(2) T . a) Find E (X ). b) Find σ 2 . It is easier in this case to use the alternative definition of σ 2 : Z B 2 2 2 σ = E (X ) − E (X ) = x 2 f (x)dx − E (X )2 . A Christopher Croke Calculus 115 Variance - Continuous case Problem Consider the problem of the age of a cell in a culture. We had the probability density function was f (x) = 2ke −kx on [0, T ] where k = ln(2) T . a) Find E (X ). b) Find σ 2 . It is easier in this case to use the alternative definition of σ 2 : Z B 2 2 2 σ = E (X ) − E (X ) = x 2 f (x)dx − E (X )2 . A Problem: Consider our random variable X which is the sum of the coordinates of a point chosen randomly from [0; 1] × [0; 1]? What is Var (X )? Christopher Croke Calculus 115 Expected value for a binomial random variable For X a binomial random variable with parameters n and p E (X ) = np Christopher Croke Calculus 115 Expected value for a binomial random variable For X a binomial random variable with parameters n and p E (X ) = np Why? Christopher Croke Calculus 115 Expected value for a binomial random variable For X a binomial random variable with parameters n and p E (X ) = np Why? E (X ) = Σnk=1 Christopher Croke n k n−k k p q k Calculus 115 Expected value for a binomial random variable For X a binomial random variable with parameters n and p E (X ) = np Why? E (X ) = Σnk=1 n k n−k k p q k Now for any p and q this is n k n−k ∂ =p Σ p q k ∂p Christopher Croke Calculus 115 Expected value for a binomial random variable For X a binomial random variable with parameters n and p E (X ) = np Why? E (X ) = Σnk=1 n k n−k k p q k Now for any p and q this is n k n−k ∂ ∂ =p Σ p q = p (p + q)n k ∂p ∂p Christopher Croke Calculus 115 Expected value for a binomial random variable For X a binomial random variable with parameters n and p E (X ) = np Why? E (X ) = Σnk=1 n k n−k k p q k Now for any p and q this is n k n−k ∂ ∂ =p Σ p q = p (p + q)n = pn(p + q)n−1 . k ∂p ∂p Christopher Croke Calculus 115 Expected value for a binomial random variable For X a binomial random variable with parameters n and p E (X ) = np Why? E (X ) = Σnk=1 n k n−k k p q k Now for any p and q this is n k n−k ∂ ∂ =p Σ p q = p (p + q)n = pn(p + q)n−1 . k ∂p ∂p For our choice of p and q this is just np. Christopher Croke Calculus 115 Expected value for a binomial random variable For X a binomial random variable with parameters n and p E (X ) = np Why? E (X ) = Σnk=1 n k n−k k p q k Now for any p and q this is n k n−k ∂ ∂ =p Σ p q = p (p + q)n = pn(p + q)n−1 . k ∂p ∂p For our choice of p and q this is just np. Problem: For our ballplayer hitting .300 coming to bat 4 times a game what is the expected number of hits? Christopher Croke Calculus 115 Expected value Problem: Two players play a game by drawing balls (without replacement) in turn from an urn that has 2 red balls and 4 white balls in it. A player wins when he draws a red ball. The player going first will get $2 if he wins while the player going second will get $3. Would you rather go first or second or does it matter at all? Christopher Croke Calculus 115 Expected value Problem: Two players play a game by drawing balls (without replacement) in turn from an urn that has 2 red balls and 4 white balls in it. A player wins when he draws a red ball. The player going first will get $2 if he wins while the player going second will get $3. Would you rather go first or second or does it matter at all? How does this change if no one gets paid after 4 balls turn up white? Christopher Croke Calculus 115 Expected value Problem: Two players play a game by drawing balls (without replacement) in turn from an urn that has 2 red balls and 4 white balls in it. A player wins when he draws a red ball. The player going first will get $2 if he wins while the player going second will get $3. Would you rather go first or second or does it matter at all? How does this change if no one gets paid after 4 balls turn up white? Christopher Croke Calculus 115 variance in the discrete case If f (xi ) is the probability distribution function for a random variable with range {x1 , x2 , x3 , ...} and mean µ = E (X ) then: Var (X ) = σ 2 = (x1 −µ)2 f (x1 )+(x2 −µ)2 f (x2 )+(x3 −µ)2 f (x3 )+... It is a description of how the distribution ”spreads”. Christopher Croke Calculus 115 variance in the discrete case If f (xi ) is the probability distribution function for a random variable with range {x1 , x2 , x3 , ...} and mean µ = E (X ) then: Var (X ) = σ 2 = (x1 −µ)2 f (x1 )+(x2 −µ)2 f (x2 )+(x3 −µ)2 f (x3 )+... It is a description of how the distribution ”spreads”. Note Var (X ) = E ((X − µ)2 ). Christopher Croke Calculus 115 variance in the discrete case If f (xi ) is the probability distribution function for a random variable with range {x1 , x2 , x3 , ...} and mean µ = E (X ) then: Var (X ) = σ 2 = (x1 −µ)2 f (x1 )+(x2 −µ)2 f (x2 )+(x3 −µ)2 f (x3 )+... It is a description of how the distribution ”spreads”. Note Var (X ) = E ((X − µ)2 ). The alternative description works for the same reason as in the continuous case. i.e. Var (X ) = E (X 2 ) − E (X )2 Christopher Croke Calculus 115 variance in the discrete case If f (xi ) is the probability distribution function for a random variable with range {x1 , x2 , x3 , ...} and mean µ = E (X ) then: Var (X ) = σ 2 = (x1 −µ)2 f (x1 )+(x2 −µ)2 f (x2 )+(x3 −µ)2 f (x3 )+... It is a description of how the distribution ”spreads”. Note Var (X ) = E ((X − µ)2 ). The alternative description works for the same reason as in the continuous case. i.e. Var (X ) = E (X 2 ) − E (X )2 The standard deviation has the same units as X . (I.e. if X is measured in feet then so is σ.) Christopher Croke Calculus 115 Problem: Remember the game where players pick balls from an urn with 4 white and 2 red balls. The first player is paid $2 if he wins but the second player gets $3 if she wins. No one gets payed if 4 white balls are chosen. Christopher Croke Calculus 115 Problem: Remember the game where players pick balls from an urn with 4 white and 2 red balls. The first player is paid $2 if he wins but the second player gets $3 if she wins. No one gets payed if 4 white balls are chosen. We have seen that the payout and probabilities for the first player are: Payout Probability 8 2 15 1 0 15 6 −3 15 Christopher Croke Calculus 115 Problem: Remember the game where players pick balls from an urn with 4 white and 2 red balls. The first player is paid $2 if he wins but the second player gets $3 if she wins. No one gets payed if 4 white balls are chosen. We have seen that the payout and probabilities for the first player are: Payout Probability 8 2 15 1 0 15 6 −3 15 2 . The expected value was µ = − 15 Christopher Croke Calculus 115 Problem: Remember the game where players pick balls from an urn with 4 white and 2 red balls. The first player is paid $2 if he wins but the second player gets $3 if she wins. No one gets payed if 4 white balls are chosen. We have seen that the payout and probabilities for the first player are: Payout Probability 8 2 15 1 0 15 6 −3 15 2 . What is the variance? The expected value was µ = − 15 Christopher Croke Calculus 115 Problem: Remember the game where players pick balls from an urn with 4 white and 2 red balls. The first player is paid $2 if he wins but the second player gets $3 if she wins. No one gets payed if 4 white balls are chosen. We have seen that the payout and probabilities for the first player are: Payout Probability 8 2 15 1 0 15 6 −3 15 2 . What is the variance? The expected value was µ = − 15 Christopher Croke Calculus 115 This often makes it easier to compute since we can compute µ and E (X 2 ) at the same time. Christopher Croke Calculus 115 This often makes it easier to compute since we can compute µ and E (X 2 ) at the same time. Problem: Compute E (X ) and Var (X ) where X is a random variable with probability given by the chart below: X Pr (X = x) 1 0.1 2 0.2 3 0.3 4 0.3 5 0.1 Christopher Croke Calculus 115 This often makes it easier to compute since we can compute µ and E (X 2 ) at the same time. Problem: Compute E (X ) and Var (X ) where X is a random variable with probability given by the chart below: X Pr (X = x) 1 0.1 2 0.2 3 0.3 4 0.3 5 0.1 We will see later that for X a binomial random variable σ 2 = npq. Christopher Croke Calculus 115 This often makes it easier to compute since we can compute µ and E (X 2 ) at the same time. Problem: Compute E (X ) and Var (X ) where X is a random variable with probability given by the chart below: X Pr (X = x) 1 0.1 2 0.2 3 0.3 4 0.3 5 0.1 We will see later that for X a binomial random variable σ 2 = npq. Problem: What is the variance of the number of hits for our batter that bats .300 and comes to the plate 4 times? Christopher Croke Calculus 115