Question

In: Math

Test if the population mean price for clarity “VS1” is different than that for clarity “VVS1...

Test if the population mean price for clarity “VS1” is different than that for clarity “VVS1 or VVS2”.

Please answer with R programming code

Clarity Price
VS2 1302
VS1 1510
VVS1 1510
VS1 1260
VS1 1641
VS1 1555
VS1 1427
VVS2 1427
VS2 1126
VS1 1126
VS1 1468
VS2 1202
VS2 1327
VS2 1098
VS1 1693
VS1 1551
VS1 1410
VS2 1269
VS1 1316
VS2 1222
VS1 1738
VS1 1593
VS1 1447
VS2 1255
VS1 1635
VVS2 1485
VS2 1420
VS1 1420
VS1 1911
VS1 1525
VS1 1956
VVS2 1747
VS1 1572
VVS2 2942
VVS2 2532
VS1 3501
VS1 3501
VVS2 3501
VS1 3293
VS1 3016
VVS2 3567
VS1 3205
VS2 3490
VS1 3635
VVS2 3635
VS1 3418
VS1 3921
VVS2 3701
VS1 3480
VVS2 3407
VS1 3767
VVS1 4066
VVS2 4138
VS1 3605
VVS2 3529
VS1 3667
VVS2 2892
VVS2 3651
VVS2 3773
VS1 4291
VVS1 5845
VVS2 4401
VVS1 4759
VVS1 4300
VS1 5510
VS1 5122
VVS2 5122
VS2 3861
VVS2 5881
VS1 5586
VS2 5193
VVS2 5193
VS2 5263
VVS2 5441
VS2 4948
VS2 5705
VS2 6805
VVS2 6882
VS1 6709
VVS2 6682
VS1 3501
VVS1 3432
VVS1 3851
IF 3605
VS1 3900
VVS1 3415
IF 4291
IF 6512
VS1 5800
VVS1 6285

Solutions

Expert Solution

To perform the analysis in R, first we have to load the data in R Studio. We can do this by two methods, either we load it directly or we can use the Excel/CSV Format. I have used the CSV format here and labelled the file Clarity_data.

#Printing the data

> print(Clarity_data)
Clarity Price
1 VS2 1302
2 VS1 1510
3 VVS1 1510
4 VS1 1260
5 VS1 1641
6 VS1 1555
7 VS1 1427
8 VVS2 1427
9 VS2 1126
10 VS1 1126
11 VS1 1468
12 VS2 1202
13 VS2 1327
14 VS2 1098
15 VS1 1693
16 VS1 1551
17 VS1 1410
18 VS2 1269
19 VS1 1316
20 VS2 1222
21 VS1 1738
22 VS1 1593
23 VS1 1447
24 VS2 1255
25 VS1 1635
26 VVS2 1485
27 VS2 1420
28 VS1 1420
29 VS1 1911
30 VS1 1525
31 VS1 1956
32 VVS2 1747
33 VS1 1572
34 VVS2 2942
35 VVS2 2532
36 VS1 3501
37 VS1 3501
38 VVS2 3501
39 VS1 3293
40 VS1 3016
41 VVS2 3567
42 VS1 3205
43 VS2 3490
44 VS1 3635
45 VVS2 3635
46 VS1 3418
47 VS1 3921
48 VVS2 3701
49 VS1 3480
50 VVS2 3407
51 VS1 3767
52 VVS1 4066
53 VVS2 4138
54 VS1 3605
55 VVS2 3529
56 VS1 3667
57 VVS2 2892
58 VVS2 3651
59 VVS2 3773
60 VS1 4291
61 VVS1 5845
62 VVS2 4401
63 VVS1 4759
64 VVS1 4300
65 VS1 5510
66 VS1 5122
67 VVS2 5122
68 VS2 3861
69 VVS2 5881
70 VS1 5586
71 VS2 5193
72 VVS2 5193
73 VS2 5263
74 VVS2 5441
75 VS2 4948
76 VS2 5705
77 VS2 6805
78 VVS2 6882
79 VS1 6709
80 VVS2 6682
81 VS1 3501
82 VVS1 3432
83 VVS1 3851
84 IF 3605
85 VS1 3900
86 VVS1 3415
87 IF 4291
88 IF 6512
89 VS1 5800
90 VVS1 6285

