Or any other function that could take several pairs as input and output the fitted curve or function in the format you want.
Asked
Active
Viewed 419 times
2 Answers
1
You should check out Commons Math from Apache Commons.
The Statistics package has a Class called SimpleRegression that may be helpful to you.

Matthew J. Geiger
- 23
- 4
-
Good information, but I think `SimpleRegression` is most similar to using `polyfit` to do linear regression in matlab. I think he wants something a little more general (see below). – Joshua Barr May 21 '13 at 16:00
-
Nice suggestion. I have Looked it up and found it is a good package to do linear regression, but is there any package for non-linear regression? – Huayi Guo May 21 '13 at 17:56
-
@Huayi Guo. You can try this code: [Michael Thomas Flanagan's Java Scientific Library](http://www.ee.ucl.ac.uk/~mflanaga/java/Regression.html). It worked well, but could not use because of the license agreement. – Matthew J. Geiger May 21 '13 at 18:14
0
Check out the linear algebra and optimization functionality of the Apache Commons Math library. You probably want something that implements the DecompositionSolver
interface.

Joshua Barr
- 396
- 1
- 5
-
I have skimmed the source. Nice one to do linear fit. Thanks a lot. But have you heard any lib that could do non-linear fit? – Huayi Guo May 21 '13 at 18:32
-
Apache Commons can; see the [optimization](http://commons.apache.org/proper/commons-math/userguide/optimization.html) link I gave above. Unlike the linear algebra stuff, it is not specific to linear least squares. – Joshua Barr May 22 '13 at 05:46
-
It worked. It is exactly what I am seeking for. Thanks a lot for helping @Joshua Barr – Huayi Guo May 22 '13 at 15:57
-
No problem. If it was useful, can you accept one of the answers (Matthew's or mine)? – Joshua Barr May 23 '13 at 07:59