I've collected NIR spectra and need to calculate the shifts in the position of the negative peaks shown in the figure. But this peak is skewed, so I guess I need to fit a skewed normal distribution. Does anyone know how to do it in R? Thanks.
I think that the shape od the down oriented peek is a difference of some relatively slowly varying finction (possibly - a locally good fit is obtainable by a polynomial of reasonably low degree)) AND the pure absorption shape which basically is symmetric. Then the image becomes unsymmetric, unless the background is desribed by a constant. For instance, the function
f(x) = 2 - 0.2 x - 1/(1+x^2)
possesses the most interesting minimum NOT at 0 but at the root of the equation
- 0.2+ 2x/(1+x^2)^2 =0 . i.e near x_0 = 0.102
and the graph of the function looks highly nonsymmetric! In particular, the points of inflection are posed at 1 and -1 thus - unsymmetrically with respect to the minimum.
Therefore I would suggest first tu get rid of the systematic 'noise' which in your case would be a line tangent to two local maxima. Of course, some more sofisticated algorithms are possible, which take into account higher degrees of the noise line. Unfortunately, I am not sufficiently familiar with the R programming language, so my advice stops here:)
Note. There is no non-symmetric normal distribution, since all they are symmetric. And why the normal is preffered at all? The above example of Cauchy density is known as well fitting the resonance lines in electrical circuits and many other physical phenomena.
Thanks very much for your elaborate explanation. I totally agree that a baseline correction (subtracting the tangent line) can get rid of some "noise" and make the signal almost symmetric. Actually, I tried this method and the fitted curve looks fine but not perfect.
I compared both Cauchy and Gaussian distribution. My objective is to find the position ( x value) of the minimum, so I only fitted a small region close to the minimum. It turned out there were no clear differences between two distributions.
If the data are skewed it is not normal. Transforming a skewed data set can make it normal. Could you take the peaks (looking at your distribution) and consider you have a mixture of two or more normals. (hence the shift)