Import the red wine data set into your R system

R code:

install.packages(“here”)

library(here)

library(readr)

redwine_data <- read.table (‘C:/Users/Shyamsunder Mothe/Desktop/Stat_Methods/wine+quality/winequality-red.csv’, sep = ‘;’, header = TRUE)

redwine_data

Study each of the variables

a. What is the sample size?

R code:

str (redwine_data)

dim(redwine_data)

summary(redwine_data)

Sample size: Red wine data is data frame having 1599 observations and 12 Variables

Any outliers? Do you have any concerns about the data quality?

sum (is.na(redwine_data))

#There are no missing values in the data set

How can you summarize the data of each variable in a concise way?

What statistics are you going to present?

R Code:

summary(redwine_data)

fixed.acidity volatile.acidity citric.acid residual.sugar
Min. : 4.60 Min. :0.1200 Min. :0.000 Min. : 0.900
1st Qu.: 7.10 1st Qu.:0.3900 1st Qu.:0.090 1st Qu.: 1.900
Median : 7.90 Median :0.5200 Median :0.260 Median : 2.200
Mean : 8.32 Mean :0.5278 Mean :0.271 Mean : 2.539
3rd Qu.: 9.20 3rd Qu.:0.6400 3rd Qu.:0.420 3rd Qu.: 2.600
Max. :15.90 Max. :1.5800 Max. :1.000 Max. :15.500
chlorides free.sulfur.dioxide total.sulfur.dioxide density
Min. :0.01200 Min. : 1.00 Min. : 6.00 Min. :0.9901
1st Qu.:0.07000 1st Qu.: 7.00 1st Qu.: 22.00 1st Qu.:0.9956
Median :0.07900 Median :14.00 Median : 38.00 Median :0.9968
Mean :0.08747 Mean :15.87 Mean : 46.47 Mean :0.9967
3rd Qu.:0.09000 3rd Qu.:21.00 3rd Qu.: 62.00 3rd Qu.:0.9978
Max. :0.61100 Max. :72.00 Max. :289.00 Max. :1.0037
pH sulphates alcohol quality
Min. :2.740 Min. :0.3300 Min. : 8.40 Min. :3.000
1st Qu.:3.210 1st Qu.:0.5500 1st Qu.: 9.50 1st Qu.:5.000
Median :3.310 Median :0.6200 Median :10.20 Median :6.000
Mean :3.311 Mean :0.6581 Mean :10.42 Mean :5.636
3rd Qu.:3.400 3rd Qu.:0.7300 3rd Qu.:11.10 3rd Qu.:6.000
Max. :4.010 Max. :2.0000 Max. :14.90 Max. :8.000

# How can you visualize the distribution of each variable?

# R Code

hist(redwine_data$fixed.acidity)

boxplot(redwine_data$fixed.acidity)

hist(redwine_data$volatile.acidity)

boxplot(redwine_data$volatile.acidity)

hist(redwine_data$citric.acid)

boxplot(redwine_data$citric.acid)

hist(redwine_data$residual.sugar)

boxplot(redwine_data$residual.sugar)

hist(redwine_data$chlorides)

boxplot(redwine_data$chlorides)

hist(redwine_data$free.sulfur.dioxide)

boxplot(redwine_data$free.sulfur.dioxide)

hist(redwine_data$total.sulfur.dioxide)

boxplot(redwine_data$total.sulfur.dioxide)

hist(redwine_data$density)

boxplot(redwine_data$density)

hist(redwine_data$pH)

boxplot(redwine_data$pH)

hist(redwine_data$sulphates)

boxplot(redwine_data$sulphates)

hist(redwine_data$alcohol)

boxplot(redwine_data$alcohol)

hist(redwine_data$quality)

boxplot(redwine_data$quality)

Distribution of fixed.acidity:

Distribution of volatile acidity:

Distribution of citric.acid :

Distribution of residual Sugar:

Distribution of chlorides:

Distribution of free.sulfur.dioxide:

Distribution of total.sulfur.dioxide:

Distribution of density:

Distribution of pH:

Distribution of sulphates:

Distribution of alcohol:

Distribution of quality: