时间序列分析 [英] time series analysis

查看:96
本文介绍了时间序列分析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,
我想使用时间序列分析来预测未来价值,即模拟器中的能源消耗,但我不知道如何在c ++中做到这一点.任何人都可以指导我或给我一些例子吗?

感谢

Dear all,
I''d like to use time series analysis for predicting a future value i.e. energy consumption in simuator but i don''t know how to do it in c++.Can anyone guide me or give me some example?

thanks

推荐答案

Google 的目的是什么?
起点可以是Wikipedia的时间序列 [
Did you Google for?
A starting point could be Wikipedia''s Time series[^] page.



最好,最快的方法是使用数值软件,例如matlab.
如果您想在C ++中实现它,我建议您使用一些现有的预测库.

您需要预测很多模型,例如自动回归模型(AR,ARX,ARMA,ARMAX,ARIMA等),模糊模型,神经网络模型,支持向量机模型,马尔可夫链等等. .

这只是一个简单的模型:
y(k)+ a1y(k-1)+ a2y(k-2)+ ... + any(kn)= b1u(k)+ b2u(k-1)+ ... + bmu(km)

其中y是您的输出,而u是您的输入. "a"和"b"是系数,您可以通过最小化某些成本函数来计算它们.

这是c ++中用于计算未来值的示例(我没有测试过,可能会有错误)

Hi,
The best and faster way to do this is use a numeric software, like matlab.
if you want to implement it in c++, i advice you to use some existent forecast library.

You have a lot of models to forecast, such as auto regressive models (AR, ARX, ARMA, ARMAX, ARIMA, ...), fuzzy models, neural networks models, support vector machines models, markov chains, and so on...

This is just a simple model:
y(k)+a1y(k-1)+a2y(k-2)+...+any(k-n) = b1u(k)+b2u(k-1)+...+bmu(k-m)

Where y is your output and u is your input. ''a'' and ''b'' are coefficients that you can calculate them by minimizing some cost function.

Here is a example in c++ to calculate the future value (i did not tested it, there may be errors)

double forecast(double *y, double *u, bouble *a, double b)
{
	double future_value = 0.0;
	
	//y to the instant k 
	future_value = b[0]*u[0]+b[1]*u[1]+...+b[m-1]*u[m-1]-a[0]*y[0]+a[1]*y[1]+...+a[n-1]*y[n-1];

	for(int i = 1; i < n; i++)
	{
		y[i] = y[i-1];
	}
	y[0] = future_value ;

	//I assume that the input array is updated before you call this function
}



同样,我建议使用一些数字软件来实现这种算法.

否则,谷歌是最好的开始方式

最好的问候
Filipe Marques



Again, I suggest to use some numerical software that brings such algorithms implemented.

Otherwise, google is the best way to start

Best regards
Filipe Marques


感谢您的所有评论.起初我想使用Matlab,但我的价值来自网络模拟器(ns2).我认为很难链接这两个程序.
thank you for all of your comments.At first i''m thinking to use matlab but my value got from network simulator(ns2).I think it will be tough to link these two program.


这篇关于时间序列分析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