Chapter 9 Continuous Probability Distributions Flashcards
Define PDF, CDF, PPF. P 79
PDF: Probability Density Function, returns the probability of a given continuous outcome.
CDF: Cumulative Distribution Function, returns the probability of a value less than or equal to a given outcome.
PPF: Percent-Point Function, returns a discrete value that is less than or equal to the given probability.
A normal distribution with a mean of zero and a standard deviation of 1 is called… P 80
A standard normal distribution
How can we create a simulated normal distribution using python numpy and draw n samples from it? P 80
from numpy.random import normal
normal(mean (mu), standard deviation (sigma), number of samples (n)) NumPy function
Give a code example of how we can simulate and then calculate PDF and CDF of a normal distribution in python? P 80
pdf and cdf for a normal distribution
from scipy.stats import norm
from matplotlib import pyplot
# define distribution parameters
mu = 50
sigma = 5
# create distribution
dist = norm(mu, sigma)
# plot pdf
values = [value for value in range(30, 70)]
probabilities = [dist.pdf(value) for value in values]
pyplot.plot(values, probabilities)
pyplot.show()
# plot cdf
cprobs = [dist.cdf(value) for value in values]
pyplot.plot(values, cprobs)
pyplot.show()
What is the 68-95-99.7 rule for normal distribution? P 82
The 68-95-99.7 rule, is the approximate percentage of the data covered by ranges defined by 1, 2, and 3 standard deviations from the mean.
What is exponential distribution? P 83
The exponential distribution is a continuous probability distribution where a few outcomes are the most likely, with a rapid decrease in probability to all other outcomes. For example: The time until the default of a loan
What is the equivalent of exponential distribution for discrete random variables? P 83
It is the continuous random variable equivalent to the geometric probability distribution for discrete random variables.
Using what parameters can we describe an exponential distribution? P 83
Scale (Beta or β): The mean and standard deviation of the distribution.
Sometimes the distribution is defined more formally with a parameter lambda or rate.
The beta parameter is defined as the reciprocal of the lambda parameter
(β = 1 /λ )
Rate (lambda or λ) = Rate of change in the distribution.
How can we use exponential distribution in python using numpy? P 83
We can define a distribution with a mean of 50 and sample random numbers from this distribution. We can achieve this using the exponential() NumPy function. The example below samples and prints 10 numbers from this distribution.
# sample an exponential distribution
from numpy.random import exponential
# define the distribution
beta = 50
n = 10
# generate the sample
sample = exponential(beta, n)
How can we calculate properties such as moments, PDF, CDF, etc. of an exponential distribution in python? Code P 84
We can define an exponential distribution using the expon() SciPy function and then calculate properties such as the moments, PDF, CDF, and more.
# pdf and cdf for an exponential distribution
from scipy.stats import expon
from matplotlib import pyplot
# define distribution parameter
beta = 50
# create distribution
dist = expon(beta)
# plot pdf
values = [value for value in range(50, 70)]
probabilities = [dist.pdf(value) for value in values]
pyplot.plot(values, probabilities)
pyplot.show()
# plot cdf
cprobs = [dist.cdf(value) for value in values]
pyplot.plot(values, cprobs)
pyplot.show()
What is an important related distribution to exponential distribution called? P 86
An important related distribution is the double exponential distribution, also called the Laplace distribution.
What is Pareto distribution? P 86
A Pareto distribution is named after Vilfredo Pareto and is may be referred to as a power-law distribution. It is also related to the Pareto principle (or 80/20 rule) which is a heuristic for continuous random variables that follow a Pareto distribution, where 80% of the events are drawn from just 20% of the range of the continuous variable. . For example: The scores by players on a sports team.
How can we define the Pareto distribution (using what parameter), in what range is it? P 87
Shape (alpha or α): The steepness of the decease in probability.
Values for the shape parameter are often small, such as between 1 and 3.
What is alpha for Pareto principle(or 80/20 rule)? P 87
When alpha is set to 1.161.
How can we define a Pareto distribution in python using numpy? P 87
We can define a distribution with a shape of 1.1
and sample random numbers from this distribution. We can achieve this using the pareto()
NumPy function.
# sample a pareto distribution
from numpy.random import pareto
# define the distribution
alpha = 1.1
n = 10
# generate the sample
sample = pareto(alpha, n)
print(sample)