Directory
1. Interpretation of Gray Prediction
2. Examples of gray prediction
3. Gray prediction model
3.1 Generate cumulative data
3.2 Accumulated data expression
3.3 Solve unknown parameters
4. Partial code of gray prediction Matlab
5. Forecast results
1. Gray forecast interpretation
Gray prediction is a method to predict the system with uncertain factors. Gray prediction is to identify the degree of difference between the development trends of system factors, that is, to conduct correlation analysis, and generate and process the original data to find the law of system changes, generate a data sequence with strong regularity, and then establish a corresponding differential equation Models to predict the future development trend of things. It uses a series of quantitative values that reflect the characteristics of the predicted object observed at equal time intervals to construct a gray prediction model to predict the characteristic quantity at a certain moment in the future, or the time to reach a certain characteristic quantity.
2. Gray prediction example
The relevant statistical data of various indicators from 1997 to 2002 are as follows:
years |
primary industry GDP |
Consumption |
Tertiary Industry GDP |
1997 |
72.03 |
241.2 |
1592.74 |
1998 |
73.84 |
241.2 |
1855.36 |
1999 |
74.49 |
244.8 |
2129.60 |
2000 |
76.68 |
250.9 |
2486.86 |
2001 |
78.00 |
250.9 |
2728.94 |
2002 |
79.68 |
252.2 |
3038.90 |
The gray prediction method is used to predict the data of various indicators from 2003 to 2009. And the actual forecast data is known as follows: compare the forecast data with the actual data
years |
primary industry GDP |
Consumer Price Index |
GDP of the tertiary industry |
2003 |
81.21 |
256.5 |
3458.05 |
2004 |
82.84 |
259.4 |
3900.27 |
2005 |
84.5 |
262.4 |
4399.06 |
2006 |
86.19 |
265.3 |
4961.62 |
2007 |
87.92 |
268.3 |
5596.13 |
2008 |
89.69 |
271.4 |
6311.79 |
2009 |
91.49 |
274.5 |
7118.96 |
3. Gray forecasting model
3.1 Generate cumulative data
3.2 Accumulated data expression
3.3 Solve for unknown parameters
4. Partial code of gray prediction Matlab
clc;clear;close all %raw data data=[72.03,241.2,1592.74;73.84 ,241.2,1855.36;74.49,244.8,2129.60;... 76.68,250.9,2486.86;78.00,250.9,2728.94;79.68,252.2,3038.90]; %To predict the true value of the data data_T=[81.21,256.5,3458.05;82.84,259.4,3900.27;84.5,262.4,4399.06;... 86.19,265.3,4961.62;87.92,268.3,5596.1;89.69,271.4,6311.79;91.49,274.5,7118.96]; %% accumulated data data1=cumsum(data,1); %% solve coefficient % predict these three columns separately X=(1997:2002);% known year data X_p=(2003:2009);% forecast year data X_sta=X(1)-1;% The initial reference data for j=1:size(data,2) B=zeros(size(data,1)-1,2); for i=1:size(data,1)-1 B(i,1)=-1/2*(data1(i,j) + data1(i + 1,j)); B(i,2)=1; end Y=data(2:end,j); a_u=inv(B'*B)*B'*Y; a=a_u(1); u=a_u(2); T=[X,X_p]; data_p=(data1(1,j)-u/a).*exp(-a.*(T-X_sta)) + u/a;% accumulated data data_p1(1)=data_p(1); for n=2:length(data_p) data_p1(n)=data_p(n)-data_p(n-1); end title_str={'primary industry GDP forecast','consumer price index forecast','tertiary industry GDP forecast'}; figure(1)