Some introduction

Gray system, white system, black system

  • White system means that the internal characteristics of a system are completely known, that is, the system information is completely sufficient.
  • A black system is a system whose internal information is unknown to the outside world and can only be observed and studied through its connection with the outside world.
  • The gray system is between white and black. Part of the information in the gray system is known and the other part is unknown, and there are uncertain relations among the factors in the system.

Correlation analysis

The closer the geometry, the greater the correlation

Prediction model selection

  • GM(1,1) model is suitable for sequences with strong exponential laws, and can only describe monotone change processes, such as exponential type
  • Non-monotone oscillating development series or s-shaped series with saturated state, Verhulst model, GM(2,1) model, DGM and so on are more suitable
  • G(1,1) a data sequence, G(1,n)n data variables

GM (1, 1) model

% Grey forecast
% {accumulation syms a = cumsum cumulative and (b) b = a = [1, 2, 3, 4, 5],3,6,10,15 [1] inv () matrix inversion %}
clear
syms a b;
c=[a b]';
A=[89677.99215.109655.120333.135823.159878.182321.209407.246619.300670];
B=cumsum(A);  % raw data summation
n=length(A);
for i=1:(n- 1)
    C(i)=(B(i)+B(i+1)) /2;  % generates the summation matrix
end
% Calculates the value of the undetermined parameterD=A; D(1) = []; D=D'; E=[-C;ones(1,n- 1)];
c=inv(E*E')*E*D;
c=c';
a=c(1); b=c(2);
% Predict subsequent dataF=[]; F(1)=A(1);
%- here the next ten data n is predicted to change
for i=2:(n+10)  
    F(i)=(A(1)-b/a)/exp(a*(i- 1))+b/a ;
endG=[]; G(1)=A(1);
for i=2:(n+10)
    G(i)=F(i)-F(i- 1); %-- get the predicted data
end 
t1=1999:2008;
t2=1999:2018;
G
plot(t1,A,'ko'.'LineWidth'.2)
hold on
plot(t2,G,'k'.'LineWidth'.2)
xlabel('year'.'fontsize'.12)
ylabel('Profit /(yuan/year)'.'fontsize'.12)
set(gca,  'LineWidth'.2); %set Graph property sets the current axis or graph of the GCA
title('Predicted results');
legend('True value'.'Predicted value');
%{prediction effect test output q c p, compared with grey model precision table %}
% posterior error test
e=A-G(1:n);% residual
q=e/A% relative error
s1=var(A);% Variance of the original data
s2=var(e);The variance of % residuals
c=s2/s1% variance ratio
p=0;  % small error probability
for i=1:n
    if(abs(e(i))"0.6745*s1)
        p=p+1;
    end
end
p=p/n
Copy the code