We will use the following packages in python.
statistics
pandas
scipy
seaborn
numpy
statistic (as st
) package’s function:
NormalDist(mu=μ, sigma=σ).cdf(x)
You work in Quality Control for GE.
Light bulb life has a normal distribution with μ = 2000 hours and σ = 200 hours.
What’s the probability that a bulb will last
A. between 2000 and 2400 hours?
You work in Quality Control for GE.
Light bulb life has a normal distribution with μ = 2000 hours and σ = 200 hours.
What’s the probability that a bulb will last
B. less than 1470 hours?
statistic (as st
) package’s function
NormalDist(mu=μ, sigma=σ).inv_cdf(p-value)
For a particular generation of the tomato plant, the amount x of miraculin produced had a mean of 105.3 and a standard deviation of 8.0. Assume that x is normally distributed.
For a particular generation of the tomato plant, the amount x of miraculin produced had a mean of 105.3 and a standard deviation of 8.0. Assume that x is normally distributed.
Import data and analyze with python using pandas. pd.read_csv("file path + name")
name | handedness | height | weight | bavg | HR | |
---|---|---|---|---|---|---|
0 | Jose Cardenal | Right | 70 | 150 | 0.275 | 138 |
1 | Darrell Evans | Left | 74 | 200 | 0.248 | 414 |
2 | Buck Martinez | Right | 70 | 190 | 0.225 | 58 |
3 | John Wockenfuss | Right | 72 | 190 | 0.262 | 86 |
4 | Tommy McCraw | Left | 72 | 183 | 0.246 | 75 |
... | ... | ... | ... | ... | ... | ... |
300 | Bob Watson | Right | 72 | 201 | 0.295 | 184 |
301 | Ken Harrelson | Right | 74 | 190 | 0.239 | 131 |
302 | Ed Charles | Right | 70 | 170 | 0.263 | 86 |
303 | Tony Conigliaro | Right | 75 | 185 | 0.264 | 166 |
304 | Phil Garner | Right | 70 | 175 | 0.260 | 109 |
305 rows × 6 columns
seaborn package’s
histplot(data=your data frame,x=x axis)
With scipy package’s stats
, we can use function probplot(data, plot=sns.mpl.pyplot)
to draw Probability Plots
<Figure size 960x480 with 0 Axes>
numpy’s function random.normal
can be used to generate data with normal distribution
With scipy package’s stats
, we can use function probplot(data, plot=sns.mpl.pyplot)
to draw Probability Plots
<Figure size 960x480 with 0 Axes>
With scipy package’s stats
, we can use function skewnorm.rvs()
to generate skewed data
<Figure size 960x480 with 0 Axes>
With scipy
package’s stats
, the following functions can be used:
With scipy package’s stats
, the following functions can be used:
shapiro(data)
kstest(data, distribution, args=(mean,sd))
ShapiroResult(statistic=0.9992418885231018, pvalue=0.25002941489219666)
With scipy package’s stats
, the following functions can be used:
shapiro(data)
kstest(data, distribution, args=(mean,sd))
KstestResult(statistic=0.014450757533408576, pvalue=0.5530800639002007, statistic_location=-0.3566578832989416, statistic_sign=1)
With scipy package’s stats
:
binom.pmf(x, n, p)
<Figure size 960x480 with 0 Axes>
With scipy package’s stats
:
binom.pmf(x, n, p)
0.5583457484800001
The study found that when presented with prints from the same individual, a fingerprint expert will correctly identify the match 92% of the time.
In contrast, a novice will correctly identify the match 75% of the time. Consider a sample of five different pairs of fingerprints, where each pair is a match.
With scipy package’s stats
:
poisson.pmf(k=x, mu=λ)
<Figure size 960x480 with 0 Axes>
With scipy package’s stats
:
poisson.pmf(k=x, mu=λ)
You work in Quality Assurance for an investment firm. A clerk enters 75 words per minute with 6 errors per hour.
With scipy package’s stats
:
expon.cdf(x, scale=θ)
the length of life of a magnetron tube has an exponential probability distribution with θ = 6.25.
Suppose a warranty period of 5 years is attached to the magnetron tube. What fraction of tubes must the manufacturer plan to replace?
NormalDist(mu=μ, sigma=σ).cdf(x)
binom.pmf(x, n, p)
poisson.pmf(k=x, mu=λ)
expon.cdf(x, scale=θ)