Incidence prediction GUI of ARIMA-GRNN model: written based on Matlab (ARIMA part)

       The software first obtains the preliminary forecast value through the classic ARIMA model, generates an absolute error sequence, then inputs the GRNN model to obtain the predicted absolute error value, and finally generates the final forecast value through back calculation.

The first step , the installation of Matlab support plug-in

1. Double-click MCRInstaller.exe to install

2. Automatic decompression:

3. Click next without thinking

4. The installation is complete.

The second step is to build an ARIMA model

1. Build the ARIMA model  and enter the ARIMA model graphical user interface (GUI);

1. Interface introduction

1.1. Data input  Input the raw data for prediction, as shown in the figure below.

1.2. Raw data drawing  Click to pop up the original data curve graph, so as to observe the growth and decline trend and periodicity of the data.

1.3. Actual value input  If it is used to test the prediction accuracy of the model and the data to be predicted is known at this time, then input the data set. If it is used to predict data, the data to be predicted is unknown, and all 0s are input at this time. For example, to predict 6 data, you need to input 6 0s.

1.4. Stationary test and correlogram module

1.4.1. Original data  Click the original data button to display the autocorrelation diagram and partial correlation diagram of the original data in the correlogram module, and display the test results (whether it is stable or not).

1.4.2. General Split  Fill in the number of splits, click the General Split button, and the autocorrelation graph and partial correlation graph of the data after the general split will be displayed in the correlation graph module, and the test result (whether it is stable or not) will be displayed; Split The number of times is the d value.

1.4.2. Seasonal split  Fill in the number of splits, click the seasonal split button, the autocorrelation graph and partial correlation graph of the seasonally split data will be displayed in the correlogram module, and the test result (whether it is stable) will be displayed ; The number of splits is the D value.

1.4.3. General + Seasonal Split  Click the General + Seasonal Split button to display the autocorrelation graph and partial correlation graph of the general and seasonal split data in the correlogram module, and display the test results (whether it is stable or not) .

1.5. Automatic parameter search module

1.5.1.  After Log is checked, the original data will be transformed by Log. This option affects all steps, including stationarity testing, model building, fitting, and forecasting.

1.5.2 To search,  parameters d and D must be manually input, and the period s defaults to 12, which can be modified according to the actual situation. After clicking the Find button, the program automatically searches for the optimal p, q, P, and Q parameters (the values ​​of the four parameters are all from 0 to 3); and outputs the optimal parameter value.

1.6. Prediction module 

1.6.1. Number of predictions (number)  displays the number of data to be predicted, and the program automatically recognizes the number from the actual value input text box and outputs it.

1.6.2. Model parameters  There are 7 parameters in the input model, among which the period s defaults to 12 and can be modified as needed.

1.6.3. Prediction  After clicking the predict button, the AIC value, BIC value, predicted value, and actual value will be output, and the model parameter inspection window will pop up, and the graph of the actual value and the predicted value will be displayed in the graph module, and the prediction will be displayed in the error module Four indicators of error.

1.7. Curve module

1.7.1. Fitting  After clicking the fitting button, the model fitting effect curve will be displayed, and the four indicators of fitting error will be output in the error module, and a window showing the specific fitting value of the model will pop up.

1.7.2. Prediction  After clicking the fitting button, the model fitting effect curve will be displayed, and four indicators of fitting error will be output in the error module.

1.8. Error module

1.8.1. Fitting error  MAE  outputs the mean absolute error predicted by the model;

          MAPE  outputs the average relative error predicted by the model;

          MSE  outputs the mean square error of the model prediction;

          RMSE  outputs the root mean square error of the model's predictions.

1.8.2. Forecast error  MAE  outputs the mean absolute error predicted by the model;

          MAPE  outputs the average relative error predicted by the model;

          MSE  outputs the mean square error of the model prediction;

          RMSE  outputs the root mean square error of the model's predictions.

