Homework 9

CHE 116: Numerical Methods and Statistics

Prof. Andrew White

Version 1.0 (3/23/2016)



In [4]:
from math import erf, sqrt
import numpy as np
import scipy.stats

General Instructions

For full credit, you must have the following items for each problem:

  • [1 point] Describe what and why the method you're using is applicable. For example, 'I chose the signed rank test because these are two matched datasets describing one measurement'

  • [1 point] Write out the null hypothesis. For example, 'The null hypothesis is that the two measurements sets came from the same population (synonymous with probability distribution)'

  • [1 point] Report the p-value and your alpha value

  • [1 point] if you accept/reject the null hypothesis and answer the question

1. $zM$ Tests (8 Points)

  1. You have a sample of an unknown metal with a melting point of $1,070^\circ{}$ C. You know that gold has a melting point of $1,064^\circ{}$ C and your measurements have a standard deviation of $5^\circ{}$ C. Is the unknown metal likely to be gold?

  2. Recall from confidence intervals, that the standard deviation in distance from the true mean is $\sigma / \sqrt{N}$ when you know the true standard deviation, $\sigma$. You take three additional samples and get $1,071^\circ{}$ C, $1,067^\circ{}$ C, and $1,075^\circ{}$ C. Does your evidence for gold change? USe the original measurement as well.

2. $t$-Tests (4 Points)

  1. The median snowfall in Rochester is 89.3. The last four snowfalls have been 112.7, 78, 59.9 and 127. Are these snowfalls abnormal?

  2. Repeat problem 1.2 without knowing the standard deviation

3. Wilcoxon's Sum of Rank Test (4 Points)

  1. You are comparing the GPAs of students who take a new Freshman preparedness course and those who do not. Their GPAs are given below. Does the course help the students?

In [17]:
data_1 = [3.05, 3.01, 3.20, 3.16, 3.11, 3.09]
data_2 = [3.18, 3.23, 3.19, 3.28, 3.08, 3.18]

4. Wilcoxon's Signed Rank Test (4 Points)

  1. You calculate how long it takes someone to run two miles before and after they've eaten a garbage plate. Does eating a garbage plate influence your ability to run?

In [21]:
data_empty_tummy = [17.1, 29.5, 23.8, 37.3, 19.6, 24.2, 30.0, 20.9]
data_garbage_tummy = [14.2, 30.3, 21.5, 36.3, 19.6, 24.5, 26.7, 20.6]

5. Spearman's Correlation Test (4 Points)

  1. We've performed a chemical reaction at different temperatures and would like to see if there is a relationship with temperature and yield. Is there one?

In [26]:
temperature = [15, 18, 21, 24, 27, 30, 33]
chem_yield = [66, 69, 69, 70, 64, 73, 75]

6.Poisson Test (4 Points)

  1. Some speculate that the lottery is an elaborate trap for time-travelers. We set-up a lottery where the odds of winning are one in 10 million. If one million people play and we get 3 winners, should we be suspicious of the number of winners?

7. Binomial Test (4 Points)

You're wondering if you have a fair coin or not. You've flipped it 25 times and gotten heads 8 times. Is there evidence that the coin is unfair?

8. Choosing the test (5 Points)

State which test is most appropriate for the following:

  1. You drive two different routes home from work. You drive each route 10 times. Are they significantly different?
  2. You normally get 10 likes when you post a selfie. Today you got 25 likes. Are you looking significantly good today?
  3. You have the number of computer viruses a set of 25 users has on their computers after 4 weeks. They each take a training course about risky Internet behavior and you have the number of viruses on their computers in the following 4 weeks. Does the course help them?
  4. On average, students get a 94% on a homework. These are the grades on this homework: 78, 85, 67, 53, 57, 84, 26. Are these significantly different than the previous average?
  5. A drug trial showed that patients using a new drug develop liver problems at a rate of 1 per 25. In a group of 10 patients using the drug, two are showing liver problems. Is this significantly different?