I would like to compare two absorption spectra ( or interferograms) and conclude whether between these two there are statistically significant differences at particular wavelength intervals. At the moment, I have data of two experiments that look like this:

    # A tibble: 6 x 5
      t     x1     y1     x2     y2
  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>
1 3999. 0.0124 0.0132 0.0122 0.0113
2 3998. 0.0125 0.0130 0.0122 0.0116
3 3997. 0.0122 0.0131 0.0122 0.0113
4 3996. 0.0121 0.0136 0.0122 0.0114
5 3995. 0.0124 0.0139 0.0122 0.0122
6 3994. 0.0125 0.0141 0.0122 0.0129

The first column represents the wavenumber, the x columns represent the absorbance of sample and the y columns represent the absorbance of irradiated sample ( before and after). I was wondering whether I could compare these data ( x and y) as time series and if so, what could be the method to quantify the differences, if any, between the samples before and after irradiation. Maybe it's already been done and there is somewhere some information as to how to compare the spectra if the wavenumber is interpreted as time ( x axis). I did the t test in R and in both experiments the null hypothesis could not be rejected, although for the second experiment (x2, y2) the p value was much lower than for the first. If I average the x and y, and then plot both data, I see that there are visible differences at certain wavelength intervals. In R, I used IRISSeismic package and function crossSpectrum, that gave me such an output:

   freq        spec1        spec2 coh        phase             Pxx             Pyy
1   0.0002666667 2.121935e+01 2.152532e+01   1  0.010220252 1.856693e+01+0i 1.883465e+01+0i
2   0.0005333333 7.011069e+00 6.869078e+00   1  0.008984730 6.134686e+00+0i 6.010443e+00+0i
3   0.0008000000 8.385363e+00 8.197039e+00   1  0.011999039 7.337193e+00+0i 7.172409e+00+0i
4   0.0010666667 7.483070e+00 7.272319e+00   1  0.015419031 6.547686e+00+0i 6.363279e+00+0i
5   0.0013333333 4.086251e+00 3.899095e+00   1  0.017551350 3.575469e+00+0i 3.411708e+00+0i
6   0.0016000000 1.537709e+00 1.405562e+00   1  0.008722742 1.345496e+00+0i 1.229867e+00+0i

For all data points the coh index is given as 1. But obviously that doesn't help me to determine, whether the difference is substantial between two data sets. I tried to average data points between groups (x1, y1 and x2, y2) at each wave number and plotted the graph, it looks like the difference might be significant at certain wavenumber interval. Maybe I could try to express one line ( averaged data points after irradiation of the sample) as a function of the other? But how?

Here is a project with similar experiments: https://www.scielo.br/scielo.php?script=sci_arttext&pid=S0103-50532015001202571 , for statistical analysis they use ANOVA and Tukey's test, but how do I do it for the vectored data?

I cannot find online anything. Here is something of the sort I am looking for: https://www.youtube.com/watch?v=gjKSfILE9nM He compares two spectra in Matlab, but he is using self made toolkit which I can not obtain. How can I do something like this in R? I've read something about modelling the data, but here, I don't have any variables just data of two spectra.

  • $\begingroup$ The first thing to do is to know how these measurements are reproducible. If you repeat the first measurement of $\ce{x_1}$ , do you always get $0.0124$ ? This absorbance is extremely weak. Or do you obtain from time to time $0.0122$, then $0.0125$ and $0.0127$ or $ 0.0123$ ? Are these measured values reliable ? Maybe the six first measurements of $\ce{x_1}$ and $\ce{x_2}$ are all equal. Who knows ? $\endgroup$
    – Maurice
    Aug 12, 2020 at 16:57
  • $\begingroup$ @Maurice There are intervals that have much larger absorbances. I guess, we could assume that the x2 outputs would be the second given measurement of the same control sample. So, in that case can we produce estimated line for both x and y and then graph error areas to see, whether they overlap? In that case we only have two data points to estimate the approximate point, I guess that's too small. But even so, is this method even legitimate? $\endgroup$
    – user
    Aug 12, 2020 at 18:01
  • $\begingroup$ @ User. How were the wavelengths chosen ? Why stop at 3994 ? This is the first time and the only time where an effect can be accepted. Why didn't you not measure at 3993, 3992, then 3980, 3950 ? What is the unit of these wavelengths ? Is it in visible, UV, IR ? $\endgroup$
    – Maurice
    Aug 12, 2020 at 18:51
  • $\begingroup$ @Maurice Sorry, that I didn't clarify. It's only beginning of the spectra. The spectra is taken from 4000 - 400 cm^-1 . I just put the first few rows, it's IR. The measurements are taken per each wavenumber approximately, the difference between each measurement ~ 0.964 $\endgroup$
    – user
    Aug 12, 2020 at 19:02
  • 3
    $\begingroup$ Does this answer your question? Methods used to compare two spectra in order to determine the effects of irradiation of sample $\endgroup$
    – Buttonwood
    Aug 13, 2020 at 14:53

1 Answer 1


Why don't you start with the simplest possible approach. I am sure there are very fancy spectral matching statistical algorithms, but simplicity has its own beauty. Comparing an inteferogram (not many features there) might be difficult but what about absorbance rather?

Look at the absorbance difference spectrum: (Spectrum after irradiation)-(Original sample spectrum). How does the plot look like? What is the signal which you are collecting? Sometimes the human eye can save a lot of time rather than doing significance testing on data points and forming null hypotheses.

The features which remain the same will be zero now and the features which change will be visible in the the difference spectrum.

Alternatively, you can take the first derivative of both spectra and smooth it with Savitsky-Golay or study the difference of "first derivatives". Noise will be an issue but I guess you can take care of that.

  • $\begingroup$ After I have smoothed out both derived spectra, what are the methods to compare for significant differences? $\endgroup$
    – user
    Aug 17, 2020 at 16:21
  • 1
    $\begingroup$ Could share the pictures of the simple absorbance spectrum and the derivative subtracted spectrum. $\endgroup$
    – AChem
    Aug 17, 2020 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.