Univariate Plots Section

In this dataset quality feature will play crucial role in analysis.I want know which dataset features will effect the quality of redwine and I want to investigate what features are required to get best quality redwine .This dataset consists of 13 variables and 1599 observations/wines, so I hope there is much to be learned.

## [1] 1599   13
## 'data.frame':    1599 obs. of  13 variables:
##  $ X                   : int  1 2 3 4 5 6 7 8 9 10 ...
##  $ fixed.acidity       : num  7.4 7.8 7.8 11.2 7.4 7.4 7.9 7.3 7.8 7.5 ...
##  $ volatile.acidity    : num  0.7 0.88 0.76 0.28 0.7 0.66 0.6 0.65 0.58 0.5 ...
##  $ citric.acid         : num  0 0 0.04 0.56 0 0 0.06 0 0.02 0.36 ...
##  $ residual.sugar      : num  1.9 2.6 2.3 1.9 1.9 1.8 1.6 1.2 2 6.1 ...
##  $ chlorides           : num  0.076 0.098 0.092 0.075 0.076 0.075 0.069 0.065 0.073 0.071 ...
##  $ free.sulfur.dioxide : num  11 25 15 17 11 13 15 15 9 17 ...
##  $ total.sulfur.dioxide: num  34 67 54 60 34 40 59 21 18 102 ...
##  $ density             : num  0.998 0.997 0.997 0.998 0.998 ...
##  $ pH                  : num  3.51 3.2 3.26 3.16 3.51 3.51 3.3 3.39 3.36 3.35 ...
##  $ sulphates           : num  0.56 0.68 0.65 0.58 0.56 0.56 0.46 0.47 0.57 0.8 ...
##  $ alcohol             : num  9.4 9.8 9.8 9.8 9.4 9.4 9.4 10 9.5 10.5 ...
##  $ quality             : int  5 5 5 6 5 5 5 7 7 5 ...
##        X          fixed.acidity   volatile.acidity  citric.acid   
##  Min.   :   1.0   Min.   : 4.60   Min.   :0.1200   Min.   :0.000  
##  1st Qu.: 400.5   1st Qu.: 7.10   1st Qu.:0.3900   1st Qu.:0.090  
##  Median : 800.0   Median : 7.90   Median :0.5200   Median :0.260  
##  Mean   : 800.0   Mean   : 8.32   Mean   :0.5278   Mean   :0.271  
##  3rd Qu.:1199.5   3rd Qu.: 9.20   3rd Qu.:0.6400   3rd Qu.:0.420  
##  Max.   :1599.0   Max.   :15.90   Max.   :1.5800   Max.   :1.000  
##  residual.sugar     chlorides       free.sulfur.dioxide
##  Min.   : 0.900   Min.   :0.01200   Min.   : 1.00      
##  1st Qu.: 1.900   1st Qu.:0.07000   1st Qu.: 7.00      
##  Median : 2.200   Median :0.07900   Median :14.00      
##  Mean   : 2.539   Mean   :0.08747   Mean   :15.87      
##  3rd Qu.: 2.600   3rd Qu.:0.09000   3rd Qu.:21.00      
##  Max.   :15.500   Max.   :0.61100   Max.   :72.00      
##  total.sulfur.dioxide    density             pH          sulphates     
##  Min.   :  6.00       Min.   :0.9901   Min.   :2.740   Min.   :0.3300  
##  1st Qu.: 22.00       1st Qu.:0.9956   1st Qu.:3.210   1st Qu.:0.5500  
##  Median : 38.00       Median :0.9968   Median :3.310   Median :0.6200  
##  Mean   : 46.47       Mean   :0.9967   Mean   :3.311   Mean   :0.6581  
##  3rd Qu.: 62.00       3rd Qu.:0.9978   3rd Qu.:3.400   3rd Qu.:0.7300  
##  Max.   :289.00       Max.   :1.0037   Max.   :4.010   Max.   :2.0000  
##     alcohol         quality     
##  Min.   : 8.40   Min.   :3.000  
##  1st Qu.: 9.50   1st Qu.:5.000  
##  Median :10.20   Median :6.000  
##  Mean   :10.42   Mean   :5.636  
##  3rd Qu.:11.10   3rd Qu.:6.000  
##  Max.   :14.90   Max.   :8.000

nonfree.sulfur.dioxide is having slightly higher values than the free sulfur dioxide and the Total sulfur dioxide seems to be more smoothed along the values.

The free-sulfur-dioxide showed a peak value at 6 or 7. The shape of histogram suggests that the free-sulfur-dioxide count drops gradually along with the increase of free sulfur dioxide. It is having long tail with few outliers.

