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

144 lines
5.3 KiB
Markdown

# Homework 6 - Aidan Sharpe
## 1
Using a mathematical model, social analysts estimate that, on average, a US adult has social ties with 634 people. A survey of 1700 randomly selected US adults who are cell phone users find that the average number of social ties for the cell phone users in the sample was 664 with a standard deviation of 500. Does the sample provide evidence that the average number of social ties for a cell phone user is significantly different from 634, the hypothesized number for all US adults? Use $\alpha = 0.05$.
$$\mu = 634$$
$$\bar{x} = 664$$
$$s = 500$$
$$\alpha = 0.05$$
### a)
$H_0$: $\mu = 634$
$H_a$: $\mu \ne 634$
### b)
$$t^* = {664 - 634 \over {500 \over \sqrt{1700}}} = 2.47386$$
### c)
```python
>>> import numpy as np
>>> import scipy.stats as st
>>> import matplotlib.pyplot as plt
>>> def p_value(test_statistic, sample_size):
... test_statistic = abs(test_statistic)
... return 1 - st.t.cdf(test_statistic, sample_size - 1)
>>> n = 1700
>>> ts = (664 - 634) / (500 / n**(1/2))
>>> p_value(ts, n)
0.0067315863612649185
```
### d)
Since $0.00673 < 0.05$, we have enough evidence to reject the proposition that the average number of social ties of a US adult is 634 people.
## 2
The Edison Electric Institute has published figures on the number of kilowatt hours used annually by various home appliances. It is claimed that a vacuum cleaner uses an average of 40 kilowatt hours per year. If a random sample of 14 homes included in a planned study indicates that vacuum cleaners use an average of 36 kilowatt hours per year with a standard deviation of 10.5 kilowatt hours, does this suggest at the 0.05 level of significance that vacuum cleaners use, on average, less than 40 kilowatt hours annually? Since the sample size is small, we will assume the population of kilowatt hours to be normal.
$$\mu_0 = 40$$
$$\bar{x} = 36$$
$$s = 10.5$$
$$n = 14$$
$$\alpha = 0.05$$
Null and alternative hypothesis:
$H_0$: $\mu = 40$
$H_a$: $\mu < 40$
$$t^* = {36 - 40 \over {10.5 \over \sqrt{14}}} = -1.42539$$
Using the same p-value function from the previous exercise:
```python
>>> n = 14
>>> ts = (36 - 40) / (10.5 / n**(1/2))
>>> p_value(ts, n)
0.08880497181576619
```
Since the p-value is greater than $\alpha$, we do not have enough evidence to reject the proposition that the average power consumption of a vacuum cleaner is 40 kilowatt hours per year.
## 3
The brightness of a television picture tube can be evaluated by measuring the amount of current required to achieve a particular brightness level. A sample of 65 tubes results in $\bar{x} = 317.2$ and $s = 15.7$. Find (in microamps) a 99% confidence interval on mean current required.
$$s = 15.7$$
$$\bar{x} = 317.2$$
$$n = 65$$
$$\alpha = 0.01$$
$$\bar{x} \pm t^*{s \over \sqrt{n}}$$
```python
>>> from scipy.stats import t
>>> s = 15.7
>>> x_bar = 317.2
>>> n = 65
>>> a = 0.01
>>> ts = t.ppf(1 - (a/2), n)
>>> x_bar + ts * s / n**(1/2)
322.3674842907025
>>> x_bar - ts * s / n**(1/2)
312.03251570929746
```
We are 99% confident that the mean current draw to achieve this particular brightness is between 312.033[$\mu$A] and 322.367[$\mu$A].
## 4
Consider the scenario in the previous problem. Suppose that the design engineer claims that this tube will require at least 300 microamps of current to produce the desired brightness level. Formulate and test an appropriate hypothesis to confirm this claim using $\alpha = 0.05$.
$$\bar{x} = 317.2$$
$$s = 15.7$$
$$n = 65$$
$$\alpha = 0.05$$
$$\mu_0 = 300$$
$H_0$: $\mu = 300$
$H_a$: $\mu > 300$
$$t^* = {317.2 - 300 \over {15.7 \over \sqrt{65}}} = 4.341$$
```python
>>> from scipy.stats import t
>>> n = 15.7
>>> x_bar = 317.2
>>> mu0 = 300
>>> s = 15.7
>>> ts = (x_bar - mu0) / (s / n**(1/2))
>>> t.sf(abs(ts), n)
0.00026342753958306323
```
Since the p-value is less than $\alpha$, we can reject the null hypothesis, meaning that the average tube will draw at least 300[$\mu$A].
## 5
A new steel plant has gone into production and markets a specific grade of steel. It is necessary to determine if the mean tensile strength of the new product differs significantly from the industry standard. A sample of 40 is taken from the new producer and yields a mean tensile strength value of $\bar{x} = 48950$ psi with a standard deviation of $s = 2700$ psi. Determine if the mean ultimate tensile strength of the new product differs significantly from the industry standard, $\mu = 50000$psi. Use $\alpha = 0.01$
$$n = 40$$
$$s = 2700$$
$$\bar{x} = 48950$$
$$\mu_0 = 50000$$
$$\alpha = 0.01$$
$H_0$: $\mu = 50000$
$H_a$: $\mu \ne 50000$
$$t^* = {48950 - 50000 \over {2700 \over \sqrt{40}}} = -2.4595$$
```python
>>> from scipy.stats import t
>>> n = 40
>>> s = 2700
>>> x_bar = 48950
>>> mu0 = 50000
>>> a = 0.01
>>> ts = (x_bar - mu0) / (s / n**(1/2))
>>> t.sf(abs(ts), n)
0.00916542992087841
```
Since the p-value is less than but very close to $\alpha$, there is technically enough evidence to reject the proposition that the tensile strength meets the industry standard, however, more testing should be done to ensure this.
## 6
Would your conclusion from Problem 5 change if we used a significance level of $\alpha = 0.05$?
If $\alpha$ was instead 0.05, the p-value would be much lower than the threshold required, and therefore there is enough evidence to reject the proposition that the tensile strength of this steel meets the industry standard.