Report on diamond prices

Test the hypothesis that the average price of diamonds in the available data is larger than $3000

Data     : diamonds 
Variable : price 
Null hyp.: the mean of price = 3000 
Alt. hyp.: the mean of price is > 3000 

     mean t.value p.value   df    2.5% 97.5%    n       sd
 3907.186  12.557  < .001 2999 3788.32   Inf 3000 3956.915

plot of chunk unnamed-chunk-1

Compare diamond prices by the quality of the 'cut'. It seems that diamonds with an ideal cut cost less than than diamonds with a premium cut. Seems strange. Perhaps we should use regression to control for the carats of the diamond. Try it!

Pairwise comparisons (bonferroni adjustment)
Data     : diamonds 
Variables: cut, price 
Samples  : independent 

               mean    n       sd      se      ci
      Fair 4505.238  101 3749.540 373.093 740.206
      Good 4130.433  275 3730.354 224.949 442.848
 Very Good 3959.916  677 3895.899 149.732 293.995
   Premium 4369.409  771 4236.977 152.591 299.544
     Ideal 3470.224 1176 3827.423 111.610 218.977

 Alt. hyp.             Null hyp.             p.value    
 Good < Fair           Good = Fair           1          
 Very Good < Fair      Very Good = Fair      0.886      
 Premium < Fair        Premium = Fair        1          
 Ideal < Fair          Ideal = Fair          0.045   *  
 Very Good < Good      Very Good = Good      1          
 Premium < Good        Premium = Good        1          
 Ideal < Good          Ideal = Good          0.044   *  
 Premium < Very Good   Premium = Very Good   1          
 Ideal < Very Good     Ideal = Very Good     0.044   *  
 Ideal < Premium       Ideal = Premium       < .001  ***

Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

plot of chunk unnamed-chunk-2

What are the parameters for the compare_means function? The help text will open up in the Rstudio help file browser.

We can also try to visualize the relationship between diamond prices, carats, and the cut of the diamond.

plot of chunk unnamed-chunk-4