This is the second derivative spectra of the raw spectra we have sawn in the post: "Hierarchical Cluster Analysis (ChemoSpec) - 01". In that post we saw some clusters, but the distance between the clusters was not high, so it was clear that some math treatment should be applied to remove baseline shifts and to increase the differences between the clusters as much as possible.
Well, let’s see now the HCA in this case:
Well, now it looks much better, Olive samples in one cluster, and sunflower oil samples in another. We can see also two sub-cluster in the sunflower samples. Looking to the spectra we can see some reasons for that more clearly now. That will be treated in the next post.
Could you please explain the math treatment that was done since the results are much much better
ResponderEliminarexcellent work
I convert the raw spectra to second derivative using a Chemometric software called Win Isi, but you can use others like Unscrambler,...., after that these softwares can export the spectrum to a TXT file son I can import it into R.
ResponderEliminarThese softwares calculate the derivative based in the segment-Gap concept. Gap is always cero and I used a segment of 10. You can go to the labes "derivadas", where I explain this concept, in spanish (I,ll translate these post in a near future), but there are some drawings which can help. Of course could be possible to develop a function in R to do the same.
Probably you will get the same results using the SG filters in R where you can configure them for first,second derivative, third.....
In R, you can use the function sgolayfilt() in package signal to get the derivatives. If you are using ChemoSpec, the spectral data is in SpectraObject$data, so you can make a copy of SpectraObject and then replace the $data with the derivatives, then work from there. For the first derivative you would use something like SpectraObject$data <- sgolayfilt(SpectraObject$data, m = 1) but as $data is a matrix, you would have to use a plyr or apply method to "loop" over each row of the matrix.
ResponderEliminarThanks JR!
Thanks to you Bryan for reading these posts and give to us good advices to know better your package and R in general. I will practice with the points you say.
EliminarI'm glad you made the post about using derivatives with HCA, as I had not really thought about that much but I think I have some data sets where I can use that idea.
EliminarThank you very much for these answers, It is really intersting
ResponderEliminar