#We do a basic EDA (Exploratory Data Analysis) of Clarity Data
> summary(Clarity_data)
Clarity Price   
Length:90 Min. :1098
Class :character 1st Qu.:1552
Mode :character Median :3496
Mean :3301
3rd Qu.:4291
Max. :6882

Here we get the overall five number summary of the data.


> dim(Clarity_data)
[1] 90 2

Here we see the dimensions of the data.


> str(Clarity_data)
Classes ‘tbl_df’, ‘tbl’ and 'data.frame':   90 obs. of 2 variables:
$ Clarity: chr "VS2" "VS1" "VVS1" "VS1" ...
$ Price : num 1302 1510 1510 1260 1641 ...

Here we see the data structure that is character and numeric.


> unique(Clarity_data$Clarity)
[1] "VS2" "VS1" "VVS1" "VVS2" "IF"

Here we see the list of unique clarity entities.


> count(Clarity_data$Clarity)
x freq
1 IF 3
2 VS1 40
3 VS2 16
4 VVS1 9
5 VVS2 22

Here we observe the frequency of each entity.

#To Test if the population mean price for clarity “VS1” is different than that for clarity “VVS1 or VVS2”.​​​​​, we have to use the R package crunch. Since it is already installed in my system, I simply call out the library.


> library(crunch)


> Clarity_VS1 <- Clarity_data[Clarity_data$Clarity == "VS1",]
> mean(Clarity_VS1$Price)
[1] 2829.55

We observe the mean value for VS1 as 2829.55.

> Clarity_VVS1 <- Clarity_data[Clarity_data$Clarity == "VVS1",]
> mean(Clarity_VVS1$Price)
[1] 4162.556

We observe the mean value for VVS1 as 4162.556.

> Clarity_VVS2 <- Clarity_data[Clarity_data$Clarity == "VVS2",]
> mean(Clarity_VVS2$Price)
[1] 3887.682

We observe the mean value for VVS2 as 3887.682.

So after performing our analyses in R we observe that the population mean price of VS1 different from VVS1 and VVS2.


Related Solutions

