Question: Using R studio. The diamonds data frame in ggplot2 package (which is part of tidyverse) contains the prices and other attributes of almost 54,000 diamonds.

Using R studio. The diamonds data frame in ggplot2 package (which is part of tidyverse) contains the prices and other attributes of almost 54,000 diamonds. The variables are as follows:

  • Price: price in US dollars
  • Carat: weight of the diamond
  • Cut: quality of the cut (Fair, Good, Very Good, Premium, Ideal)
  • Color: diamond colour, from J (worst) to D (best)
  • Clarity: a measurement of how clear the diamond is (I1 (worst), SI2, SI1, VS2, VS1, VVS2, VVS1, IF (best))
  • X: length in mm
  • Y: width in mm
  • Z: depth in mm
  • Depth: total depth percentage = z / mean(x, y) = 2 * z / (x + y)
  • Table: width of top of diamond relative to widest point

  1. Extract all rows from 20001 to 30000 and the first 5 columns of diamonds data and save it as a data frame. Then, answer the following questions based on this subset of diamonds data.
  2. Is there any linear relationship between price and weight (measured in carat)? Use appropriate charts and/or summary statistics to support your answer.
  3. Do the following:
    1. For each cut quality, calculate the following summary statistics for the price of diamonds: mean, median, standard deviation, Q1, Q3, minimum, and maximum. Is it true that the higher the cut quality the higher the price?
    2. Make boxplots to show the distribution of price by cut quality. (So, you will make 5 boxplots that appear side-by-side.) Discuss the results briefly (e.g., how is diamond price related to cut quality? Are the distributions of diamond price symmetric, right-skewed, or left-skewed?)
    3. Are you somewhat surprised by the results above? If yes, please try to explain what might have caused the surprise.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!