Test the hypothesis that the average price of diamonds in the available data is larger than $4500 after filtering out the cheapest diamonds (< $1000)
Single mean test
Data : diamonds
Filter : price >= 1000
Variable : price
Confidence: 0.95
Null hyp. : the mean of price = 4500
Alt. hyp. : the mean of price is > 4500
mean sd n n_missing
5100.963 4028.164 2186 0
diff se t.value p.value df 5% 100%
600.963 86.155 6.975 < .001 2185 4959.19 Inf ***
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Compare diamond prices by the quality of the ‘cut’. It seems that diamonds with a premium cut cost more than diamonds with a ideal cut. Seems strange. Perhaps we should use regression to control for the carats of the diamond. Try it!
Pairwise mean comparisons (t-test)
Data : diamonds
Filter : price >= 1000
Variables : cut, price
Samples : independent
Confidence: 0.95
Adjustment: Bonferroni
cut mean n sd se ci
Fair 4701.771 96 3742.952 382.013 758.393
Good 5141.244 213 3663.915 251.047 494.869
Very Good 5206.187 492 3897.686 175.721 345.258
Premium 5462.115 593 4261.665 175.006 343.707
Ideal 4802.742 792 4037.949 143.482 281.651
Null hyp. Alt. hyp. diff p.value
Fair = Good Fair not equal to Good -439.473 1
Fair = Very Good Fair not equal to Very Good -504.416 1
Fair = Premium Fair not equal to Premium -760.344 0.725
Fair = Ideal Fair not equal to Ideal -100.971 1
Good = Very Good Good not equal to Very Good -64.943 1
Good = Premium Good not equal to Premium -320.871 1
Good = Ideal Good not equal to Ideal 338.502 1
Very Good = Premium Very Good not equal to Premium -255.928 1
Very Good = Ideal Very Good not equal to Ideal 403.445 0.756
Premium = Ideal Premium not equal to Ideal 659.373 0.036 *
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Visualize the relationship between diamond prices, carats, and the cut of the diamond.