1.9 Reset  clears all windows and proceeds to the next set of data operations.

Figure 1 ARIMA software interface Download address

2. Demonstration based on examples

The data comes from Wei Wu et al. [1] using a combined model to predict the monthly incidence of HFRS in Jiangsu Province. Figure 1 shows the monthly incidence of HFRS in Jiangsu Province from January 2004 to December 2012. This paper uses the monthly HFRS incidence data from January 2004 to December 2011 to build a model (training set) and predict the monthly HFRS incidence data from January 2011 to December 2011 (test set). Thesis address Raw data address

1. Wu W, Guo J, An S, et al. Comparison of Two Hybrid Models for Forecasting the Incidence of Hemorrhagic Fever with Renal Syndrome in Jiangsu Province, China. Plos One, 2015, 10(8).

Figure 2 The monthly incidence of hemorrhagic fever with renal syndrome in Jiangsu Province from January 2004 to December 2012

1. Double-click to open the ARIMAb.exe software

2. After opening the interface, enter the time series data in "Data Input", and just copy and paste it in excel. You can click "Raw Data Drawing" to display the time series trend of the original data.

3. Perform a stationarity test.

      Click "Original Data" to display the stationarity test results (ADF test) of the original time series: the column of the test results shows "unstable", and it also shows that the period of the data is 12, which means it shows seasonality. Correlograms and partial correlograms of the original data are also shown below.

4. According to the above results, personal habits can undergo a general split (showing a downward trend in general, of course not obvious or not) and a seasonal split (showing a seasonal distribution).

     Assuming that only one seasonal split is performed and no general split is performed, enter 0 for "General Split (d)", enter 1 for "Seasonal Split (D)", and then click "General + Seasonal Split" , still showing instability.

    So perform a seasonal split and perform a general split, then enter 1 for "General Split (d)", enter 1 for "Seasonal Split (D)", and then click "General + Seasonal Split", or The display is stable.

4. Automatic parameter search

    Since the above steps determine the value of the split: a seasonal split, a general split, so at this time d=1, D=1, fill in the corresponding position of "Model Parameters", check the Log conversion by default, click " Look for".

    Then start to search automatically. The process of searching for parameters is:

  1. First, the program automatically finds the optimal p, q, P, and Q parameters (the four parameters range from 0 to 3), because the infectious disease data p, q, P, and Q parameters generally range from 0 to 3;
  2. p, q, P, Q parameters are statistically significant ( P <0.05);
  3. The AIC value and BIC value of the model are the smallest.

    After the parameters are searched, the optimal parameters are automatically output. For example, the optimal model in this example is ARIMA(0,1,1)(3,1,1)12.

5. Model Fitting and Prediction

    "Model parameters" input the optimal parameters of the above output, "actual value input" paste the actual value to be predicted (this example is the incidence data of Jiangsu Province from January 2012 to December 2012), "predicted number (unit)" Output 12, click "Predict".

    The result display is divided into four parts:

  1. AIC value, BIC value, and the predicted value and actual value of the forecast part (provide the original data for everyone to use in other drawing software);
  2. The parameter inspection results of p, q, P, and Q parameters can be copied and pasted to form another table;
  3. Curve display of predicted value and actual value;
  4. Forecast error display, including MAE, MAPE, MSE, RMSE.

 

    Sometimes it is necessary to provide the fitting effect when writing a paper, so clicking "Fit" will also display the fitting result:

  1. Fitted value and actual value curve display;
  2. Provide raw data for everyone to use in other drawing software;
  3. Fitting error display, including MAE, MAPE, MSE, RMSE.

    It can be seen that the optimal ARIMA parameters obtained by Matlab's ARIMA algorithm are not the same as those obtained in the article. This is because the algorithm of each software is different, but the final performance parameters are similar. Write clearly in the paper. software.

Guess you like

Origin blog.csdn.net/qq_30452897/article/details/126336069
Recommended