Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linear regression for time series with Gnuplot

I am a big fan of Gnuplot and I used it all along my studies for various projects.

Lately I wanted to use Gnuplot to chart some time series like weight loss, exercising results, gas consumptions etc.

Therefore I scale the x-axis like

set xdata time
set timefmt "%d.%m %Y"
set format x "%d.%m"

Now I want to use the fit-function to give me a linear fit. My problem is, that I cannot get that to work if the x-axis is time-related.

like image 957
Christian Stade-Schuldt Avatar asked Feb 07 '09 00:02

Christian Stade-Schuldt


1 Answers

Then change the date to a number, for example a number of days starting from the first date, make the fit, and then convert the numbers back again into dates. That way you'll have "regular" x and y data set.

like image 55
Rook Avatar answered Sep 25 '22 19:09

Rook