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

54 lines
1.8 KiB
Markdown

# Homework 10 - Aidan Sharpe
## 1
The titanium content in an aircraft-grade alloy is an important discriminant of strength. A sample of 10 test coupns reveals the following titanium content in percent:
| Coupon | Titanium Content |
| ------ | ---------------- |
| 1 | 8.30% |
| 2 | 8.09% |
| 3 | 8.99% |
| 4 | 8.60% |
| 5 | 8.40% |
| 6 | 8.35% |
| 7 | 8.36% |
| 8 | 8.75% |
| 9 | 8.91% |
| 10 | 8.05% |
Suppose that the distribution of titanium content is symmetric and continuous. Does the sample data suggest that the mean titanium content differs significantly from 8.5%? Use $\alpha = 0.05$
```python
>>> coupons = [8.3, 8.09, 8.99, 8.60, 8.40, 8.35, 8.36, 8.75, 8.91, 8.05]
>>> mu0 = 8.5
# Find the difference between each sample and mu0
>>> differences = [xi - mu0 for xi in coupons]
# Find the absolute differences
>>> abs_diffs = [abs(x) for x in differences]
# Sort the differences in ascending order
>>> s_diffs = sorted(abs_diffs)
# Turn the sorted order into a ranked list
>>> ranks = [abs_diffs.index(x) + 1 for x in s_diffs]
# Find the ranks corresponding to positive differences
>>> p_ranks = [ranks[i] if differences[i] > 0 else 0 for i in range(len(differences))]
# Find the ranks corresponding to negative differences
>>> n_ranks = [ranks[i] if differences[i] < 0 else 0 for i in range(len(differences))]
# Find the positive and negative rank sums
>>> wp = sum(p_ranks)
>>> wn = sum(n_ranks)
# Find the test statistic
>>> w_observed = min(wp, wn)
>>> w_observed
22
```
For a two-sided signed rank test with $\alpha = 0.05$ and 10 samples, $w_\alpha^*$ is 8. Since 22 is greater than 8, we do not have enough evidence to suggest that the mean titanium content differs from 8.5%.