Time series forecasting | MATLAB implements ARMA autoregressive moving average model time series forecasting
Table of contents
Prediction effect
basic introduction
MATLAB implements ARMA time series forecasting (complete source code and data)
This program implements arma time series forecasting based on MATLAB's armax function;
realizes model trend analysis, sequence stabilization, AIC criterion model parameter identification and order determination, forecast results and error analysis process , the logic is clear.
The data is a data set of 144 months, and the cycle is one year. Finally, the prediction of historical data and the forecast of data for the next two years are realized!
Time series prediction based on the autoregressive moving average model.
The evaluation indicators include: MAE, RMSE and MAPE, etc. The code quality is extremely high, and it is convenient to learn and replace data. Requires version 2018 and above.
programming
- Complete program and data download method: MATLAB implements ARMA time series forecasting .
%% 参数设置
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';
%--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
References
[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