The fixed acidity peaks between 6-8. The plot seems like to be multimodal with is having local peak values between (8-14), and at around 14-16 it is having outliners. A frequency histogram has been plotted.

The volatile.acidity histogram shows two peaks around 0.4 and 0.6. The value table shows the peak is at 0.6. It is having outliers if the value is greater than 1.2.

The histogram shows high peak when citric acid is 0. A further check on the values shows that there are 160 samples with zero citric acid. Except very few outliner, all of the citric acid values are from 0 to 0.79.

The histogram of residual sugar peaks at around 2.5 with very long tail and it is having outliers after 9 .So used log_10 transformation and removed outliers if they are greater than 3.5 deviations away from median

The chlorides histogram is very similar to the residual-sugar one, a highly skew distribution with long tail. A logarithm transformation shows a nearly normal distribution.So used log_10 transformation and removed outliers if they are greater than 3.5 deviations away from median

The peak value is at 16-18. It also has a long tail with some outliers.

The pH plot isa normal distribution, with a peak at around 3.3.

The sulphates plot has some outliers. The peak is at around 0.6.

Univariate Plots Analysis

What is the structure of your dataset?

There are 1599 wines in the dataset with 10 features (fixed acidity, volatile acidity, citric acid, residual sugar, chlorides, free sulfur dioxide, total sulfer dioxide, density, pH, sulphates, alcohol, quality).

Main points of interest so far: * 83% of the wines are rated either a 5 or 6. * Alcohol plays a key role in quality of wine * Most wines have an alcohol content of less than 11%. * small binomial distribution features + Free sulfur dioxide + volatile + total acidity * normally distributed features + pH + density * outliers outliers more than 9 standard deviations from medians. + Residual sugar + chlorides + sulphates + bound + total sulfur dioxide

What are the main feature(s) of interest in your dataset?

Quality is main feature in the dataset. I want to analyse which of the other features contribute most in order to get best quality of the wine.

What other features in the dataset do you think will help support your investigation into your feature(s) of interest?

I expect few features like alcohol, pH, residual sugar, and total acidity will contribute most to the quality of the wine.

Did you create any new variables from existing variables in the dataset?

I created bound sulfur dioxide (total sulfur dioxide - free sulfur dioxide).

Of the features you investigated, were there any unusual distributions? Did you perform any operations on the data to tidy, adjust, or change the form of the data? If so, why did you do this?

I was a little surprised to find that so many of the wines rated either a 5 or 6. This could make it more difficult to determine what makes a good wine, as there is less data about them. Having more data about lesser wines would have also been useful to provide a better contrast between bad and good wines.I also expected to see more of the wines having an alcohol content higher than 11%.I was surprised by some of the extreme outliers.

Bivariate Plots Section

It is obvious that the median of the volatile acidity tends to decrease as the quality increases. The difference of volatile acidity between quality 7 and 8 is not obvious. Overall, it aligns with the description of volatile acidity, that high level of it can lead to unpleasant, vinegar taste.

The citric acid boxplot looks interesting. Although the correlation coefficient between citric acid and quality is only about 0.23, the boxplot does show an interesting pattern. The median of citric acid tends to increase as the wine quality increases. The medians for quality 3 and 4 are almost to each other, same as quality 5/6 and 7/8.

From the boxplot,The median of sulphates increases with the quality of samples. However, I cannot deduce that it is a meaningful correlation because there are many outliers.I think even sulphates may affect the quality.

The boxplot shows that high quality wine tends to have higher alcohol value. The median of alcohol shows an upward trend, except for the samples of quality 5. I can see that quality 5 has more outliers than other samples,I think there are more sampling errors for those samples of quality 5.

Most of the other features do not show an obvious correlation with quality, except density and pH features.

Removed outliers of residual.sugar and chlorides to get better output

It is found that wine with good quality (7 and 8) have lower density and pH median values than other quality.

From the correlation matrix and corplot, I can see the following strong correlations for non-quality variables:

Fixed acidity vs citric acid (0.67) Volatile acidity vs citric acid (-0.55) Fixed acidity vs density (0.67) Fixed acidity vs pH (-0.68) Citric acid vs pH (0.67) Free sulfur dioxide vs total sulfur dioxide (0.67)

Bivariate Analysis

Talk about some of the relationships you observed in this part of the investigation. #How did the feature(s) of interest vary with other features in the dataset?

