Foundations of Probability With R
Foundations of Probability With R
FOUNDATIONS OF
X ~ Normal( , )
X ~ Poisson( )
WITH
2
HELLO!
I am Elijah Appiah from
Ghana.
I am an Economist by
profession.
I love everything about R!
Lecture Series
Introduction to Data and Statistics
Foundations of Probability
Inferential Statistics
Lesson Goals
Introduce the basics of probability,
probability calculations for random
events, and probability distributions
in R.
Fundamentals relevant for providing
a conceptual framework for
statistical inference.
5
Probability
There is a random process.
We know the outcomes that could happen
but not the particular outcome that will
happen.
Probability Events
Schools of Thought
DISTRIBUTION
9
Toss a coin.
10
HHHHHHHHHH?
11
Simulation with R
Binomial Distribution
Coin flips yield outcome that follow a
binomial distribution.
Fair Coins
When you flip a fair coin 10 times, what is
the most likely number of heads?
Cumulative Density
Mean of X~Binomial(10, 0.5)
with 4 heads or less was
approximately 38%.
Number Number of
of Heads Probability If TRUE, ,
Coin Flips otherwise
Expected value:
Variance:
29
Mean:
Variance
30
Mean:
Variance:
31
Pr(A or B or C) =
What happens?
47
DISTRIBUTION
50
Normal Distribution
Recall:
Normal Distribution
The normal distribution:
Mean Standard
Deviation
53
Normal Distribution
Simulation:
DISTRIBUTION
57
Poisson Distribution
Flip many coins, each with a low
probability.
Simulate a binomial distribution with:
58
Poisson Distribution
Mean
Note that the mean of the binomial
distribution with size 1000 and probability
1/1000 is 1.
60
Poisson Distribution
rpois(n, lambda)
Number
Mean
of Draws
61
Poisson Distribution
Interesting properties of Poisson
Distribution:
63
DISTRIBUTION
64
Geometric Distribution
Assume you flip a coin with 10% probability
of getting heads.
How many times would you have to flip the
coin until you get head?
You could get heads on the first trial, or
you could get it on the 1000th trial.
65
Geometric Distribution
A situation where you wait for a random
event to occur is known as Geometric
Distribution.
Let’s simulate waiting for heads in a 100
draws.
66
Geometric Distribution
Probability
68
Geometric Distribution
rgeom(n, p)
Number
Probability
of Draws
69
Any questions?
Reach me anytime!
Email
[email protected]
LinkedIn
https://www.linkedin.com/in/appiah-elijah-383231123/