时序预测 | MATLAB实现ARMA自回归移动平均模型时间序列预测
目录
- 时序预测 | MATLAB实现ARMA自回归移动平均模型时间序列预测
- 预测效果
- 基本介绍
- 程序设计
- 参考资料
预测效果
基本介绍
MATLAB实现ARMA时间序列预测(完整源码和数据)
本程序基于MATLAB的armax函数实现arma时间序列预测;
实现了模型趋势分析、序列平稳化、AIC准则模型参数识别与定阶、预测结果与误差分析过程,逻辑清晰。
数据为144个月的数据集,周期为一年,最终实现历史数据的预测和未来两年数据的预报!
基于自回归移动平均模型时间序列预测.
评价指标包括:MAE、RMSE和MAPE等,代码质量极高,方便学习和替换数据。要求2018版本及以上。
程序设计
- 完整程序和数据下载方式:MATLAB实现ARMA时间序列预测。
%% 参数设置
model_arima = arima(p_arima, d_arima, q_arima);
fit_arima = estimate(model_arima, trainData);
forecast_arima = forecast(fit_arima, numel(testData));
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% 计算模型拟合优度
fit_ar_test = 1 - sum((testData - forecast_ar).^2) / sum((testData - mean(testData)).^2);
fit_arma_test = 1 - sum((testData - forecast_arma).^2) / sum((testData - mean(testData)).^2);
fit_arima_test = 1 - sum((testData - forecast_arima).^2) / sum((testData - mean(testData)).^2);
————————————————
版权声明:本文为CSDN博主「机器学习之心」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/kjm13182345320/article/details/132632834
%--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[S,Q] = size(T);
% Randomly Generate the Input Weight Matrix
IW = rand(N,R) * 2 - 1;
% Randomly Generate the Bias Matrix
B = rand(N,1);
%--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
BiasMatrix = repmat(B,1,Q);
% Calculate the Layer Output Matrix H
tempH = IW * P + BiasMatrix;
%--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
switch TF
case 'sig'
H = 1 ./ (1 + exp(-tempH));
case 'sin'
H = sin(tempH);
case 'hardlim'
H = hardlim(tempH);
end
% Calculate the Output Weight Matrix
LW = pinv(H') * T';
%--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
参考资料
[1] https://blog.csdn.net/article/details/126072792?spm=1001.2014.3001.5502
[2] https://blog.csdn.net/article/details/126044265?spm=1001.2014.3001.5502