### Exercise KJ 3.1

The UC Irvine Machine Learning Repository6 contains a data set related to glass identification. The data consist of 214 glass samples labeled as one of seven class categories. There are nine predictors, including the refractive index and percentages of eight elements: Na, Mg, Al, Si, K, Ca, Ba, and Fe.

``````data(Glass)
str(Glass)``````
``````## 'data.frame':    214 obs. of  10 variables:
##  \$ RI  : num  1.52 1.52 1.52 1.52 1.52 ...
##  \$ Na  : num  13.6 13.9 13.5 13.2 13.3 ...
##  \$ Mg  : num  4.49 3.6 3.55 3.69 3.62 3.61 3.6 3.61 3.58 3.6 ...
##  \$ Al  : num  1.1 1.36 1.54 1.29 1.24 1.62 1.14 1.05 1.37 1.36 ...
##  \$ Si  : num  71.8 72.7 73 72.6 73.1 ...
##  \$ K   : num  0.06 0.48 0.39 0.57 0.55 0.64 0.58 0.57 0.56 0.57 ...
##  \$ Ca  : num  8.75 7.83 7.78 8.22 8.07 8.07 8.17 8.24 8.3 8.4 ...
##  \$ Ba  : num  0 0 0 0 0 0 0 0 0 0 ...
##  \$ Fe  : num  0 0 0 0 0 0.26 0 0 0 0.11 ...
##  \$ Type: Factor w/ 6 levels "1","2","3","5",..: 1 1 1 1 1 1 1 1 1 1 ...``````
##### (a) Using visualizations, explore the predictor variables to understand their distributions as well as the relationships between predictors.
###### Histograms
``````par(mfrow = c(3, 3))
for (col in 2:ncol(Glass)-1) {
hist(Glass[,col], main = colnames(Glass[col]))
}``````

From the histograms, we can see that the following predictors have normal distribution: RI, Na, Al and Si. The following predictors do not have normal distributions: Mg, K, Ca, Ba, Fe.

###### Corrplots
``````c <- cor(Glass[2:ncol(Glass)-1])
corrplot(c)``````