It is important to understand as better as possible our sample set before to develop the regression. Continuing with the “Y” matrix (constituent’s matrix) we have to observe the correlation matrix.

In the **R Graph Gallery**, we can get the code to draw a nice Correlation Matrix Plot, with the X-Y plots and the Pearson correlation values, apart from some more details.
I used the demo sample set. If we use the NA values, this code does not give correlation values for the constituents with NA values. If we have “0” indeed NA, correlation values are nor well calculated because the “0” values, so until we can modify this code, I deleted the two samples with “0” values, so we calculate the Correlation Matrix with 64 samples.

It is obvious the high inverse correlation between DM (Dry Matter) and Moisture (Moisture = 100-DM).

This sample set is of fish meal and where the protein content is very important. The way to control the protein is to add or ash, that is the reason for the high negative correlation.

All the conclusions we can get for this plot are important to study latter the loadings, regression coefficients,….

*Related*

To

**leave a comment** for the author, please follow the link and comment on their blog:

** NIR-Quimiometría**.

R-bloggers.com offers

**daily e-mail updates** about

R news and

tutorials on topics such as:

Data science,

Big Data, R jobs, visualization (

ggplot2,

Boxplots,

maps,

animation), programming (

RStudio,

Sweave,

LaTeX,

SQL,

Eclipse,

git,

hadoop,

Web Scraping) statistics (

regression,

PCA,

time series,

trading) and more...

If you got this far, why not

__subscribe for updates__ from the site? Choose your flavor:

e-mail,

twitter,

RSS, or

facebook...

**Tags:** "R" Chemometrics