I have a list that has several columns. The leftmost column is my x axis data whilst the rest are various y data sets.
I want to produce linear regressions for each of those columns, but just for a specific range in x, then force the linear regression through 0,0. And finally extract the line slope of said linear regression. Below is an example of some of my data.
x y1 y2 y3 y4
1 2.495 -1e-04 -1e-03 -1e-04 0e+00
2 2.995 -2e-04 -7e-04 -2e-04 0e+00
3 3.495 2e-04 -2e-04 1e-04 2e-04
4 3.995 0e+00 -3e-04 0e+00 1e-04
5 4.495 0e+00 -3e-04 0e+00 0e+00
6 4.995 0e+00 -3e-04 0e+00 1e-04
7 5.495 1e-04 -2e-04 0e+00 1e-04
8 5.995 -1e-04 -1e-04 0e+00 3e-04
9 6.495 1e-04 1e-04 2e-04 3e-04
10 6.995 1e-04 0e+00 0e+00 3e-04
Here for example I would obtain linear regressions for the range in x of for example rows 3 to 10, coercing the regression to intersect 0,0. Finally the slopes from the linear regressions for y1, y2 etc are obtained.
I am aware of the abind and lm functions but have only been able to plot single regressions without coercing a 0,0 intersect. Thanks

lm(y ~ x -1). - paqmo