Diamond analysis

A.Izquierdo

27/5/2020

Introduction

This is a presentation showing a quick data analysis App published in ShyniApps.io in this link. The github repo with the source files is in this link We’ve used the diamonds dataset as source of information. In this presentation we’ll go through the application and explain its usage.

The user interface file contains four tabs.

Basic Data exploration

In the first tab, the user can get a summary of the diamonds data. Data can be filtered by cut type.

Simple plot and model

In the second tab, the user gets a plot of price vs. carats and a linear model that fits both variables. Selecting the carat mass, the user can get the predicted diamond value.

The lineal model and plot generated plus moving point for the prediction based on the selected carats

  #linear model
  model<- lm(price ~ carat, data = diamonds)

    plot(diamonds$carat, diamonds$price, xlab = "Mass(carats)", ylab = "Price (Sin$)",
         bg="lightblue",cex=1,pch=21,frame=FALSE,col = alpha("blue", 0.05),
         xlim = c(0, 3.5))
    # plot line with the model
    abline(model, col = "red", lwd = 2)
    #}
    points(caratInput, modelpred(), col = "red", pch = 16, cex = 2)

The slider plus tabs show like this:

Filtered plot and model

In the third tab, the user gets a plot of price vs. carats and a linear model that fits both variables after filtering the diamond color. Like in the previous tab, the user can select the carat mass, the user can get the predicted diamond value. This second analysis provides an interesting insight compared to the previous one.