Answer the following questions in Python and Markdown. Show the expression you are evaluating in Markdown first and then calculate the answer in Python. You should report your answer in Markdown. You may use scipy.stats for all problems in this set.

Your Markdown answer should look like the following:

Distribution: Bernoulli

p: 0.3

we are being asked to calculate the expected values, whose equation is:

$\sum_{x=0}^1 x P(x)$

Using the python cell below, the answer is $0.3$

The time between Siggi, my puppy, stealing socks is exponentially distributed. He steals a sock about every 6 hours. What's the probability that we go an entire day without him stealing a sock?

Distribution: Exponential

$\lambda$: 1 / 6 socks per hour

We are being asked a cumulative probability:

$$ \int_{24}^\infty \lambda e^{-\lambda x} \, dx $$

which is 0.018.


In [18]:
import scipy.stats as ss

1 - ss.expon.cdf(24, scale=6)


Out[18]:
0.01831563888873422

My cat Pizzicato loves to go outside and I let her out about once every other day. With a probability of 99%, what's the longest amount of time between Pizzicato going outside. Another way of saying it: what's the amount of time that corresponds to 99% of the probability between trips outside for Pizzicato

Distribution: Exponential

$\lambda$: 0.5 per day

We are being asked to compute a prediction interval for 99%:

$$ \int_0^x \lambda e^{-\lambda t}\,dt = 0.99 $$

which is 9.2 days


In [19]:
ss.expon.ppf(0.99, scale=2)


Out[19]:
9.2103403719761818

At a manufacturing plant, there are on average 2 defective parts per one thousand. What's the probability of less than 5 defective parts in a given lot of one thousand parts?

Distribution: Poisson

$\mu$: 2

We are being asked a cumulative distribution function

$$ \sum_{x=0}^4 \frac{e^{-\mu}\mu^x}{x!} $$

which is 0.947


In [20]:
ss.poisson.cdf(4, 2)


Out[20]:
0.94734698265628892

At a manufacturing plant, the quality assurance inspector examines five parts from a lot of one thousand and rejects the entire lot if any of them are defective. If we have the same rate of defects, 2 part per thousand, then what's the probability that a lot is rejected?

Distribution: Geometric

p: 2 / 1000

We are being asked about a cumulative distribution function:

$$ \sum_{x=1}^5 p(1-p)^{x - 1} $$

which is 0.0100


In [21]:
ss.geom.cdf(5, 2 / 1000)


Out[21]:
0.0099600799200320004

A reaction vessel can tolerate a maximum temperature of 2250 $^\circ$C. You measure the temperature in the vessel many times and determine the average temperature is 1350 $^\circ$ C with a standard deviation of 400$^\circ$ C. What's the probability that the temperature in the reaction vessel exceeds its maximum temperature?

Distribution: Normal

$\mu$: 1350

$\sigma$: 400

We are being asked about this cumulative probability distribution interval:

$$ \int_{2250}^\infty {\mathcal{N}(1350, 400)}\,dx $$

which has a probability of 0.0122


In [22]:
1 - ss.norm.cdf(2250, loc=1350, scale=400)


Out[22]:
0.012224472655044671

English Mastiff dogs weigh 134 pounds on average with a standard deviation of 12 pounds. What's the probability of having a Mastiff that weighs less than 100 pounds?

Distribution: Normal

$\mu$: 134

$\sigma$: 12

We are being asked about this cumulative probability distribution interval:

$$ \int_{-\infty}^{100} {\mathcal{N}(134, 12)}\,dx $$

which has a probability of 0.00230


In [23]:
ss.norm.cdf(100, scale=12, loc=134)


Out[23]:
0.0023032661316958825

In a class, the average score on a test is 94% with a standard deviation of 13%. Can we model this with a normal distribution? Why or why not? Assume that the highest possible score is 100% (no extra credit).

Distribution: Normal

$\mu$: 94

$\sigma$: 13

We are being asked about this cumulative probability distribution interval:

$$ \int_{100}^{\infty} {\mathcal{N}(134, 12)}\,dx $$

which has a probability of 0.32. No, this is not a good approximation since the model predicts 32% of the students have greater than 100%.


In [24]:
1 - ss.norm.cdf(100, scale=13, loc=94)


Out[24]:
0.32220616688490566