How to quantify differences between groups of vectors using linear regression?

I have two groups of spectra, that could be viewed as a vectors with each wn corresponding to the vector's component. I'd like to quantify the difference between these two groups, and I tried to use linear model to express one group of vectored values as a function of the other vector values. So, I used lm function in R, but I don't know if I applied it correctly and how to make sense of it.

Here is the function:

summary(lm(spectra_group1 ~ spectra_group2))

For each vector within a group1 it gives a corresponding output:

I guess, it treats each spectrum as a $$y_i$$, in this instance, but in each spectrum there are over 3000 variables. So, I don't understand how it can reduce all these variables to just one $$y_i$$. Furthermore, in this example, there are several spectrum ( III, IX, XI - XIII) that have p-values significantly low. That would indicate, that they are correlated to the group1$spectrum_x. I would be glad, if someone could assist with ideas how to develop a method to quantify the differences between groups, possibly with some linear model. Thank you in advance. • Ordinarily one views a spectrum as a function (or as its Fourier transform) and employs a functional norm, such as a weighted$L^p\$ norm, to measure how close two spectra may be. The choice of the norm depends on what your spectra mean and why you are comparing them. lm is not going to accomplish any of this for you. Thus, pursuing this question is likely going to be a dead end (or worse, will lead you astray). – whuber Nov 20 at 14:30
• @whuber Ok, but that's just a way to measure a difference between two individual spectrums. But what a statistical method that can estimate the difference between groups? – Gianni D'Adova Nov 20 at 16:22
• Statistics doesn't tell you how to compare spectra: physics does. Given a metric and a model for the variation within a spectra you will consider as "random" or inconsequential, statistics can help you decide whether to view two spectra as different or not. You need to supply that metric. – whuber Nov 23 at 14:51