How to do multiple linear regression in different combination of numbers?
5 views (last 30 days)
Show older comments
Good day everyone! This is what I'm trying to code: I have to analyze several mobility profiles from ion mobility spectrometry experiments. I do that by fitting gaussian curves to several data files I obtained. After the fitting, I get the position of the peaks (in the X-axis) in arrays like this:
a = [a1,a2,a3,...,an]
b = [b1,b2,b3,...,bn] and so on.
What I need is a way to do a linear regression on all the combinations of the numbers in the matrices:
e.g.
reg1 = [a1,b2,c3,...]
reg2 = [a2,b1,c1,...] to obtain the intercept of each one and select only one with the highest R^2 value.
I thought about nesting for loops, but the problem that I encounter is that I can have multiple arrays of data (from 5 to 20) with an unknown number of positions on each array. The linear regressions can have only one number from each array.
Currently I'm not using any toolbox.
Thanks in advance for you help!
5 Comments
Star Strider
on 18 May 2014
Please describe in detail, ideally with data (real or simulated), and what you want to do with it.
It’s quite likely you can do what you want in MATLAB. We can’t help you if you don’t tell us what your data are and what you want to do with them.
I still don’t understand the permutations involved in getting reg1, reg2, and the rest. What’s the pattern? Why?
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!