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
STATISTICS AND THE TI - 84
Lesson 5 : Probability
PROGRAM 1: PROB1. Program for computing probabilities (no conditional probabilities given)
PRGM NEW
ENTER
PROGRAM
Name: PROB1
ENTER
PROGRAM: PROB1
: PRGM I/O 2 (Prompt)
: Prompt A, B ENTER
: PRGM I/O 3
: Disp “ARE A AND B INDEPENDENT?” ENTER
:PRGM I/O 2 (Prompt)
:Prompt N ENTER
:PRGM 1
:If N 2ndTEST 1 = 1 (1 indicates: yes, 0 indicates: no) ENTER
:PRGM 0
:Goto C ENTER
:PRGM I/O 3
:Disp “ARE A AND B DISJOINT?” ENTER
:PRGM I/O 2 (Prompt)
:Prompt N ENTER
:PRGM 1
:If N 2ndTEST 1 = 1 (1 indicates: yes, 0 indicates: no) ENTER
:PRGM 0
:Goto D ENTER
:PRGM I/O 2 (Prompt)
: Prompt I ENTER (I is the probability of the intersection)
:PRGM 0
:Goto F ENTER
:PRGM 9 Lbl C ENTER
:AB STO I ENTER
:PRGM 0 Goto F ENTER
:PRGM 9 Lbl D ENTER
:0 STO I ENTER
:PRGM 0 Goto F ENTER
:PRGM 9 Lbs F ENTER
:A+B-I STO U: I B STO M: I A STO R ENTER
:PRGM I/O 3
:Disp “P(A AND B) IS”, I, “P(A OR B) IS”, U ENTER
:PRGM 8 PAUSE ENTER
:PRGM I/O 3
: “P(A GIVEN B) IS ”, M, “P(B GIVEN A) IS”, R ENTER
: PRGM 8 PAUSE ENTER
:PRGM I/O 3
: “P(ODDS IN FAVOR OF A ARE ”, A (1-A) MATH 1 ENTER , “P(ODDS AGAISNT A
ARE ”, (1-A) A MATH 1 ENTER 2nd QUIT
-44-
Exercise 1. A and B are disjoint event with P(A)=.4 and P(B)=.3.
Find P(A and B), P(A or B), P(A given B) and P(B given A). What are the odd in favor and
against A?
PRGM select PROB1
prgmPROB ENTER
A=? .4 ENTER
B=? .3 ENTER
Are A and B independent? 0 ENTER
Are A and B disjoint? 1 ENTER
answers: P(A and B) =0, P(A or B) =.7,
ENTER
answers: P(A given B)=0, P(B given A))=0
ENTER answers: odds in favor of A are 2/3, odds against A are 3/2
Exercise 2. A and B are independent events with P(A)=.4 and P(B)=.3.
Find P(A and B), P(A or B), P(A given B) and P(B given A). What are the odd in favor and
against A?
2nd ENTRY
prgmPROB1 ENTER
A? .4 ENTER
B? .3 ENTER
Are A and B independent? 1 ENTER
answer: P(A and B)=.12, P(A or B)=.58
ENTER answers: P(A given B)=.4, P(B given A)=.3
ENTER answers: odds in favor of A are 2/3, odds against A are 3/2
Exercise 3. If A and B are events of a sample space with P(A)=.4 and P(B)=.3 and P(A and B)=.18,
find P(A or B), P(A given B) and P(B given A). What are the odd in favor and against A?
2nd ENTRY
prgmPROB1 ENTER
A? .4 ENTER
B? .3 ENTER
Are A and B independent? 0 ENTER
Are A and B disjoint? 0 ENTER
I? .18 ENTER
answers: P(A and B)=.18, P(A or B)=.52
ENTER answers: P(A given B)=.6, P(B given A)=.45
ENTER answers: odds in favor of A are 2/3, odds against A are 3/2
-45-
Exercise 4. If P(A)=.6, P(B)=.8 and P(A and B)=.45. Find P(not A), P(A or B), P(A|B) and P(B|A). What
are the odd in favor and against A?
PRGM
A=?
.6
B=?
.8 ENTER
Are A and B independent?
Are A and B disjoint? 0
I= ?
ENTER
ENTER answers: odds in favor of A are 3/2, odds against A are 2/3
PROB1
0.45
ENTER
ENTER
ENTER
0
ENTER (0 means: no)
ENTER
answers P(A and B) is 0.4
answers P(A given B) is 0.5625
P(A or B) is 0.95
P(B given A) is 0.75
PROGRAM 2: PROB2. Program for computing with conditional
probabilities
PRGM NEW ENTER
PROGRAM
NAME: PROB2
ENTER
PROGRAM: PROB2
PRGM I/O 2 (Prompt)
Prompt A, C, D ENTER
Note: P(B given A)=C and P(B given notA)=D
1 - A STO E: AC STO I: E D STO J ENTER
I+J STO B: A+B-I STO U: IB STO F ENTER
PRGM I/O 3
Disp “P(B)=“, B, “P(A and B)=“,I ENTER
PRGM 8 PAUSE
ENTER
PRGM I/O 3
Disp “P(A or B)=“, U, “P(A given B)=“, F ENTER
PRGM 8 PAUSE
PRGM I/O 3
Disp “P(NEITHER A NOR B) is”, J ENTER
: PRGM 8 PAUSE ENTER
:PRGM I/O 3
: “P(ODDS IN FAVOR OF A ARE ”, A (1-A) MATH 1 ENTER , “P(ODDS AGAISNT A
ARE ”, (1-A) A MATH 1 ENTER
2nd QUIT
-46-
Exercise 5. Let A and B be events of a sample space, P(A)=.6, P(B|A)=.3
and P(B|notA)=.7. Find P(B), P(A and B), P(A or B), P(neither A nor B) and P(A|B)
PRGM select PROB2 ENTER
PrgmPROB2 ENTER
A? .6 ENTER
C? .3 ENTER
D? .7 ENTER
answers: P(B)=.46 P(A and B)=.18
ENTER P(P(A or B)=.88 P(A given B)=.3913043478
ENTER P(neither A nor B) =.28
ENTER answers: odds in favor of A are 3/2, odds against A are 2/3
Exercise 6.
Let A and B be events of a sample space, P(A)=.8, P(B|A)=.3
and P(B|notA)=.9. Find P(B), P(A or B), P(neither A nor B) and P(A|B)
PRGM select PROB2 ENTER
PrgmPROB2 ENTER
A? .8 ENTER
C? .3 ENTER
D? .9 ENTER
answers: P(B)=.42 P(A and B)=.24
ENTER P(P(A or B)=.98, P(A given B) = .5714285714
ENTER P(neither A nor B) =.18
ENTER answers: odds in favor of A are 4/1, odds against A are 1/4
Exercise 7. Find the expected value (mathematical expectation) of the values in the list {1, 4, 9,
13} with respective probabilities of {0.15, 0.18, 0.32, 0.35}
{1, 4, 9, 13} STO 2nd L1 ENTER
{0.15, 0.18, 0.32, 0.35} STO 2nd L2 ENTER
2ndLIST MATH 5
sum(2nd L12nd L2) ENTER
answer: the expected value is 8.3
Exercise 8. Use 2nd LIST to find the expected value (mathematical expectation) of the values in
the list {1, 4, 9, 13} with respective probabilities of {0.15, 0.18, 0.32, 0.35}
{1, 4, 9, 13} STO 2nd L1 ENTER
{0.15, 0.18, 0.32, 0.35} STO 2nd L2 ENTER
2ndLIST MATH 3
mean(2nd L1, 2nd L2) ENTER
answer: the expected value is 8.3
-47-
Exercise 9. Use STATS to find the expected value (mathematical expectation) and the standard
deviation of the values in the list {1, 4, 9, 13} with respective probabilities of {0.15, 0.18, 0.32,
0.35}
{1, 4, 9, 13} STO 2nd L1 ENTER
{0.15, 0.18, 0.32, 0.35} STO 2nd L2 ENTER
STAT CALC 1
1-Var Stats 2nd L1, 2nd L2 ENTER
answer: the mean or expected value is 8.3 and the
standard deviation x 4.3829214
Exercise 10. Use STATS to find the expected value (mathematical expectation) and the standard
deviation of the following probability distribution
x
-7
-6
-4
3
8
12
15
19
21
25
30
36
P(x) 0.08 0.12 0.04 0.10 0.05 0.07 0.20 0.13 0.08 0.01 0.09 0.03
{-7, -6, -4, 3, 8, 12, 15, 19, 21, 25, 30, 36} STO x ENTER
{0.08, 0.12, 0.04, 0.10, 0.05, 0.07, 0.20, 0.13, 0.08, 0.01, 0.09, 0.03} STO P ENTER
STAT CALC 1
1-Var Stats 2nd LIST X, 2nd LIST P ENTER
answer: the mean or expected value is
11.28 and the standard deviation x 12.21317322
Exercise 11. According to a mortality table the probability that Mr. Cabrera who is a 25 year old
man will die within a year is 0.008. An insurance company is selling him $100,000 policy for a
yearly premium of $1000. What is the company expected profit?
{1000, -99000} STO X ENTER
{0.992, 0.008} STO ALPHA P ENTER
2nd LIST MATH 3
mean(2nd LIST X, 2nd LIST P) ENTER answer: $200
-48-