Linear regression for time series with Gnuplot

感情迁移 提交于 2019-12-08 18:48:20

问题


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.


回答1:


R is probably a better tool for this kind of problem. It is one of most popular languages for data analysis. Plotting is as simple (or simpler) as in gnu plot.




回答2:


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.




回答3:


You could use another tool to calculate the regression function and plot the output of that. Some possibilities are: R, |stat or the statistical functions of various spreadsheets. This link has a list of free statistics software.




回答4:


Another good alternative to gnuplot is matplotlib. It's a set of Python libraries for reading, manipulating, and graphing points. They have a nice cookbook at scipy.org, and here's the entry for linear regressions.



来源:https://stackoverflow.com/questions/522731/linear-regression-for-time-series-with-gnuplot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!