DATA 624 Homework 3

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. The data can be accessed via:

a). Using visualizations, explore the predictor variables to understand their distributions as well as the relationships between predictors.

The variables differ quite a bit. Some are more normally distributed (e.g., Na, Al) while others do not look normal at all (e.g., Ba, Fe, K)

There are high concentrations of silica (Si), sodium (Na) and Calcium (Ca)

### Relationships between the Variables Most of the correlations are negative which makes sense because if there is more of one element than that leaves less room for the other elements in the glass compound.

There are some strong positive relationships (i.e., Rl and Ca, Al and Ba) as well as some strong negative relationships (i.e., Rl and Si, Rl and Al, Mg and Ba).

The strong relationships mose likely just represent elements that are commonly found together or are commonly bonded to one another. One example of this aluminum and Potassium which are commonly found together.

Calcium also has a high correlation with the refractive index meaning that more calcium casuses more light to be able to travel through glass perhaps.

b). Do there appear to be any outliers in the data? Are any predictors skewed?

Yes, there are outliers in the data. The histograms show that K, Fe and Ba variable contains lots of zeros having their graphs highly skewed to the right. “K” has a very obvious outlier with a value of 6. “Ba” also has outliers at above 2.0 and “Fe” has an outlier above 0.5. Most of the variables including RI, NA, AI, SI, CA have peaks in the center of the distribution. They appear to be more normally distributed. One exception is Mg, which has a trough in the center, but peaks on both ends. Lots of outliers in variable Ri, Al, Ca, Ba, Fe. The correlation table tell us that most of the variables are not related to each other, except the pair between RI and Ca, the correlation coefficient appear to be 0.7, which is moderately strong.

Distribution of the amount of different Elements across the different Types of Glass

This can give you a sense of the variability of elements and also the prescence of outliers

## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout

c Are there any relevant transformations of one or more predictors that might improve the classification model?

Yes, transformations like a log or a Box Cox could help improve the classification model. Removing skew is removing outliers that improves a model’s performance. Also, centering and scaling can be important for all variables with any model. Checking if there are any missing values in any columns that can cause a delay or miscalculate or need to addressed by imputation/removal/or other means.

3.2

The soybean data can also be found at the UC Irvine Machine Learning Repository. Data were collected to predict disease in 683 soybeans. The 35 predictors are mostly categorical and include information on the environemental conditions (e.g. temperature, precipitation) and plant conditions (e.g., left spots, mold growth). The outcome labels consist of 19 distinct classes. The data can be loaded via:

a). Investigate the frequency distributions for the categorical predictors. Are any of the distributions degenerate in the ways discussed earlier in this chapter?

There are a few degenerate and that is due to the low frequencies. Most important once are mycelium and sclerotia. The Smoothed Density Scatterplot for the variables shows one color across the chart. The variables leaf.mild and int.discolor appear to show near-zero variance.

c). Develop a strategy for handling missing data, either by eliminating predictors or imputation

Relatively simple strategy and not always the best strategy but removing observations that have any missing values is one way to approach the problem

2020-03-01