27/12/2020

Summary

This is necessary documentation in order to use in the best way possible the application.

The data used in the generation of the estimate of the price of diamonds comes from the following data set.

head(diamond)
##   carat price
## 1  0.17   355
## 2  0.16   328
## 3  0.17   350
## 4  0.18   325
## 5  0.25   642
## 6  0.16   342

Linnear regression

The data is estimated from a linear regression that follows the following structure:

model <- lm(price ~ carat, data = diamond)
model$coefficients
## (Intercept)       carat 
##   -259.6259   3721.0249

That data is used in an interactive plot in which can be choose the size of the diamond

Regression Plot code

plot_ly(diamond,x=~carat,y=~price,type="scatter",mode="markers")%>%
        add_lines(x=~carat,y=fitted(model),col="steelblue4",lwd=2)%>%
        layout(showlegend=F)

Regression Plot