Download Mean, Variance, And Standard Deviation Of Random

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Mean, Variance, and Standard Deviation of Random Variables - Fathom Assignment
Example 1) A student uses the following logic. If his mother makes him lunch, he will only buy a soda
costing $.75. If his mother does not make him lunch, he will buy lunch costing $3.75. His mother makes him
lunch with probability 72%. What is the mean cost, variance and standard deviation. per day for the student?
What is the mean cost per week?
Analytic Solution:
X
p
Xp
.75
.72
.54
3.75
.28
1.05
The mean cost per day is .54 + 1.05 = 1.59. The mean cost per week is 7.95
The variance of the cost is !
2
2
X
2
= (.75" 1.59) (.72) + (3.75 " 1.59) .28 = 1.814
The standard deviation of the cost 1.814 = 1.347
Fathom Solution
!
1. Create a new collection.
2. Create a case table. Attributes: r - random number between 0 and 1 - random( 0). Cost: depending on r,
either .75 or 3.75.
Collection 1
r
1=
2
cost
random
( )i0.75
0.0753676
f ( r ! 0.72 ) "!0.75
#3.75
0.125718 0.75
3
0.33283
0.75
4
0.00944… 0.75
5
0.89004
6
0.0115996 0.75
3.75
7
0.529698 0.75
3. Create 1000 cases.
4. Make a histogram of Cost. Change your y-axis to relative frequency.
8
0.703928 0.75
9
www.MasterMathMentor.com
0.11969
0.75
Stu Schwartz
Histogram
Collection 1
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0.5
1.5
2.5
3.5
4.5
cost
5. Create a Summary table for Cost. It will automatically create the Mean. Create a new formula (Summary
menu) that will determine the weekly cost. Also create new formulas for the variance and standard
deviation of the cost. You can type them in or find them in the Function - Statistical - One Attribute menu.
Collection 1
Summary Table
1.581
cost
7.905
1.8042432
1.3432212
S1
S2
S3
S4
=
=
=
=
mean ( )
5 mean ( )
variance ( )
stdDev ( )
Example 2) I play a game that costs $5.00 to play. A coin is tossed 4 times. If I get 4 heads or 4 tails, I win $15.
If I get 3 heads or 3 tails, I get $6 back. Otherwise, I get nothing back. What is the mean amount I get on every
play of the game and what would I expect if I played the game 500 times? Find the mean and st. deviation.
Analytic Solution:
Create a sample space and calculate the probabilities of each.
Number of heads
Reward
p
Xp
4
15
1/16
.94
3
6
1/4
1.5
2
0
3/8
0
1
6
1/4
1.5
0
15
1/16
.94
! XP = 4.88 - this represents your payback. But since it costs you $5 to play, your mean payback is negative
12 cents. Meaning you will lose 12 cents every time you play. Play it 500 times and you will lose $60.
2# 1 &
2 1
2 3
21
2# 1 &
2
+ (6 " 4.88) + (0 " 4.88) + (6 " 4.88) + (15 " 4.88 ) %
= 23.359
The variance = ! X = (15 " 4.88) %
$ 16 '
$ 16 '
4
8
4
The standard deviation of your payback will be 4.729.
www.MasterMathMentor.com
Stu Schwartz
Note that you can calculate the variance without incorporating the $5 cost to play. Subtracting a constant does
not change the variance and thus the standard deviation. Games of chance usually have a high standard
deviation.
Fathom Solution:
1. Create a new collection.
2. Create a case table. Attributes: r1, r2, r3, r4 - random integers between 0 and 1 - randominteger( 0,1). Let
us define 1 = heads, 0 = tails. Numheads: Total number of heads - just add r1 + r2 + r3 + r4. Reward:
how much you win. At this point, it makes sense to incorporate the cost to play the game.
3. Create 1000 cases.
Collection 1
r1
r2
r3
r4
Numhead
Reward
=
1
randomInteger
randomInteger
randomInteger
randomInteger
( 0r,21+) r 3 +
1
1 ( 0, 1)
1 ( 0, 1)
0 ( 0, 1) r31 +
1 r4
2
1
1
0
0
2
3
0
1
0
0
1
4
1
0
1
1
3
5
1
1
1
0
3
1
6
1
1
0
0
2
-5
<new>
$ ( 4)
# ( 3)
#
-5
switch
( numhead ) " ( 2)
# ( 1)
1
#else
%
: 10
:1
:!5
:1
: 10
1
4. Make a histogram of Cost. Change your y-axis to relative frequency. (see first example)
5. Create
a1 Summary table
for Reward.
It will automatically
Create a new formula (Summary
7
1
0
1
3create the Mean.
1
menu) that will determine the cost for 500 games.
Collection 1
Histogram
Collection 1
0.40
0.35
0.30
0.25
0.20
0.15
0.10
0.05
Summary Table
-0.1985
reward
-99.25
21.284919
4.6135582
-1
0
1
2
3
Numhead
www.MasterMathMentor.com
4
5
6
S1
S2
S3
S4
=
=
=
=
mean ( )
500 mean ( )
variance ( )
stdDev ( )
Stu Schwartz
Example 3) The state lottery daily number costs $1 to play and has you choose a 3 digit number. If you get all 3
numbers, you win $500. Otherwise you lose your $1. What is the expected win (or loss) per play, variance, and
standard deviation?
Analytic Solution:
Create a sample space and calculate the probabilities of each.
Reward
0
500
p
999
1
1000
1000
Xp
0
.5
! XP = 0.5 . But since it costs you $1 to play, your expected “win” per play is -0.50 per play. That means that
every time you play the daily number, it costs you 50 cents.
2 # 999 &
2
1
2
+ (500 " .5)
= 249.75 .
The variance of your payback is ! X = (0 " .5) %
$ 1000 '
1000
The standard deviation of your payback is 15.803. Note again that you need not incorporate the cost to play the
game into these calculations (although you can). Also note that the variance and standard deviation are quite
large in this type of “all or nothing” game. That makes sense as most of the time you lose, creating a very small
variance. But when you win, the mean skyrockets and thus the spread skyrockets also.
Fathom Solution:
Fathom allows you to create 1,000 cases. Unfortunately, that may not be enough to show the results. After all, it
is quite possible that playing 1,000 lotteries, you may never hit. So the strategy here will be to create 1,000
cases and check how many winners you have. We can then repeat this process by collecting measures and end
up doing the 1,000 cases 100 times ending up with 100,000 cases. That should give us a good idea.
1. Create a new collection.
2. Create a case table. Lots of attributes: r1, r2, r3 will be the numbers that “we” pick. Pick1, Pick2, Pick3
will be the numbers that the lottery chooses - the winning numbers. Each has a formula as
RandomInteger(0, 9). Match1, Match 2, and Match 3 will be either 1 or 0, depending whether there is a
match between “our” number and the “winning number. Matches will be the total number of matches. Prize
will either be 500 or 499 depending on whether we get 3 matches. Remember - it costs $1 to play the game.
3. Create 1000 cases.
www.MasterMathMentor.com
Stu Schwartz
Collection 1
r1
=
1
2
r2
r3
pick1
pick2
pick3
match1
match2
match3
matches
prize
<new>
randomInteger
randomInteger
randomInteger
,i1f0() r) 2"!=
1 pick2
match1
+ match3
4
6
0 ( 0 , 9randomInteger
4) ( 0 , 9 )randomInteger
6( 0 , 9 ) ( 0randomInteger
0, 9 ) ( 0i1,f 9
3 ) "
( r) 1 =( 0pick1
i1f () r "!31= pick3
!1+ match2
i499
f ( matches
= 3 ) "!499
0
0
0
#
#
#
#$ 1
2
9
3
7
3
0
0
0
0
0
-1
3
9
0
6
0
0
0
0
1
0
1
-1
4
5
8
2
4
8
0
0
1
0
1
-1
5
5
3
8
2
2
0
0
0
0
0
-1
6
4
3
6
4
0
0
1
0
0
1
-1
4. From your collection, open the inspector (CTRL-I) and go to Measures. Create a measure called winnings.
You want to take the average prize of your 1000 cases.
5. With the collection highlighted, go to the Collection menu and Collect Measures. Open up the Measures
Inspector and turn animation off and run 100 measures.
6. Create a case table. Each case now represents the average winning for 1000 cases. Most will be zero or
slightly negative. Create a summary table with this information. You will automatically have the mean
calculated. It should be close to the expected number found in the analytical solution.
Measures from Collection 1
winnings
=
1
0
2
-0.5
3
0.5
4
0.5
5
-1
6
-1
<new>
Measures from Collection 1 Summary Table
winnings
-0.55
S1 = mean (
)
Note that I do not calculate the variance here. Since we have taken measures, the original data (prize) has
been lost and winnings just contains the mean of our wins for 1000 plays of the game. To get the variance,
and standard deviation, I would have to create a summary table for the 1000 plays for the attribute prize as I
did below.
In the 2 summary tables below, note that the mean prize on the left was -0.5. That meant that I won twice
(making $998) and lost 998 times (losing $998). So I made no money. In the middle table, the mean is -0.5.
That means I won once (making $499) and lost 999 times (losing $999). So I lost $500 or 50 cents a play. In
the 3rd table, the mean is -1 which means I never won. So I lost $1,000.
Note the wild fluctuations of the variances and standard deviations based on what happens. The 3rd table has
variance = 0 because all the results were the same. That is why to do a problem like this using simulation
www.MasterMathMentor.com
Stu Schwartz
techniques, a very large number of simulations must occur. That is why the mathematical analysis method is
very appropriate and easier.
Collection 1
Summary Table
Collection 1
Summary Table
0
prize
499.4995
www.MasterMathMentor.com
Summary Table
-0.5
prize
22.349485
S1 = mean ( )
S2 = variance ( )
S3 = stdDev ( )
Collection 1
250
-1
prize
15.811388
S1 = mean ( )
S2 = variance ( )
S3 = stdDev ( )
0
0
S1 = mean ( )
S2 = variance ( )
S3 = stdDev ( )
Stu Schwartz
Assignment:
There are 10 problems below in 3 groups. You are to choose one problem from each group. Read them first to
see which ones appeal to you.
For each problem, you are to present an analytical solution and a Fathom solution. The Fathom solution must
include a case table (first few cases) and a summary table, which should support your analytical solution. If the
formulas are not intricate, you should do 1,000 simulations. If this takes too much time, you are free to reduce
this number to a more manageable one. Your analytical solution should have the mean of your distribution
(expected value), the variance and standard deviation.
If you do not own Fathom, you should print out your Fathom case tables and summary tables. On notebook
paper, show your analysis and then tape your Fathom solutions. For each problem, I want the analytical solution
and Fathom simulation together so they can be contrasted.
Due Date: _________________________
Group 1
1) A building contractor pays $250 to bid on a contract. If he gets the contract, the probability of which is 20%,
he will make a net profit of $10,000. If he does not get the contract, the $250 is forfeited. Find the
contractor’s net expected profit on a bid and the variance and standard deviation.
2) Mr. Roberts wants to invest money in a venture where the probability that he earns $12,000 is 0.36, that he
earns $8,000 is 0.26 and that he loses $15,000 is 0.38. Find Mr. Robert’s expected earnings from his
investment and the variance and standard deviation.
3) It costs a bakery $6 to bake a cake. If it sells on the first day, the bakery charges $15. If it sells on the second
day, it charges $9. Otherwise, the cake is thrown out. The chances that the cake will sell on the first day is
65% and the chances that it will sell on the second day is 23%. How much money does the bakery expect to
make on each cake? Find the variance and standard deviation
Group 2
4) The corner of Bethlehem Pike and Sumneytown Pike is a dangerous intersection with accidents occurring
weekly. The number of traffic accidents at that corner is a random variable with the following probability
function. Find the expected number of accidents per week and the variance and standard deviation.
Number of accidents
Probability p( x )
0
0.50
1
0.30
2
0.15
3
0.05
5) A gambler goes to the horse races and decides to best on the first three races. He buys three $5 tickets to win
on the following horses in each race. The probability of each horse winning and the amount paid on a $5
ticket are as follows. What is his expected win for his $15 investment and the variance and standard
deviation?
Horse
Esmerelda
Prince’s Folly
Snowbird
www.MasterMathMentor.com
Probability
0.090
0.020
0.013
Amount Paid
50
225
375
Stu Schwartz
6) A gas station sells gasoline at the following prices with the given probabilities. If the average person buys 10
gallons of gas, what is the expected sale for each customer and the variance and standard deviation?
Type
Price
Probability
Regular
1.55 109
.46
Mid-Grade
1.61 109
.24
Hi-Grade
1.66 109
.19
Super
1.72 109
.11
7) When you buy a carton of a dozen eggs, usually the first thing you do is check to see if any eggs are broken.
The probability of!distribution for!the number of !
broken eggs in!a carton is given in the following table.
Find the mean number of broken eggs in a carton and the variance and standard deviation.
Broken Eggs 0
Probability 0.65
1
.20
2
.10
3
.04
4
.01
Group 3
8) The following carnival game costs $10 to play. A fair die is rolled. The dice are added. A player gets 1.5
times the sum of the dice. For instance, if you rolled an 8, you would get 1.5 • 8 = $12 back. Find the mean
win (or loss) per game and the variance and standard deviation.
9. The following game costs $10 to play. Choose a card from a standard deck of playing card. If you choose a 2
through 10, you will get the value of the card back (4 of spades gets $4 back). If you choose a Jack, Queen,
or King, you get $15 back. If you choose an Ace, you get $25 back. What is your expected win per play and
the variance and standard deviation?
10. “The Big Wheel” is a casino game where you bet a certain amount (in this case, $5). You spin the wheel,
which will point to dollar bills in certain denominations. The table below shows how many times each
denomination shows on the wheel. What is your expected “win” per play and the variance and standard
deviation?
Denomination
Number of slots
www.MasterMathMentor.com
$1
12
$2
13
$4
15
$10
11
$20
5
$50
3
$100
1
Stu Schwartz