5

In order to combine 3 different estimators of the same variable I need to implement a multiple regression method in Java (therefore 3 independent variables and 1 dependent variable). I'm looking for a simple method (as simple as a multiple regression method can be). From the search I've done, I think the least squares method should probably be an adequate approach but I would like to know if you suggest any other method. Also I wasn't able to find any good documentation regarding the implementation of the least squares method in a multi-variable context, so I would be grateful if you can point me any good information/source that I can use.

Cleb
  • 25,102
  • 20
  • 116
  • 151
andresp
  • 1,624
  • 19
  • 31
  • least squares is good and proper... but is that a homework? ( http://phoenix.phys.clemson.edu/tutorials/excel/regression.html I think this is the prime source we used) – bestsss May 10 '11 at 21:33
  • no, it's not. Actually it is a feature that I want to add to the estimation of the step length in my thesis (it is related with indoor location games). I have implemented different techniques but none of them is sufficient by itself to correctly estimate the step length so I need to combine them. To do this I need to compute the best weights for each technique which minimize the estimation error. – andresp May 10 '11 at 21:39
  • thanks for the link but that page, as far as I could see, only describes the use of least squares for simple linear regression. – andresp May 10 '11 at 21:55
  • Not sure this is the best board for your question. Perhaps you should try posting this on MathOverflow. – Karthik Ramachandran May 10 '11 at 22:04
  • @andresp, yeah, that's all, not much. wikipedia has some ok articles (and links) on forecasting [ http://en.wikipedia.org/wiki/Forecasting ] but i've assumed you're already familiar with – bestsss May 10 '11 at 22:05

2 Answers2

5

Take a look at this library: http://www.ee.ucl.ac.uk/~mflanaga/java/Regression.html

You will find some source code links in my answer to this question: Weighted Linear Regression in Java

You can read about the math (with a full example) from this handbook from the University of Delaware: http://udel.edu/~mcdonald/statmultreg.html or from the Statsoft textbook: http://www.statsoft.com/textbook/multiple-regression/

Community
  • 1
  • 1
Aleadam
  • 40,203
  • 9
  • 86
  • 108
  • thanks, that was useful. I found the lecture referenced in this answer (http://stackoverflow.com/questions/459480/equations-for-2-variable-linear-regression/459613#459613) interesting too – andresp May 12 '11 at 23:03
0

If you are looking for a really simple method to assign importance weights, you could use the sum of the square of the correlations, although this does not take into account multicollinearity - but a lot easier to program.

Cleb
  • 25,102
  • 20
  • 116
  • 151
Ryan
  • 427
  • 2
  • 15