Wine Quality Predictor: A Shiny Application

Jean Dos Santos
27 August 2018

Wine Quality App: Summary

The Wine Quality App uses the wine quality dataset from Cortez et al. to predict the quality of white wines based on several chemical and physical parameters.

Among those parameters are:

  • Alcohol
  • Residual Sugars
  • Density
  • Sulphites
  • pH
  • Volatile Acidity

Wine Quality App: Shiny Application

The application was developed using R shiny.

A multiple linear regression model with all predictors was used to predict to quality score of the wine.

# Import Data
if(!file.exists(x = "winequality-white.csv")) {Wine_Quality_white <- read.csv(file = "https://archive.ics.uci.edu/ml/machine-learning-databases/wine-quality/winequality-white.csv", header = TRUE, sep = ";", dec = ".", stringsAsFactors = FALSE)}

# Create Linear Regression Model 
model_linear_regression <- lm(formula = quality ~ fixed.acidity + volatile.acidity + citric.acid + residual.sugar + chlorides + free.sulfur.dioxide + total.sulfur.dioxide + density + pH + sulphates + alcohol, 
                              data = Wine_Quality_white)

Wine Quality App: Model Output


Call:
lm(formula = quality ~ fixed.acidity + volatile.acidity + citric.acid + 
    residual.sugar + chlorides + free.sulfur.dioxide + total.sulfur.dioxide + 
    density + pH + sulphates + alcohol, data = Wine_Quality_white)

Residuals:
    Min      1Q  Median      3Q     Max 
-3.8348 -0.4934 -0.0379  0.4637  3.1143 

Coefficients:
                       Estimate Std. Error t value Pr(>|t|)    
(Intercept)           1.502e+02  1.880e+01   7.987 1.71e-15 ***
fixed.acidity         6.552e-02  2.087e-02   3.139  0.00171 ** 
volatile.acidity     -1.863e+00  1.138e-01 -16.373  < 2e-16 ***
citric.acid           2.209e-02  9.577e-02   0.231  0.81759    
residual.sugar        8.148e-02  7.527e-03  10.825  < 2e-16 ***
chlorides            -2.473e-01  5.465e-01  -0.452  0.65097    
free.sulfur.dioxide   3.733e-03  8.441e-04   4.422 9.99e-06 ***
total.sulfur.dioxide -2.857e-04  3.781e-04  -0.756  0.44979    
density              -1.503e+02  1.907e+01  -7.879 4.04e-15 ***
pH                    6.863e-01  1.054e-01   6.513 8.10e-11 ***
sulphates             6.315e-01  1.004e-01   6.291 3.44e-10 ***
alcohol               1.935e-01  2.422e-02   7.988 1.70e-15 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.7514 on 4886 degrees of freedom
Multiple R-squared:  0.2819,    Adjusted R-squared:  0.2803 
F-statistic: 174.3 on 11 and 4886 DF,  p-value: < 2.2e-16

Wine Quality App: User Interface

The interface contains sliders where different values for each predictor can be used.

There are also tabs with instructions, model output and the dataset.

User Interface