Rowan-Classes/5th-Semester-Fall-2023/Prob-and-Stat-for-ECEs/Homework/Homework-07.md
2024-02-22 14:23:12 -05:00

5.2 KiB
Raw Blame History

Homework 7 - Aidan Sharpe

Problem 1

A photoconductor film is manufactured at a nominal thickness of 25 mils. The product engineer wishes to decrease the energy absorption of the film, and he believes this can be achieved by reducing the thickness of the film to 20 mils. Eight samples of each film thickness are manufactured in a pilot production process, and the film absorption (in microjules per square inch) is measured. For the 25-mil film the sample data result is \bar{x}_1 = 1.17 and s_1 = 0.10. While for the 20-mil film, the data yield \bar{x}_2 = 1.07 and s_2 = 0.09. Note that an increase in film speed would lower the value of the observation in microjules per square inch. Do the data support the claim that reducing the film thickness increases the mean speed of the film? Use \alpha = 0.10 and assume the two population variances are equal and the underlying population of film speed is normally distributed.

H_0: $\mu_1 = \mu_2$ H_a: \mu_1 \ne \mu_2

>>> import scipy.stats as st
>>> def p_value(test_statistic, sample_size_1, sample_size_2):
...     df = sample_size_1 + sample_size_2 - 2
...     test_statistic = abs(test_statistic)
...     return 1 - st.t.cdf(test_statistic, df)

>>> def tstat(x1, x2, sp, n1, n2):
...     return (x1 - x2) / (sp * (1/n1 + 1/n2)**0.5)

>>> def sp(x1, x2, s1, s2, n1, n2):
...     return (((n1-1)*(s1**2) + (n2-1)*(s2**2)) / (n1 + n2 - 2))**0.5

>>> s_p = sp(x1, x2, s1, s2, n1, n2)
>>> t_star = tstat(x1, x2, s_p, n1, n2)
>>> p_value(t_star, n1, n2)
0.02704853389386974

Since the p-value is less than \alpha, we have enough evidence to reject the notion that changing the thickness of the film has no effect on its energy absorbtion.

Problem 2

A QC technician measures the quality for two lots of product. In the first lot, 20 units are tested and the average measurement is 75 with sample variance 210. In the second lot, 25 units are tested with an average measurement of 70 and sample variance of 130. Given that higher is better for this quality measurement, test the hypothesis that the quality of the second lot is lower that that of the first lot using \alpha = 0.05. You may assume the two lots come from populations with the same variance.

H_0: $\mu_a = \mu_b$ H_a: \mu_a \ne \mu_b

>>> n1 = 20
>>> n2 = 25
>>> x1 = 75
>>> x2 = 70
>>> s1 = 210**0.5
>>> s2 = 130**0.5
>>> s_p = sp(x1, x2, s1, s2, n1, n2)
>>> t_star = tstat(x1, x2, s_p, n1, n2)
>>> p_value(t_star, n1, n2)
0.10092241987763473

Since the p-value is greater than \alpha, there is not enough evidence to suggest that there is a difference in quality between the two lots.

Problem 3

Ace Explosive Demolition is understandably concerned with burn times for the fuses that they use in their work. Their two suppliers of fuses both deliver their fuses on spools that contain 10,000 feet of fuse. Thirty-two fuses of 30 feet in length are prepared from each suppliers pool. The fuses are then lit, and each fuses elapsed burn time is carefully measured. Supplier As sample average and sample variance are 30.62 and .384 seconds, respectively. Supplier Bs sample average and sample variance are 31.37 seconds and 0.185 seconds, respectively. Does the sample suggest that the mean burn time for supplier A is different than that for supplier B? use \alpha = 0.05

H_0: $\mu_a = \mu_b$ H_a: \mu_a \ne \mu_b

>>> n1 = 32
>>> n2 = 32
>>> x1 = 30.62
>>> x2 = 31.37
>>> s1 = (0.384)**0.5
>>> s2 = (0.185)**0.5
>>> s_p = sp(x1, x2, s1, s2, n1, n2)
>>> t_star = tstat(x1, x2, s_p, n1, n2)
>>> p_value(t_star, n1, n2)
2.3757646183675263e-07

Since the p-value is very close to zero, much smaller than \alpha, sample evidence suggests that the mean burn time for supplier A is not different than that for supplier B.

Problem 4

Consider the scenario stated in Problem 3. If H_0 is true and we conduct 7150 tests using 7150 different samples, how many (if any) of the individual tests would you expect to show a significant result just by random chance

Adjusting n_1 and n_2:

>>> n1 = 7150
>>> n2 = 7150
>>> s_p = sp(x1, x2, s1, s2, n1, n2)
>>> s_p
0.5333854141237835

With this many samples there is a little over a 50% chance that a significant result shows up.

Problem 5

A study was conducted to determine if a certain treatment has any effect on the amount of metal removed in a pickling operation. A random sample of 50 pieces was immersed in a bath for 24 hours without the treatment, yielding an average of 12.2 millimeters of metal removed and a sample variance of 5.4 millimeters. A second sample of 75 pieces was exposed to the treatment, followed by the 24-hour immersion in the bath, resulting in an average removal of 11.1 millimeters of metal with a sample variance of 4.8 millimeters. Does the treatment appear to reduce the mean amount of metal removed? Use \alpha = 0.01.

>>> n1 = 50
>>> n2 = 75
>>> x1 = 12.2
>>> x2 = 11.1
>>> s1 = 5.4**0.5
>>> s2 = 4.8**0.5
>>> s_p = sp(x1, x2, s1, s2, n1, n2)
>>> t_star = tstat(x1, x2, s_p, n1, n2)
>>> p_value(t_star, n1, n2)
0.004138707985700818

Since the p-value is less than \alpha, we have enough evidence to reject the notion that treatment has no effect on the amount of metal removed.