In: Math
1. Use the diamond data:
Is there enough evidence in the data that population average price of diamond for color “E” is more than 1500.
Please solve using R please.
Thank you
| Color | Price |
| D | 1302 |
| E | 1510 |
| G | 1510 |
| G | 1260 |
| D | 1641 |
| E | 1555 |
| F | 1427 |
| G | 1427 |
| H | 1126 |
| I | 1126 |
| F | 1468 |
| G | 1202 |
| E | 1327 |
| I | 1098 |
| E | 1693 |
| F | 1551 |
| G | 1410 |
| G | 1269 |
| H | 1316 |
| H | 1222 |
| E | 1738 |
| F | 1593 |
| G | 1447 |
| H | 1255 |
| F | 1635 |
| H | 1485 |
| F | 1420 |
| H | 1420 |
| F | 1911 |
| H | 1525 |
| F | 1956 |
| H | 1747 |
| I | 1572 |
| E | 2942 |
| G | 2532 |
| E | 3501 |
| E | 3501 |
| F | 3501 |
| F | 3293 |
| G | 3016 |
| F | 3567 |
| G | 3205 |
| D | 3490 |
| E | 3635 |
| F | 3635 |
| F | 3418 |
| D | 3921 |
| F | 3701 |
| F | 3480 |
| G | 3407 |
| E | 3767 |
| F | 4066 |
| E | 4138 |
| F | 3605 |
| G | 3529 |
| F | 3667 |
| I | 2892 |
| G | 3651 |
| G | 3773 |
| F | 4291 |
| E | 5845 |
| G | 4401 |
| G | 4759 |
| H | 4300 |
| F | 5510 |
| G | 5122 |
| H | 5122 |
| I | 3861 |
| F | 5881 |
| F | 5586 |
| F | 5193 |
| H | 5193 |
| F | 5263 |
| I | 5441 |
| I | 4948 |
| H | 5705 |
| F | 6805 |
| H | 6882 |
| H | 6709 |
| I | 6682 |
| E | 3501 |
| G | 3432 |
| F | 3851 |
| H | 3605 |
| E | 3900 |
| H | 3415 |
| H | 4291 |
| E | 6512 |
| E | 5800 |
| F | 6285 |
Soln
data_5Nov = read.csv(file.choose(),header = T)
head(data_5Nov)
Output
Color Price
1 D 1302
2 E 1510
3 G 1510
4 G 1260
5 D 1641
6 E 1555
data = data_5Nov[data_5Nov$Color=="E",] ## to get only the ‘E’ Color records
Alpha = 0.05
Null and Alternate Hypothesis
H0: µ = 1500
Ha: µ > 1500
t.test(data$Price, mu = 1500,alternative = "greater")
Output
One Sample t-test
data: data$Price
t = 4.75, df = 15, p-value = 0.000129
alternative hypothesis: true mean is greater than 1500
95 percent confidence interval:
2717.118 Inf
sample estimates:
mean of x
3429.062
Result
Since the p-value is less than 0.05, we reject the null hypothesis in favour of alternate hypothesis.
Conclusion
Population average price of diamond for color “E” is more than 1500.