使用Gnuplot进行时间序列的线性回归 [英] Linear regression for time series with Gnuplot
问题描述
我是Gnuplot的忠实拥护者,在整个学业中都将其用于各种项目.
I am a big fan of Gnuplot and I used it all along my studies for various projects.
最近我想使用Gnuplot绘制一些时间序列图,例如减肥,锻炼结果,耗油量等.
Lately I wanted to use Gnuplot to chart some time series like weight loss, exercising results, gas consumptions etc.
因此,我像
set xdata time
set timefmt "%d.%m %Y"
set format x "%d.%m"
现在,我想使用拟合函数使我线性拟合.我的问题是,如果x轴与时间相关,我将无法正常工作.
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.
推荐答案
然后将日期更改为数字,例如从第一个日期开始的天数,进行拟合,然后将数字再次转换回日期. 这样,您将获得常规" x和y数据集.
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.
这篇关于使用Gnuplot进行时间序列的线性回归的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!