Homework 6

CHE 116: Numerical Methods and Statistics

2/21/2020


1. Probability Distributions (12 Points)

For each distribution below, give 2 real world examples of random numbers that follow the distribution. Give a 1-2 sentence justification for each example including why the sample space is valid. Please avoid examples already seen in lecture. 2 points each

  1. Bernoulli
  2. Geometric
  3. Binomial
  4. Poisson
  5. Exponential
  6. Normal

2. Plotting Probability Distributions (18 Points)

Label your axes, add a title, and use LaTeX in your labels when necessary. Use dots connected by lines for discrete and lines for continuous. You may use numpy, but not scipy stats

  1. [6 points] Plot three different parameters of the binomial distribution: $p = 0.2, p = 0.5, p = 0.8$ where $N=12$ for each case. Add vertical lines at their means. Accomplish the plot of the three lines using a for loop over this list: [0.2, 0.5, 0.8]. Be sure to add a legend.

  2. [4 points] Plot the binomial distribution for $N = 20, p = 0.05$. Recall that the Poisson is an approximation to the Binomial when the expected value is much lower than $N$. Plot the Poisson approximation to this Binomial distribution on the same plot. Add a legend and make the Poisson have a dashed line connecting its points.

  3. [2 points] Make a second plot with the binomial and Poisson, but use $N = 14, p = 0.6$. How good is the approximation?

  4. [6 points] See below what your plot should look like. The command plt.fill_between can be used to plot an area under a curve. For example, fill_between(x, y) will fill the area between 0 and y, where y could be a numpy array. Using fill_between, show the cumulative probability function for the standard normal distribution from $Z = -2$ to $Z = 2$. Make your $p(x)$ plot extend from $-5$ to $5$, only have the $-2$ to $2$ region filled. Ensure that there are two lines on your plot: one that is the normal pdf $p(x)$ and one that is the fill_between. The pdf should extend further than your fill_between line. Use the ss.norm.pdf to generate the normal distribution line.


In [2]:
import IPython    
IPython.display.HTML('<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAVAAAADgCAYAAABVVT4YAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3Xl8VPW9//HXJ8MOYhWiom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2DjQFRGQDkKeq6ThpQpNEZBTwB2Ckqla6ztMSsdPDrAOuIijOpcBXVbXIabAESPDX+EVgl6p+z3UthcRqAAABGElEQVSeZIhtgf5AVa9znSUR9hmoaY6ngeOAWSKyQkTGuQ7UXLGDX/VnQ1gLvB7G8oy5BLgNuDL2/2FFbCvOOGJboMYYkyDbAjXGmARZgRpjTIKsQI0xJkFWoMYYkyArUGOMSZAVqDHGJMgK1BhjEmQFajJabP7ML8YuPywi/+06k8kc9l14k+l+DjwkIicRzF40xnEek0Hsm0gm44nIfKAbcEVsHk1jksJ24U1Gi82M1QuotfI0yWYFajKWiPQimLt0LLA/NquUMUljBWoykoh0ASYSnENoLfArgs9DjUka+wzUGGMSZFugxhiTICtQY4xJkBWoMcYkyArUGGMSZAVqjDEJsgI1xpgEWYEaY0yCrECNMSZB/wdz3NaAmJGoFwAAAABJRU5ErkJggg==">')


Out[2]:

3. Prediction Intervals (14 Points)

Do not use numpy or scipy

  1. [6 points] Consider a Poisson distribution with $\mu = 7.5$. Using a for loop, show that the interval [0,50] includes nearly all probability mass.

  2. [2 points] Use the definition of expected value ($\sum_{x \in Q} P(x)\cdot x= E[x]$) to modify your for loop above to compute the expected value. As we know, your answer should be $7.5$.

  3. [2 points] Modify your code from problem 1 to compute the 0.99 prediction interval using a for loop and break statement.

  4. [4 points] Assume this Poisson distribution describes the number of world records broken at the Olympics. Find the lowest number of world records that will be exceeded 90% of the time. Answer this problem using a while loop.

4. Normal Distribution (12 Points)

Use scipy.stats here as needed.

  1. [1 point] True or false: $Z$-scores are used to convert samples to a standard normal distribution?
  2. [1 point] What is $P(x > 4)$ for a standard normal distribution?
  3. [2 points] Given that $\mu = 4$, $\sigma = 0.5$, what is the probability of observing a sample between 0 and 2? Answer using a $Z$-score.
  4. [2 points] ss.norm.pdf(0, loc=0, scale=0.001) seems to have a high probability. How is this consistent with normalization?
  5. [2 points] Given that $\mu = 1$, $\sigma = 0.4$, what is the probability of observing a sample between -2 and 2? Answer without using a $Z$-score.

  6. [4 points] What is $P(-3 < x < 3)$ for a standard normal distribution? What can you say about intervals that are "six sigma wide", $-3\sigma$ to $3\sigma$? How often will you see samples outside of this interval?

5. Sentiment (6 Points)

Answer in 1-2 sentences. No correct answer, just give an honest, meaningful answer to receive credit.

  1. Why is probability important to know as a chemical engineer?

  2. Do you feel confident in understanding probability expressions, like conditionals and marginals?

  3. Can you imagine yourself using Python in your fluid mechanics or other courses?

  4. What topic are you most confident in?

  5. Do you have any feedback for the course?


In [ ]: