Statistical Computing
M.V. Padmavati
BIT, Durg
Venkata Padmavathi Metta
UNIT I: Probability Theory
• Sample Spaces- Events - Axioms – Counting
• Conditional Probability and Bayes’ Theorem
• The Binomial Theorem
• Random variable and distributions : Mean and
Variance of a Random variable
• Binomial-Poisson-Exponential and Normal
distributions.
• Curve Fitting and Principles of Least Squares-
Regression and correlation.
Venkata Padmavathi Metta
Random Experiment
• The experiment whose set of all outcomes are
known but not possible to predict which
outcome will occur.
• Example 1. Tossing a coin
2. Casting an un biased die.
Venkata Padmavathi Metta
Probability
• How likely something is to happen.
• Many events can't be predicted with total
certainty.
• The best we can say is how likely they are to
happen, using the idea of probability.
Venkata Padmavathi Metta
Sample space
• Consider a random experiment.
• The set of all the possible outcomes is called the
sample space of the experiment and is usually
denoted by S.
• Examples:
1. Experiment of tossing a coin
S1={H,T}
2. Selecting a digit
S2={0,1,2,3,4,5,6,7,8,9}
Venkata Padmavathi Metta
Sample space
Example 3. Tossing a die.
The sample space is S = {1, 2, 3, 4, 5, 6}.
Example 4. Tossing a die twice.
The sample space is S = {(i, j) : i, j = 1, 2, . . . , 6}
={(1,1),(1,2),(1,3),……….(6,6)} which contains 36
elements
Venkata Padmavathi Metta
Event
• One or more outcomes of an experiment
• Any subset E of the sample space S is called an
event
• Examples
1. Tossing a coin. The sample space is S = {H, T}.
E = {T} is an event, which can be described in
words as “Getting Tail”.
2. Tossing a die. The sample space is S = {1, 2, 3, 4,
5, 6}.
E = {2, 4, 6} is an event, which can be described in
words as “Getting even number”.
Venkata Padmavathi Metta
Example 3. Tossing a coin twice. The sample space is S = {HH, HT, TH, TT}.
Consider the event “The first toss results in a Heads”.
What is the value of E?
E = {HH, HT}
Example 4. Tossing a die twice. The sample space is S = {(i, j) : i, j = 1, 2,
. . . , 6}, which contains 36 elements. Consider the event “Getting 10 as
sum”. What is the value of E?
E={(4,6),(5,5),(6,4)}
Event
Venkata Padmavathi Metta
Probability
• Probability of an event E happening
= Number of favorable outcomes/ Total number
of outcomes
• Denoted as P(E)= #(E)/#(S)
Venkata Padmavathi Metta
Probability
• Tossing a Coin is an event
• When a coin is tossed, there are two possible
outcomes: So sample space S={H,T}
• heads (H) or
• tails (T)
• We say that the probability of the coin
landing H is ½
• And the probability of the coin landing T is ½
Venkata Padmavathi Metta
Probability
1. Tossing a coin. The sample space is S = {H, T}.
E = {T} is an event, which can be described in
words as “Getting Tail”.
P(E)=1/2
2. Tossing a die. The sample space is S = {1, 2, 3,
4, 5, 6}.
E= {2, 4, 6} is an event, which can be
described in words as “Getting even number”.
P(E)=3/6=1/2
Venkata Padmavathi Metta
Example 3. Tossing a coin twice. The sample space is S = {HH, HT, TH, TT}.
Consider the event “The first toss results in a Heads”.
What is the value of E?
E = {HH, HT}
Example 4. Tossing a die twice. The sample space is S = {(i, j) : i, j = 1, 2,
. . . , 6}, which contains 36 elements. Consider the event “Getting 10 as
sum”. What is the value of E?
E={(4,6),(5,5),(6,4)}
Probability
P(E)=2/4=1/2
P(E)=3/36=1/12
Venkata Padmavathi Metta
Axioms of Probability
• Consider an experiment with sample space S.
• For any event E, we refer to P(E) as the probability of E.
– Axiom 1: For any event E, P(E)≥0.
– Axiom 2: Probability of the sample space S is P(S)=1.
– Axiom 3: for any sequence of events E1, E2, . . . which are
mutually disjoint (mutually exclusive),
P(E1∪E2∪E3⋯)=P(E1)+P(E2)+P(E3)+⋯
Venkata Padmavathi Metta
Axioms of Probability
• The smallest value for P(E) is zero and if P(E)=0,
then the event A will never happen.
• The second axiom states that the probability of
the whole sample space is equal to one,
i.e., 100 percent.
– Axiom 1: For any event E, P(E)≥0.
– Axiom 2: Probability of the sample space S is P(S)=1.
Venkata Padmavathi Metta
In a presidential election, there are four candidates. Call them A, B, C, and D.
Based on our polling analysis, we estimate that A has a 20 percent chance of
winning the election, while B has a 40 percent chance of winning. What is the
probability that A or B win the election?
• Notice that the events that {A wins},{B wins}, {C wins}, and {D
wins} are disjoint since more than one of them cannot occur at the
same time.
• For example, if A wins, then B cannot win.
• From the third axiom of probability, the probability of the union of
two disjoint events is the summation of individual probabilities.
Therefore,
P(A wins or B wins)= P({A wins}∪{B wins}
= P({A wins})+P({B wins})
= 0.2+0.4
= 0.6
Venkata Padmavathi Metta
Implied Axioms
• For any event E, P(Ec)=1−P(E).
• The probability of the empty set is zero,
i.e., P(∅)=0.
• For any event E, 0 ≤ P(E)≤1.
• The probability of the certain event E,
i.e., P(E)=1.
Venkata Padmavathi Metta
Questions
• A bag contains three white and five black balls.
What is the chance that a ball drawn at random
will be black. Ans: 5/8
• Three coins are tossed. What is the probability
that all are heads?
S={hhh,htt,hth,thh,……….}-8 elements
E={hhh} Ans: 1/8
• Die is thrown. Find the probability that 1,2 or 3
turns up? Ans: ½
• One card is drawn from pack of cards (52 cards).
What is the probability that it is (1) diamond (2)
not a diamond Ans: ¼,3/4
Venkata Padmavathi Metta
Questions
• A man draws at random 3 balls from a bag
containing 6 red and 5 white balls. What is the
chance of getting the balls all red.
• A man draws at random 3 balls from a bag
containing 6 blue and 4 red balls. What is the
chance of getting two blue and one red.
Ans. 6/11*5/10*4/9=4/33 or 6C3 / 11C3
6C2 * 4C1/10C3
Venkata Padmavathi Metta
Counting
• We start with the fundamental principle of
counting. Suppose that two experiments are to
be performed.
• Experiment 1 can have n1 possible outcomes
and
• for each outcome of experiment 1, experiment
2 has n2 possible outcomes
• Then together there are n1* n2 possible
outcomes.
Venkata Padmavathi Metta
Counting- Generalization
• Generalize the fundamental principle of
counting to k experiments.
• Assume that we have a collection of n objects
and we wish to make an ordered arrangement
of k of these objects.
• Using the generalized multiplication principle,
the number of possible outcomes is
n * (n- 1)*……*(n- k + 1).
We will write this as nPk.
Venkata Padmavathi Metta
Example 1
• For a group of n individuals, one is chosen to
become the president and a second is chosen
to become the treasurer.
• By the multiplication principle, if this position
are held by different individuals, then this task
can be accomplished in n x (n- 1) possible
ways
Venkata Padmavathi Metta
Inclusion-Exclusion Principle
• P(A∪B)=P(A)+P(B)−P(A∩B)
• If A and B are mutually exclusive then
P(A∪B)=P(A)+P(B)
Venkata Padmavathi Metta
Conditional probability
• It is a measure of the probability of
an event occurring, given that another event
has already occurred.
• If the event of interest is A and the event B is
known or assumed to have occurred,
• The conditional probability of A given B, or
"the probability of A under the condition B", is
usually written as P(A|B)
Venkata Padmavathi Metta
Conditional Probability
• The probability that any given person has a
Covid(A) after testing is only 5%.
• But if we know or assume that the person is
having Flu(B), then they are much more likely
to be Covid positive.
• For example, the conditional probability that
someone with Flu symptoms is Covid +ve is
75%, in which case we would have
that P(Covid) = 5% and P(Covid|Flu) = 75%.
Venkata Padmavathi Metta
Conditional Probability
• P(A|B) may or may not be equal to P(A)
• If P(A|B) = P(A), then events A and B are said
to be independent.
• P(A|B) typically differs from P(B|A).
• P(Covid/Flu) is different from P(Flu/Covid)
Venkata Padmavathi Metta
Conditional Probability
• P(A|B) =P(AՈB)/P(B)
• Similarly P(B|A) =P(AՈB)/P(A)
• P(A|B) P(B)=P(AՈB)=P(B|A) P(A)
• P(B/A)= P(A|B) P(B)/P(A)
Venkata Padmavathi Metta
The probability P(A) = 0.30 + 0.10 + 0.12 = 0.52
The conditional probability
• P(A|B1) = 1,
• P(A|B2) = 0.12 ÷ (0.12 + 0.04) = 0.75
• P(A|B3) = 0.
Conditional Probability
Venkata Padmavathi Metta
Independent events vs. mutually
exclusive events
If statistically independent If mutually exclusive
P(AB)= P(A) 0
P(BA)= P(B) 0
P(AՈB)= P(A)P(B) 0
The concepts of mutually independent events and mutually exclusive
events are separate and distinct.
Venkata Padmavathi Metta
Example 1
• (i) If P(A)=2/5, P(B) = 1/3 and P(A  B)= ½, find
P(A/B) and P (B/A)
• (ii) if A and B two independent events and
P(A)=2/3, P(B) =3/5, find P(AB).
Ans: (i) 7/10, 7/12
Ans: (ii) 13/15
Venkata Padmavathi Metta
Example 2
In an examination, 30% of the students have failed in
Mathematics, 20% of the students have failed in Chemistry
and 10% have failed in both Mathematics and Chemistry. A
student is chosen at random.
(i) What is the probability that the student has failed in
Mathematics if it is known that he has failed in Chemistry?
(ii) What is the probability that the student has failed either
in Mathematics or in Chemistry?
Ans: (i) 0.5 Ans: (ii) 0.4
Venkata Padmavathi Metta
Example 3
The probability that a man will be alive in 25 years is 3/5, and the
probability that his wife will be alive in 25 years is 2/3. Find the
probability that:
(i) both will be alive,
(ii) only wife will be alive,
(iii) only man will be alive,
(iv) atleast one of them will be alive.
Ans: (i) 2/5 Ans: (ii) 4/15
Ans: (iii) 1/5 Ans: (iv) 13/15
Venkata Padmavathi Metta
Example 4
A problem in Statistics is given to three students, A, B, C, whose
chances of solving it are ½ , 1/3 and 1/4 respectively, if they try
it independently, what is the probability that the problem will be
solved?
Ans: 1/4
Venkata Padmavathi Metta
Example 5
Two sets of candidates are competing for the positions
on the Board of Directors of a company. The
probabilities that the first and second sets will win are
0.6 and 0.4 respectively. If the first set wins, the
probability of introducing a new product is 0.8 and the
corresponding probability, if the second set wins, is 0.3.
What is the probability that the new product will be
introduced?
Ans: 0.6
Venkata Padmavathi Metta
In Exton School, 60% of the boys play baseball, and 24% of the
boys play baseball and football.
What percent of those that play baseball also play football?
Ans: 2/5
Example 6
Venkata Padmavathi Metta
45% of the children in a school have a dog, 30% have a
cat, and 18% have a dog and a cat.
What percent of those who have a dog also have a cat?
• Ans : 40%
Example 7
Venkata Padmavathi Metta
Among the examinees in an examination 30%, 35% and 45%
failed in Statistics, in Mathematics and in at least one of the
subjects respectively, An examinee is selected at random. Find
the probabilities that
(i) he failed in Mathematics only,
(ii) he passed in Statistics if it is known that he failed in
Mathematics.
Example 1: Bayes’ Theorem
Venkata Padmavathi Metta
Bayes' theorem
• The relationship between P(A|B) and P(B|A) is
given by Bayes' theorem
• This shows that P(A|B) P(B) = P(B|A) P(A)
• i.e. P(A|B) = P(B|A) P(A)/P(B) .
Venkata Padmavathi Metta
Example-Conditional Probability
• Roll a fair die.
• Let A be the event that the outcome is an odd
number, i.e., A={1,3,5}
• Let B be the event that the outcome is less
than or equal to 3, i.e., B={1,2,3}.
• What is the probability of A, P(A)?
• What is the probability of A given B, P(A|B)?
Venkata Padmavathi Metta
Bayes’ Theorem Statement
An event A can occur only if any one of the set of
exhaustive and mutually exclusive events B1, B2,
…,Bn occurs.
The probabilities P(B1),P(B1), …., P(Bn) and the
conditional probabilities P(A/Bi); i=1,2,…,n for A to
occur are known.
Then the conditional probabilities P(Bi/A) when A
has occurred is given by
P(Bi│A) = P(Bi)*P(A│Bi)/ 𝑘=1
𝑛
P(Bk)P(A|Bk)
Venkata Padmavathi Metta
Bayes’ Theorem Proof
Venkata Padmavathi Metta
Bayes’ Theorem Proof
Venkata Padmavathi Metta
There are two identical boxes containing respectively 4
white and 3 red balls and 3 white and 7 red balls. A box is
chosen at random and a ball is drawn from it. If the ball is
white, what is the probability that it is from the first box?
Example 2: Bayes’ Theorem
Venkata Padmavathi Metta
Example 2: Bayes’ Theorem
Venkata Padmavathi Metta
In a bolt factory, machines M1, M2, M3 manufacture
respectively 25, 35 and 40 percent of the total output. Of
their output 5, 4 and 2 percent respectively, are defective
bolts, one bolt is drawn at random from the product and is
found to be defective. What is the probability that it is
manufactured in the machine M2?
Example 3: Bayes’ Theorem
Venkata Padmavathi Metta
Example 3: Bayes’ Theorem
Venkata Padmavathi Metta
There are two identical boxes containing respectively 5
white and 3 red balls and 4 white and 6 red balls. A box is
chosen at random and a ball is drawn from it. If the ball is
white, what is the probability that it is from the first box?
Example 3: Bayes’ Theorem
Venkata Padmavathi Metta
In a bolt factory, machines X, Y and Z manufacture
respectively 20, 35 and 45 percent of the total output. Of
their output 8, 6 and 5 percent respectively, are defective
bolts, one bolt is drawn at random from the product and is
found to be defective. What is the probability that it is
manufactured in the machine Z?
Example 4: Bayes’ Theorem
Venkata Padmavathi Metta
Example 4: Bayes’ Theorem
Venkata Padmavathi Metta
Example
• Suppose we have the following information:
– There is a 60 percent chance that it will rain today.
– There is a 50 percent chance that it will rain tomorrow.
– There is a 30 percent chance that it does not rain either
day.
• Find the following probabilities:
– The probability that it will rain today or tomorrow.
– The probability that it will rain today and tomorrow.
– The probability that it will rain today but not tomorrow.
– The probability that it either will rain today or tomorrow,
but not both.
0.7, 0.4, 0.2, 0.1
Venkata Padmavathi Metta
Venkata Padmavathi Metta
Venkata Padmavathi Metta
Venkata Padmavathi Metta
Random Variable
• Random variable and distributions : Mean and
Variance of a Random variable
Venkata Padmavathi Metta
Random Variable
• A variable whose numerical value is determined by the
outcome( or result) of a random experiment is called
random variable or a chance variable
Example: Consider a random experiment of tossing 3 coins. The sample space is
S={HHH,HHT,HTH,HTT,THT,THH,THT,TTH,TTT}
Let X denote a random variable and it denotes the number of
heads obtained then
X(HHH)=3, X(HHT)=2, X(TTT)=0
Venkata Padmavathi Metta
Types of Random Variable
• A random variable can be discrete or continuous
Discrete Random variable Continuous Random Variable
A discrete variable is a variable
whose value is obtained by counting.
A Continuous variable is a variable
whose value is obtained by
measuring.
 number of students present
 number of red marbles in a jar
 number of heads when flipping
three coins
 height of students in class
 weight of students in class
 time it takes to get to school
If a random variable can take only
finite set of values (Discrete Random
Variable), then its probability
distribution is called as Probability
Mass Function or PMF
If a random variable can take
continuous set of values (Continuous
Random Variable), then its probability
distribution is called as Probability
Density Function or PDF
Venkata Padmavathi Metta
Random Variable
Venkata Padmavathi Metta
Probability distribution of a discrete random variable
• The probability distribution of a random variable X tells
what the possible values of X are and how probabilities
are assigned to those values
• Example: Let X represent the sum of two dice.
• Then the probability distribution of X is as follows:
X 2 3 4 5 6 7 8 9 10 11 12
P(X) 1/36 2/36 3/36 4/36 5/36 6/36 5/36 4/36 3/36 2/36 1/36
If a random variable can take only finite set of values (Discrete Random Variable),
then its probability distribution is called as Probability Mass Function or PMF.
Venkata Padmavathi Metta
Probability distribution of a discrete random variable
• The probability distribution of discrete
random variable X is as follows:
X 0 1 2 3 4 5 6 7
P(X) 0 k 2k 2k 3k k2 2k2 7k2+k
(i) Determine K (ii) find P(X<6) (iii) what will be P(X>=6) and P(0<X<5)?
Venkata Padmavathi Metta
Venkata Padmavathi Metta
Venkata Padmavathi Metta
Venkata Padmavathi Metta
Venkata Padmavathi Metta
Venkata Padmavathi Metta
Expected Mean of a discrete Probability distribution
• The probability distribution of discrete
random variable X is as follows:
X 0 1 2 3 4 5 6 7
P(X) 0 k 2k 2k 3k k2 2k2 7k2+k
(i) Determine K (ii) find P(X<6) (iii) what will be P(X>=6) and P(0<X<5)?
Venkata Padmavathi Metta
Expectation or Expected Mean of a discrete random
probability distribution
Venkata Padmavathi Metta
Variance of a discrete random probability distribution
The variance of a random variable X is calculated as
Variance= E(X2)-(E(X))2
E(X) is the expected Mean.
Standard Deviation
Venkata Padmavathi Metta
A random variable has following probability distribution
X 4 5 6 8
P(X) 0.1 0.3 0.4 0.2
Find expectation (or mean), variance and standard deviation of the random
Example 1: Mean, variance and standard deviation of a random variable
Venkata Padmavathi Metta
A bag contains 5 white and 7 black balls. Find the expectation
of a man who is allowed to draw two balls from the bag and
who is to receive one rupee for each black ball and two
rupees for each white ball.
Example 2: Mean, variance and standard deviation of a random variable
Venkata Padmavathi Metta
Venkata Padmavathi Metta
• It is a discrete probability distribution and is
defined by the probability function
Binomial distribution or Bernoulli Distribution
f(x)=nCx px qn-x
Which gives the probability of x successes in a
series of n independent trials (x<=n), where p is
the constant probability of success in a single trail
and q=1-p Venkata Padmavathi Metta
Conditions of Binomial distributions
Binomial distribution holds under the following
conditions
– Each observation or trial is independent. In other words, none of
your trials have an effect on the probability of the next trial.
– The probability of success (tails, heads, fail or pass) is exactly the
same from one trial to another.
– There are only two possible outcomes i.e success or failure for
each trial.
– Trials are repeated under identical conditions for a fixed number
of times say n
Venkata Padmavathi Metta
Q. A coin is tossed 10 times. What is the probability of getting
exactly 6 heads?
• The number of trials (n) is 10
• The Probability of success (“getting a head”) is
p=0.5 (So q=1-p = 0.5)
x = 6
• P(x=6) = 10C6 * 0.5^6 * 0.5^4
= 210 * 0.015625 * 0.0625
= 0.205078125
f(x)=nCx px qn-x
Venkata Padmavathi Metta
Six coins are tossed. What is the probability of getting exactly 3
tails?
f(x)=nCx px qn-x
Venkata Padmavathi Metta
Suppose that 80% of adults with allergies report symptomatic relief with a
specific medication. If the medication is given to 10 new patients with
allergies, what is the probability that it is effective in exactly seven?
1. The outcome is relief from symptoms (yes or no), and
here we will call a reported relief from symptoms a
'success.‘
2. The probability of success for each person is p=0.8. So
q=1-p=0.2
We know that:
Number of observations is n=10
Number of successes or events of interest is x=7
p=0.80
The probability of 7 successes is= 10C7(0.8)7(0.2)3
Venkata Padmavathi Metta
Continuous Random Variables
• A continuous random variable is not defined at specific values. Instead, it is
defined over an interval of values, and is represented by the area under a
curve (in advanced mathematics, this is known as an integral).
• The probability of observing any single value is equal to 0, since the number of
values which may be assumed by the random variable is infinite.
• Suppose a random variable X may take all values over an interval of real
numbers. Then the probability that X is in the set of outcomes A, P(A), is
defined to be the area above A and under a curve. The curve, which
represents a function p(x), must satisfy the following:
1: The curve has no negative values p(x) > 0 for all x
2: The total area under the curve is equal to 1.
A curve meeting these requirements is known as a density curve.
Venkata Padmavathi Metta

Statistical computing 1

  • 1.
    Statistical Computing M.V. Padmavati BIT,Durg Venkata Padmavathi Metta
  • 2.
    UNIT I: ProbabilityTheory • Sample Spaces- Events - Axioms – Counting • Conditional Probability and Bayes’ Theorem • The Binomial Theorem • Random variable and distributions : Mean and Variance of a Random variable • Binomial-Poisson-Exponential and Normal distributions. • Curve Fitting and Principles of Least Squares- Regression and correlation. Venkata Padmavathi Metta
  • 3.
    Random Experiment • Theexperiment whose set of all outcomes are known but not possible to predict which outcome will occur. • Example 1. Tossing a coin 2. Casting an un biased die. Venkata Padmavathi Metta
  • 4.
    Probability • How likelysomething is to happen. • Many events can't be predicted with total certainty. • The best we can say is how likely they are to happen, using the idea of probability. Venkata Padmavathi Metta
  • 5.
    Sample space • Considera random experiment. • The set of all the possible outcomes is called the sample space of the experiment and is usually denoted by S. • Examples: 1. Experiment of tossing a coin S1={H,T} 2. Selecting a digit S2={0,1,2,3,4,5,6,7,8,9} Venkata Padmavathi Metta
  • 6.
    Sample space Example 3.Tossing a die. The sample space is S = {1, 2, 3, 4, 5, 6}. Example 4. Tossing a die twice. The sample space is S = {(i, j) : i, j = 1, 2, . . . , 6} ={(1,1),(1,2),(1,3),……….(6,6)} which contains 36 elements Venkata Padmavathi Metta
  • 7.
    Event • One ormore outcomes of an experiment • Any subset E of the sample space S is called an event • Examples 1. Tossing a coin. The sample space is S = {H, T}. E = {T} is an event, which can be described in words as “Getting Tail”. 2. Tossing a die. The sample space is S = {1, 2, 3, 4, 5, 6}. E = {2, 4, 6} is an event, which can be described in words as “Getting even number”. Venkata Padmavathi Metta
  • 8.
    Example 3. Tossinga coin twice. The sample space is S = {HH, HT, TH, TT}. Consider the event “The first toss results in a Heads”. What is the value of E? E = {HH, HT} Example 4. Tossing a die twice. The sample space is S = {(i, j) : i, j = 1, 2, . . . , 6}, which contains 36 elements. Consider the event “Getting 10 as sum”. What is the value of E? E={(4,6),(5,5),(6,4)} Event Venkata Padmavathi Metta
  • 9.
    Probability • Probability ofan event E happening = Number of favorable outcomes/ Total number of outcomes • Denoted as P(E)= #(E)/#(S) Venkata Padmavathi Metta
  • 10.
    Probability • Tossing aCoin is an event • When a coin is tossed, there are two possible outcomes: So sample space S={H,T} • heads (H) or • tails (T) • We say that the probability of the coin landing H is ½ • And the probability of the coin landing T is ½ Venkata Padmavathi Metta
  • 11.
    Probability 1. Tossing acoin. The sample space is S = {H, T}. E = {T} is an event, which can be described in words as “Getting Tail”. P(E)=1/2 2. Tossing a die. The sample space is S = {1, 2, 3, 4, 5, 6}. E= {2, 4, 6} is an event, which can be described in words as “Getting even number”. P(E)=3/6=1/2 Venkata Padmavathi Metta
  • 12.
    Example 3. Tossinga coin twice. The sample space is S = {HH, HT, TH, TT}. Consider the event “The first toss results in a Heads”. What is the value of E? E = {HH, HT} Example 4. Tossing a die twice. The sample space is S = {(i, j) : i, j = 1, 2, . . . , 6}, which contains 36 elements. Consider the event “Getting 10 as sum”. What is the value of E? E={(4,6),(5,5),(6,4)} Probability P(E)=2/4=1/2 P(E)=3/36=1/12 Venkata Padmavathi Metta
  • 13.
    Axioms of Probability •Consider an experiment with sample space S. • For any event E, we refer to P(E) as the probability of E. – Axiom 1: For any event E, P(E)≥0. – Axiom 2: Probability of the sample space S is P(S)=1. – Axiom 3: for any sequence of events E1, E2, . . . which are mutually disjoint (mutually exclusive), P(E1∪E2∪E3⋯)=P(E1)+P(E2)+P(E3)+⋯ Venkata Padmavathi Metta
  • 14.
    Axioms of Probability •The smallest value for P(E) is zero and if P(E)=0, then the event A will never happen. • The second axiom states that the probability of the whole sample space is equal to one, i.e., 100 percent. – Axiom 1: For any event E, P(E)≥0. – Axiom 2: Probability of the sample space S is P(S)=1. Venkata Padmavathi Metta
  • 15.
    In a presidentialelection, there are four candidates. Call them A, B, C, and D. Based on our polling analysis, we estimate that A has a 20 percent chance of winning the election, while B has a 40 percent chance of winning. What is the probability that A or B win the election? • Notice that the events that {A wins},{B wins}, {C wins}, and {D wins} are disjoint since more than one of them cannot occur at the same time. • For example, if A wins, then B cannot win. • From the third axiom of probability, the probability of the union of two disjoint events is the summation of individual probabilities. Therefore, P(A wins or B wins)= P({A wins}∪{B wins} = P({A wins})+P({B wins}) = 0.2+0.4 = 0.6 Venkata Padmavathi Metta
  • 16.
    Implied Axioms • Forany event E, P(Ec)=1−P(E). • The probability of the empty set is zero, i.e., P(∅)=0. • For any event E, 0 ≤ P(E)≤1. • The probability of the certain event E, i.e., P(E)=1. Venkata Padmavathi Metta
  • 17.
    Questions • A bagcontains three white and five black balls. What is the chance that a ball drawn at random will be black. Ans: 5/8 • Three coins are tossed. What is the probability that all are heads? S={hhh,htt,hth,thh,……….}-8 elements E={hhh} Ans: 1/8 • Die is thrown. Find the probability that 1,2 or 3 turns up? Ans: ½ • One card is drawn from pack of cards (52 cards). What is the probability that it is (1) diamond (2) not a diamond Ans: ¼,3/4 Venkata Padmavathi Metta
  • 18.
    Questions • A mandraws at random 3 balls from a bag containing 6 red and 5 white balls. What is the chance of getting the balls all red. • A man draws at random 3 balls from a bag containing 6 blue and 4 red balls. What is the chance of getting two blue and one red. Ans. 6/11*5/10*4/9=4/33 or 6C3 / 11C3 6C2 * 4C1/10C3 Venkata Padmavathi Metta
  • 19.
    Counting • We startwith the fundamental principle of counting. Suppose that two experiments are to be performed. • Experiment 1 can have n1 possible outcomes and • for each outcome of experiment 1, experiment 2 has n2 possible outcomes • Then together there are n1* n2 possible outcomes. Venkata Padmavathi Metta
  • 20.
    Counting- Generalization • Generalizethe fundamental principle of counting to k experiments. • Assume that we have a collection of n objects and we wish to make an ordered arrangement of k of these objects. • Using the generalized multiplication principle, the number of possible outcomes is n * (n- 1)*……*(n- k + 1). We will write this as nPk. Venkata Padmavathi Metta
  • 21.
    Example 1 • Fora group of n individuals, one is chosen to become the president and a second is chosen to become the treasurer. • By the multiplication principle, if this position are held by different individuals, then this task can be accomplished in n x (n- 1) possible ways Venkata Padmavathi Metta
  • 22.
    Inclusion-Exclusion Principle • P(A∪B)=P(A)+P(B)−P(A∩B) •If A and B are mutually exclusive then P(A∪B)=P(A)+P(B) Venkata Padmavathi Metta
  • 23.
    Conditional probability • Itis a measure of the probability of an event occurring, given that another event has already occurred. • If the event of interest is A and the event B is known or assumed to have occurred, • The conditional probability of A given B, or "the probability of A under the condition B", is usually written as P(A|B) Venkata Padmavathi Metta
  • 24.
    Conditional Probability • Theprobability that any given person has a Covid(A) after testing is only 5%. • But if we know or assume that the person is having Flu(B), then they are much more likely to be Covid positive. • For example, the conditional probability that someone with Flu symptoms is Covid +ve is 75%, in which case we would have that P(Covid) = 5% and P(Covid|Flu) = 75%. Venkata Padmavathi Metta
  • 25.
    Conditional Probability • P(A|B)may or may not be equal to P(A) • If P(A|B) = P(A), then events A and B are said to be independent. • P(A|B) typically differs from P(B|A). • P(Covid/Flu) is different from P(Flu/Covid) Venkata Padmavathi Metta
  • 26.
    Conditional Probability • P(A|B)=P(AՈB)/P(B) • Similarly P(B|A) =P(AՈB)/P(A) • P(A|B) P(B)=P(AՈB)=P(B|A) P(A) • P(B/A)= P(A|B) P(B)/P(A) Venkata Padmavathi Metta
  • 27.
    The probability P(A)= 0.30 + 0.10 + 0.12 = 0.52 The conditional probability • P(A|B1) = 1, • P(A|B2) = 0.12 ÷ (0.12 + 0.04) = 0.75 • P(A|B3) = 0. Conditional Probability Venkata Padmavathi Metta
  • 28.
    Independent events vs.mutually exclusive events If statistically independent If mutually exclusive P(AB)= P(A) 0 P(BA)= P(B) 0 P(AՈB)= P(A)P(B) 0 The concepts of mutually independent events and mutually exclusive events are separate and distinct. Venkata Padmavathi Metta
  • 29.
    Example 1 • (i)If P(A)=2/5, P(B) = 1/3 and P(A  B)= ½, find P(A/B) and P (B/A) • (ii) if A and B two independent events and P(A)=2/3, P(B) =3/5, find P(AB). Ans: (i) 7/10, 7/12 Ans: (ii) 13/15 Venkata Padmavathi Metta
  • 30.
    Example 2 In anexamination, 30% of the students have failed in Mathematics, 20% of the students have failed in Chemistry and 10% have failed in both Mathematics and Chemistry. A student is chosen at random. (i) What is the probability that the student has failed in Mathematics if it is known that he has failed in Chemistry? (ii) What is the probability that the student has failed either in Mathematics or in Chemistry? Ans: (i) 0.5 Ans: (ii) 0.4 Venkata Padmavathi Metta
  • 31.
    Example 3 The probabilitythat a man will be alive in 25 years is 3/5, and the probability that his wife will be alive in 25 years is 2/3. Find the probability that: (i) both will be alive, (ii) only wife will be alive, (iii) only man will be alive, (iv) atleast one of them will be alive. Ans: (i) 2/5 Ans: (ii) 4/15 Ans: (iii) 1/5 Ans: (iv) 13/15 Venkata Padmavathi Metta
  • 32.
    Example 4 A problemin Statistics is given to three students, A, B, C, whose chances of solving it are ½ , 1/3 and 1/4 respectively, if they try it independently, what is the probability that the problem will be solved? Ans: 1/4 Venkata Padmavathi Metta
  • 33.
    Example 5 Two setsof candidates are competing for the positions on the Board of Directors of a company. The probabilities that the first and second sets will win are 0.6 and 0.4 respectively. If the first set wins, the probability of introducing a new product is 0.8 and the corresponding probability, if the second set wins, is 0.3. What is the probability that the new product will be introduced? Ans: 0.6 Venkata Padmavathi Metta
  • 34.
    In Exton School,60% of the boys play baseball, and 24% of the boys play baseball and football. What percent of those that play baseball also play football? Ans: 2/5 Example 6 Venkata Padmavathi Metta
  • 35.
    45% of thechildren in a school have a dog, 30% have a cat, and 18% have a dog and a cat. What percent of those who have a dog also have a cat? • Ans : 40% Example 7 Venkata Padmavathi Metta
  • 36.
    Among the examineesin an examination 30%, 35% and 45% failed in Statistics, in Mathematics and in at least one of the subjects respectively, An examinee is selected at random. Find the probabilities that (i) he failed in Mathematics only, (ii) he passed in Statistics if it is known that he failed in Mathematics. Example 1: Bayes’ Theorem Venkata Padmavathi Metta
  • 37.
    Bayes' theorem • Therelationship between P(A|B) and P(B|A) is given by Bayes' theorem • This shows that P(A|B) P(B) = P(B|A) P(A) • i.e. P(A|B) = P(B|A) P(A)/P(B) . Venkata Padmavathi Metta
  • 38.
    Example-Conditional Probability • Rolla fair die. • Let A be the event that the outcome is an odd number, i.e., A={1,3,5} • Let B be the event that the outcome is less than or equal to 3, i.e., B={1,2,3}. • What is the probability of A, P(A)? • What is the probability of A given B, P(A|B)? Venkata Padmavathi Metta
  • 39.
    Bayes’ Theorem Statement Anevent A can occur only if any one of the set of exhaustive and mutually exclusive events B1, B2, …,Bn occurs. The probabilities P(B1),P(B1), …., P(Bn) and the conditional probabilities P(A/Bi); i=1,2,…,n for A to occur are known. Then the conditional probabilities P(Bi/A) when A has occurred is given by P(Bi│A) = P(Bi)*P(A│Bi)/ 𝑘=1 𝑛 P(Bk)P(A|Bk) Venkata Padmavathi Metta
  • 40.
  • 41.
  • 42.
    There are twoidentical boxes containing respectively 4 white and 3 red balls and 3 white and 7 red balls. A box is chosen at random and a ball is drawn from it. If the ball is white, what is the probability that it is from the first box? Example 2: Bayes’ Theorem Venkata Padmavathi Metta
  • 43.
    Example 2: Bayes’Theorem Venkata Padmavathi Metta
  • 44.
    In a boltfactory, machines M1, M2, M3 manufacture respectively 25, 35 and 40 percent of the total output. Of their output 5, 4 and 2 percent respectively, are defective bolts, one bolt is drawn at random from the product and is found to be defective. What is the probability that it is manufactured in the machine M2? Example 3: Bayes’ Theorem Venkata Padmavathi Metta
  • 45.
    Example 3: Bayes’Theorem Venkata Padmavathi Metta
  • 46.
    There are twoidentical boxes containing respectively 5 white and 3 red balls and 4 white and 6 red balls. A box is chosen at random and a ball is drawn from it. If the ball is white, what is the probability that it is from the first box? Example 3: Bayes’ Theorem Venkata Padmavathi Metta
  • 47.
    In a boltfactory, machines X, Y and Z manufacture respectively 20, 35 and 45 percent of the total output. Of their output 8, 6 and 5 percent respectively, are defective bolts, one bolt is drawn at random from the product and is found to be defective. What is the probability that it is manufactured in the machine Z? Example 4: Bayes’ Theorem Venkata Padmavathi Metta
  • 48.
    Example 4: Bayes’Theorem Venkata Padmavathi Metta
  • 49.
    Example • Suppose wehave the following information: – There is a 60 percent chance that it will rain today. – There is a 50 percent chance that it will rain tomorrow. – There is a 30 percent chance that it does not rain either day. • Find the following probabilities: – The probability that it will rain today or tomorrow. – The probability that it will rain today and tomorrow. – The probability that it will rain today but not tomorrow. – The probability that it either will rain today or tomorrow, but not both. 0.7, 0.4, 0.2, 0.1 Venkata Padmavathi Metta
  • 50.
  • 51.
  • 52.
  • 53.
    Random Variable • Randomvariable and distributions : Mean and Variance of a Random variable Venkata Padmavathi Metta
  • 54.
    Random Variable • Avariable whose numerical value is determined by the outcome( or result) of a random experiment is called random variable or a chance variable Example: Consider a random experiment of tossing 3 coins. The sample space is S={HHH,HHT,HTH,HTT,THT,THH,THT,TTH,TTT} Let X denote a random variable and it denotes the number of heads obtained then X(HHH)=3, X(HHT)=2, X(TTT)=0 Venkata Padmavathi Metta
  • 55.
    Types of RandomVariable • A random variable can be discrete or continuous Discrete Random variable Continuous Random Variable A discrete variable is a variable whose value is obtained by counting. A Continuous variable is a variable whose value is obtained by measuring.  number of students present  number of red marbles in a jar  number of heads when flipping three coins  height of students in class  weight of students in class  time it takes to get to school If a random variable can take only finite set of values (Discrete Random Variable), then its probability distribution is called as Probability Mass Function or PMF If a random variable can take continuous set of values (Continuous Random Variable), then its probability distribution is called as Probability Density Function or PDF Venkata Padmavathi Metta
  • 56.
  • 57.
    Probability distribution ofa discrete random variable • The probability distribution of a random variable X tells what the possible values of X are and how probabilities are assigned to those values • Example: Let X represent the sum of two dice. • Then the probability distribution of X is as follows: X 2 3 4 5 6 7 8 9 10 11 12 P(X) 1/36 2/36 3/36 4/36 5/36 6/36 5/36 4/36 3/36 2/36 1/36 If a random variable can take only finite set of values (Discrete Random Variable), then its probability distribution is called as Probability Mass Function or PMF. Venkata Padmavathi Metta
  • 58.
    Probability distribution ofa discrete random variable • The probability distribution of discrete random variable X is as follows: X 0 1 2 3 4 5 6 7 P(X) 0 k 2k 2k 3k k2 2k2 7k2+k (i) Determine K (ii) find P(X<6) (iii) what will be P(X>=6) and P(0<X<5)? Venkata Padmavathi Metta
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
    Expected Mean ofa discrete Probability distribution • The probability distribution of discrete random variable X is as follows: X 0 1 2 3 4 5 6 7 P(X) 0 k 2k 2k 3k k2 2k2 7k2+k (i) Determine K (ii) find P(X<6) (iii) what will be P(X>=6) and P(0<X<5)? Venkata Padmavathi Metta
  • 65.
    Expectation or ExpectedMean of a discrete random probability distribution Venkata Padmavathi Metta
  • 66.
    Variance of adiscrete random probability distribution The variance of a random variable X is calculated as Variance= E(X2)-(E(X))2 E(X) is the expected Mean. Standard Deviation Venkata Padmavathi Metta
  • 67.
    A random variablehas following probability distribution X 4 5 6 8 P(X) 0.1 0.3 0.4 0.2 Find expectation (or mean), variance and standard deviation of the random Example 1: Mean, variance and standard deviation of a random variable Venkata Padmavathi Metta
  • 68.
    A bag contains5 white and 7 black balls. Find the expectation of a man who is allowed to draw two balls from the bag and who is to receive one rupee for each black ball and two rupees for each white ball. Example 2: Mean, variance and standard deviation of a random variable Venkata Padmavathi Metta
  • 69.
  • 70.
    • It isa discrete probability distribution and is defined by the probability function Binomial distribution or Bernoulli Distribution f(x)=nCx px qn-x Which gives the probability of x successes in a series of n independent trials (x<=n), where p is the constant probability of success in a single trail and q=1-p Venkata Padmavathi Metta
  • 71.
    Conditions of Binomialdistributions Binomial distribution holds under the following conditions – Each observation or trial is independent. In other words, none of your trials have an effect on the probability of the next trial. – The probability of success (tails, heads, fail or pass) is exactly the same from one trial to another. – There are only two possible outcomes i.e success or failure for each trial. – Trials are repeated under identical conditions for a fixed number of times say n Venkata Padmavathi Metta
  • 72.
    Q. A coinis tossed 10 times. What is the probability of getting exactly 6 heads? • The number of trials (n) is 10 • The Probability of success (“getting a head”) is p=0.5 (So q=1-p = 0.5) x = 6 • P(x=6) = 10C6 * 0.5^6 * 0.5^4 = 210 * 0.015625 * 0.0625 = 0.205078125 f(x)=nCx px qn-x Venkata Padmavathi Metta
  • 73.
    Six coins aretossed. What is the probability of getting exactly 3 tails? f(x)=nCx px qn-x Venkata Padmavathi Metta
  • 74.
    Suppose that 80%of adults with allergies report symptomatic relief with a specific medication. If the medication is given to 10 new patients with allergies, what is the probability that it is effective in exactly seven? 1. The outcome is relief from symptoms (yes or no), and here we will call a reported relief from symptoms a 'success.‘ 2. The probability of success for each person is p=0.8. So q=1-p=0.2 We know that: Number of observations is n=10 Number of successes or events of interest is x=7 p=0.80 The probability of 7 successes is= 10C7(0.8)7(0.2)3 Venkata Padmavathi Metta
  • 75.
    Continuous Random Variables •A continuous random variable is not defined at specific values. Instead, it is defined over an interval of values, and is represented by the area under a curve (in advanced mathematics, this is known as an integral). • The probability of observing any single value is equal to 0, since the number of values which may be assumed by the random variable is infinite. • Suppose a random variable X may take all values over an interval of real numbers. Then the probability that X is in the set of outcomes A, P(A), is defined to be the area above A and under a curve. The curve, which represents a function p(x), must satisfy the following: 1: The curve has no negative values p(x) > 0 for all x 2: The total area under the curve is equal to 1. A curve meeting these requirements is known as a density curve. Venkata Padmavathi Metta