Directory
1. Introduction to the Logistic model
Two, Logistic model example
3. Principle of Logistic Model
3.1 Definition of Logistic equation
3.2 Yule algorithm
3.2 Rhodes Algorithm
3.3 Nair Algorithm
4. Part of the code of the Logistic model Matlab
4.1 Yule algorithm
4.2 Rhodes Algorithm
4.3 Nair Algorithm
1. Introduction to Logistic Model
Logistic regression, also known as logistic regression analysis, is a generalized linear regression analysis model, which is often used in data mining, automatic disease diagnosis, economic forecasting and other fields. For example, explore the risk factors that cause diseases, and predict the probability of disease occurrence based on risk factors. Taking the analysis of gastric cancer as an example, two groups of people are selected, one is the gastric cancer group and the other is the non-gastric cancer group. The two groups of people must have different signs and lifestyles. Therefore, the dependent variable is gastric cancer, the value is “yes” or “no”, and the independent variables can include many, such as age, gender, eating habits, Helicobacter pylori infection, etc. Independent variables can be either continuous or categorical. Then, through logistic regression analysis, the weight of independent variables can be obtained, so that we can roughly understand which factors are risk factors for gastric cancer. At the same time, according to the weight value, the possibility of a person suffering from cancer can be predicted according to the risk factors.
2. Logistic model example
The whole process of construction carbon emissions in Jiangsu Province from 1965 to 2011 (unit: 10,000 tons) is shown in the table below. Using the logistic equation to simulate the change trend of the whole-process building emissions of C in Jiangsu Province, use different methods to estimate the parameters of the equations, and calculate the MAPE of the three methods and the forecast results of the whole-process building emissions in the next five years.
1965 |
1966 |
… |
2010 |
2011 |
480.9 |
522.0 |
… |
8209.8 |
8979.1 |
3. Logistic model principle
3.1 Definition of Logistic Equation
3.2 Yule algorithm
Deduced from formula 1 of 3.1:
3.2 Rhodes Algorithm
3.3 Nair algorithm
4. Logistic model Matlab part code
4.1 Yule algorithm
clear;clc; %Yule algorithm: X=[480.9,522,468.8,469.5,573.8,737.8,869.8,933.7,977.2,... 997.7, 1120.3, 1176.1, 1284.8, 1422.1, 1462.1, 1499.7,... 1473.1, 1539.2, 1637, 1771, 1886.5, 1994.6, 2145.7, 2292,... 2396.8, 2387, 2484.4, 2580.8, 2750.2, 2915.7, 3163.8, 3231.9,... 3319.5, 3319.6, 3484., 3550.6, 3613.9, 3833.1, 4471.2, 5283,... 5803.2, 6415.5, 6797.9, 7033.5, 7636.3, 8209.8, 8979.1]; plot(XX(1:length(X)),X,'g-^') legend('predicted value','actual value') xlabel('year');ylabel('CO_{2} emissions'); title('CO_{2} predicted value and actual value curve (Yule method)') set(gca,'XTick',[1965:4:2017]) grid on format short; forecast=YY(end-4:end);Forecast results of %CO2 emissions MAPE=sum(abs(YY(1:n + 1)-X)./X)/length(X);% average relative difference a,b,c
4.2 Rhodes algorithm
clear;clc; %Rhodes algorithm X=[480.9,522,468.8,469.5,573.8,737.8,869.8,933.7,977.2,... 997.7, 1120.3, 1176.1, 1284.8, 1422.1, 1462.1, 1499.7,... 1473.1, 1539.2, 1637, 1771, 1886.5, 1994.6, 2145.7, 2292,... 2396.8, 2387, 2484.4, 2580.8, 2750.2, 2915.7, 3163.8, 3231.9,... 3319.5, 3319.6, 3484., 3550.6, 3613.9, 3833.1, 4471.2, 5283,... 5803.2, 6415.5, 6797.9, 7033.5, 7636.3, 8209.8, 8979.1]; plot(XX,YY,'r-o') hold on plot(XX(1:length(X)),X,'k-^') set(gca,'XTick',[1965:4:2017]) legend('predicted value','actual value') xlabel('year');ylabel('CO_{2} emissions'); title('CO_{2} predicted value and actual value curve (Rhodes method)') grid on format short; forecast=YY(end-4:end);Forecast results of %CO2 emissions MAPE=sum(abs(YY(1:n + 1)-X)./X)/length(X);% average relative difference a,b,c
4.3 Nair Algorithm
clear;clc; %Nair Algorithm X=[480.9,522,468.8,469.5,573.8,737.8,869.8,933.7,977.2,... 997.7, 1120.3, 1176.1, 1284.8, 1422.1, 1462.1, 1499.7,... 1473.1, 1539.2, 1637, 1771, 1886.5, 1994.6, 2145.7, 2292,... 2396.8, 2387, 2484.4, 2580.8, 2750.2, 2915.7, 3163.8, 3231.9,... 3319.5, 3319.6, 3484., 3550.6, 3613.9, 3833.1, 4471.2, 5283,... 5803.2, 6415.5, 6797.9, 7033.5, 7636.3, 8209.8, 8979.1]; n=length(X)-1; for t=1:n Z(t)=1/X(t)-1/X(t+1); S(t)=1/X(t) + 1/X(t + 1); hold on plot(XX(1:length(X)),X,'b-^') legend('predicted value','actual value') xlabel('year');ylabel('carbon dioxide emissions'); title('Carbon dioxide predicted value and actual value curve (Nair method)') set(gca,'XTick',[1965:4:2017]) grid on format short; forecast=YY(end-4:end);Forecast results of %CO2 emissions MAPE=sum(abs(YY(1:n + 1)-X)./X)/length(X);% average relative difference a,b,c