Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Good Package for Fitting Polynomial Trend Lines

Given a simple data set, I would like to be able to calculate a trending formula given it's a second order polynomial regression.

In fact, it would be great if one could even forecast X periods during calculation (similar to what Excel does).

I'm looking for a portable C/C++ package that's relatively easy to use, and allows it to spit out the "best-fit" (highest R^2 value) curve.

Any suggestions? Thanks!

like image 531
Rev316 Avatar asked Feb 01 '26 04:02

Rev316


1 Answers

The GNU gsl C library can do multiparameter fits. Its interface is of course very C-like, but there are version for many platforms available, including for Windows.

See the quadratic fit example in the gsl documentation for how to implement this for your case.

like image 69
Benjamin Bannier Avatar answered Feb 03 '26 20:02

Benjamin Bannier