# Correlation Matrix (Constituents)

[This article was first published on

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

**NIR-Quimiometría**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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,….

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 about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.