Quality strongly correlates with alcohol (0.48), volatile acidity (-0.39), sulphates (0.25) and citric acid (0.23).

  • The quality seems to have a positive correlation with sulphates(But outliners at quality 5 are effecting the sulphates)
  • Good Quality
  • Good quality (7 or 8) wine tends to have more than 0.25 g/dm^3 citric acid.
  • Good quality wine tends to have low density and pH value.
  • Higher citric acid value tends to give better wine quality
  • Good quality wine tends to have higher alcohol value.
  • Good quality wine tends to have lower volatile acidity.
  • Bad Quality
  • Bad quality (3 or 4) wine tends to have little or zero citric acid.
  • bad quality wine tends to have high volatile acidity.
  • Average quality
  • Average quality (5 or 6) wine tends to have roughly 0.25 g/dm^3 citric acid.
  • The correlation between fixed acidity, volatile acidity and citric acid is interesting.

What was the strongest relationship you found?

1)The quality variable has the strongest relationship with the alcohol variable. 2)From the boxplot,we are able to know that good quality wine has higher value of alcohol.

Multivariate Plots Section

I thought it would be a good idea to begin the multivariante analysis with alcohol and volatile acidity as they have the highest correlation with quality. As expected, wine is of better quality when there is more alcohol and less volatile acidity. Since alcohol and volatile acidity is having highest correlation with quality I am performing multivariant analysis with facetwrap and greidextra

Sulphates and citric acid are the next two most correlated variables with quality. This plot is not quite a clear as the previous one. It appears that wine improves in quality with more sulphates, but it is difficult to see any trend with citric acid.

Chlorides and density haveing correlations very less with quality. It appears that wine is best when it is having fewer chlorides.

pH has the weakest correlation with quality, and I chose citric acid as it has the highest correlation with pH,and their is a bit of a ‘frontier’ for making good wine, which is when more pH and citric acid is used.

I chose these two variables as they are having least correlated with each other. This seems to be a rather good decision as quality looks to be highest when volatile acidity,density are lower.

Following the my previous idea, I chose the next two variables with the lowest correlation. This looks to be another good plot as wine increases in quality with more alcohol and sulphates.

Multivariate Analysis

Talk about some of the relationships you observed in this part of the investigation. Were there features that strengthened each other in terms of looking at your feature(s) of interest?

  • The combination of alcohol and volatile acidity is very importatnt. Although it was somewhat expected as they have the two highest correlations with quality, there was a rather clear relationship between more alcohol, less volatile acidity, and a better wine.

  • ph & citric acid, density & volatile acidity, sulphates & alcohol, alcohol & density, and alcohol & chlorides, all seem to have a ‘frontier’ for the combination that makes the best wine.

  • Sulphates & chlorides and alcohol & chlorides have very small quality-8 lines.

Were there any interesting or surprising interactions between features?

  • There is a quality-4 wine that is an outlier for sulphates, citric acid, chlorides, and pH. Although this wine is rather unique, it is unfortunately not very good.

  • It was neat to see that more chlorides coincided with less alochol, and lower quality of wine.

  • Despite alcohol & density, and alcohol & chlorides being good indicators for what makes good wine, density & chlorides as not nearly as clear.

Final Plots and Summary

Plot One

Description One

To find which chemical properties influence the quality of red wine.I chose to display a scatterplot of alcohol content vs wine quality, as the alcohol level is the property that correlates highest with quality, with r = 0.47. We can see that very bad wines (rated 3) have a mean alcohol content of approximately 10% whereas very good wines (rated 8) have an alcohol content of approximately 12%.

Plot Two

Description Two

Quality and the three most influential variables plot. Wines of quality five or six are not displayed in order to avoid excessive clutter.

In the above graph x-axis is alcohol content,y-axis is citric acid content and the jitter point size is based on volatile acidity value and quality value for discrete color

  • The plots are showing that the high quality wines tend to have a favor low volatile acidity and high citric acid and alcohol and vice versa for low quality wines.
  • The plot shows that the different colors and sizes are not completely separated, which indicates that no combination of these three features can fully explain quality, which is expected

  • The plot suggests that very high values of acetic acid almost always prevents a wine from achieving a high quality rating
  • There are a few highly rated wines with very low alcohol and citric acid content, but none with very high volatile acidity.

Plot 3

Description Three

This is the most telling graph.I created a new feature called rating and I subsetted the data to remove the ‘average’ wines(quality -5 or 6). As the correlation tests show, wine quality was affected most strongly by alcohol and volaticle acidity. While the boundaries are not as clear cut or modal, it’s apparent that high volatile acidity–with few exceptions–kept wine quality down. A combination of high alcohol content and low volatile acidity produced better wines.

Reflection

*I think one future work for this dataset would be to apply some inferential statistics to strengthen the findings. For example, to setup hypothesis testing to verify the relationship between some variables and the quality (e.g. the citric acid ratio).