In a test of the hypothesis that the population mean is smaller than 50, a random...
In a test of the hypothesis that the population mean is smaller than 50, a random sample of 10 observations is selected from the population and has a mean of 47.0 and a standard deviation of 4.1. Assume this population is normal. a) Set up the two hypotheses for this test. Make sure you write them properly. b) Check the assumptions that need to hold to perform this hypothesis test. c) Calculate the t-statistic associated with the sample. d) Graphically...
Test the claim that the mean GPA of night students is significantly different than the mean...
Test the claim that the mean GPA of night students is significantly different than the mean GPA of day students at the 0.2 significance level. The null and alternative hypothesis would be: H0:μN=μD H1:μN≠μD H0:pN=pD H1:pN≠pD H0:μN≤μD H1:μN>μD H0:pN≤pD H1:pN>pD H0:μN≥μD H1:μN<μD H0:pN≥pD H1:pN<pD The test is: two-tailed right-tailed left-tailed The sample consisted of 70 night students, with a sample mean GPA of 3.41 and a standard deviation of 0.03, and 70 day students, with a sample mean GPA of...
1) You wish to test the claim that the first population mean is greater than the...
1) You wish to test the claim that the first population mean is greater than the second population mean at a significance level of α=0.002α=0.002.      Ho:μ1=μ2Ho:μ1=μ2 Ha:μ1>μ2Ha:μ1>μ2 You obtain the following two samples of data. Sample #1 Sample #2 37.0 29.1 40.7 52.0 75.0 56.4 72.1 60.8 67.1 50.4 32.5 65.3 32.8 70.4 21.6 25.3 57.3 22.1 4.3 39.4 42.9 50.3 What is the test statistic for this sample? test statistic =  Round to 4 decimal places. What is the...
You wish to test the claim that the first population mean is greater than the second...
You wish to test the claim that the first population mean is greater than the second population mean at a significance level of α=0.005 Ho:μ1=μ2 Ha:μ1>μ2 You obtain the following two samples of data. Sample #1 Sample #2 57.7 63.3 64.3 70.1 53.6 69.6 72.2 67.3 70.1 31.0 55.7 63.8 71.4 71.4 83.6 87.9 102.3 34.9 84.5 75.1 78.5 58.8 What is the test statistic for this sample? test statistic = _____________ Round to 3 decimal places. What is the...
You wish to test the claim that the first population mean is less than the second...
You wish to test the claim that the first population mean is less than the second population meanat a significance level of α=0.001α=0.001.      Ho:μ1=μ2Ho:μ1=μ2 Ha:μ1<μ2Ha:μ1<μ2 You obtain the following two samples of data. Sample #1 Sample #2 43.3 56.2 64.2 49.7 95.4 61.0 85.0 49.1 50.9 49.1 61.0 63.2 72.7 81.7 41.4 55.8 54.5 83.6 93.5 79.2 74.9 77.8 49.8 48.8 43.5 90.5 90.5 76.2 47.7 What is the test statistic for this sample? test statistic =   Round to 3...
You wish to test the claim that the first population mean is greater than the second...
You wish to test the claim that the first population mean is greater than the second population mean at a significance level of α=0.10 .      Ho:μ1=μ2 Ha:μ1>μ2 You obtain the following two samples of data. Sample #1 Sample #2 76.2 68.1 90.1 74.7 77.1 72.9 70.3 84.0 75.9 80.1 65.7 80.1 76.2 82.0 81.7 74.5 75.1 73.3 45.5 47.8 46.1 55.5 53.7 40.0 67.4 54.6 What is the test statistic for this sample? test statistic = Round to 3...
You wish to test the claim that the first population mean is greater than the second...
You wish to test the claim that the first population mean is greater than the second population mean at a significance level of α=0.002α=0.002.      Ho:μ1=μ2 Ha:μ1>μ2 You obtain the following two samples of data. Sample #1 Sample #2 61.3 55.4 65.4 65.4 65.7 51.0 61.4 61.8 59.4 56.6 60.7 52.0 62.4 24.3 37.2 1.5 42.2 53.5 35.9 65.9 48.3 17.8 49.8 42.6 What is the test statistic for this sample? test statistic =  Round to 4 decimal places. What is...
You wish to test the claim that the first population mean is less than the second...
You wish to test the claim that the first population mean is less than the second population mean at a significance level of α=0.01α=0.01.      Ho:μ1=μ2Ho:μ1=μ2 Ha:μ1<μ2Ha:μ1<μ2 You obtain the following two samples of data. Sample #1 Sample #2 71.2 85.7 85.4 76.5 92.2 81.3 72.7 71.8 86.8 78.3 86.3 78.7 80.3 72.2 93.3 83.2 86.8 85.3 81.6 80.5 87.8 88.6 75.4 What is the test statistic for this sample? test statistic = Round to 3 decimal places. What is...
You wish to test the claim that the first population mean is less than the second...
You wish to test the claim that the first population mean is less than the second population mean at a significance level of α=0.001α=0.001.      Ho:μ1=μ2Ho:μ1=μ2 Ha:μ1<μ2Ha:μ1<μ2 You obtain the following two samples of data. Sample #1 Sample #2 41.5 47.1 71.9 67.8 57.1 72.9 52.3 70.3 65.5 68.8 66.2 69.3 70.4 87.8 79.7 89.4 81.0 70.4 71.4 68.8 91.6 82.1 79.1 What is the test statistic for this sample? test statistic =  Round to 4 decimal places. What is the...
You wish to test the claim that the first population mean is less than the second...
You wish to test the claim that the first population mean is less than the second population mean at a significance level of α=0.01α=0.01.      Ho:μ1=μ2Ho:μ1=μ2 Ha:μ1<μ2Ha:μ1<μ2 You obtain the following two samples of data. Sample #1 Sample #2 71.2 85.7 85.4 76.5 92.2 81.3 72.7 71.8 86.8 78.3 86.3 78.7 80.3 72.2 93.3 83.2 86.8 85.3 81.6 80.5 87.8 88.6 75.4 What is the test statistic for this sample? test statistic = Round to 3 decimal places. What is...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT