在传统的 SEIR 模型中,研究对象被分成 S、E、I、R 等 4 种类型。
(1)S(Susceptible):易感者,从未感染病毒的健康人群,但会因为接触感染者而
感染病毒。
(2)E(Exposed):潜伏者,感染了病毒的易感者在出现症状之前所处的状态。
(3)I(Iinfectives):感染者,在 14 天潜伏期出现自我感知或可临床识别的症状与
特征的病毒携带者,具有较强的传播能力,可以将病毒传播到接触的易感者。
(4)R(Recovered):移出者,感染者治疗完成痊愈或者死亡的人群。恢复者治愈
之后具有抗体,即使与感染者接触也不会被传染。
图中,为一名感染者每一时刻平均接触到的人数;为易感者所占所有人群的比例;
为每一时刻潜伏者中将会有占的人群转化为感染者,其中为平均潜伏期的倒数;表
示治愈率和死亡率的总和。
传统SEIR模型存在着许多改进的空间,为了使其更加贴合 COVID-19的传播规律。
就如来说,通过考虑时变传播率,我们可以引入无症状感染者等更多类型的人群。
人群类型修改
(1)E重定义
被监测出有可疑迹象,实际上可能携带病毒也可能不携带病毒的人群。
(2)引入 U(Unsymptomatic):无症状感染者
U 与 E 在本模型中最大的区别在于,U 容易被认为是“健康的”,从而没有被采取
任何强制措施,这种情况下他们的传播能力将远大于 E。
(3)I重定义
依据国家“自行在家隔离”防控策略,除医务人员之外,其他人被感染几率极低。
且因防护设备密不透风,感染可能性相对较低。由此,对 I 传播能力进行重定义,认为
I 不具有较高的传播能力。
(1) 依据重定义的I,假设I对S没有传播能力
(2)根据目前已收集到的数据,全国易感者比例始终接近于 1(非易感者人数在
30 万人以内),对传播率的影响较小,由此假设 U 和 E 的传播率是恒定的。
(3)假定 S 可以被 U 和 I 传染。
(4)被治愈者再感染 COVID-19 的可能性极低,由此假设被治愈者不会被传播。
(5)E 中未携带病毒的人在 14 天(医学观察期为 14 天)后将变为 S,因此假设每
日 1/14 的 E 回到易感人群。
一位 R 在单位时间内可将 λ 1 \lambda_1 λ1 个 S 变为 E,而一名 U 在单位时间内传染 λ 2 \lambda_2 λ2 个 S,携带病毒的 E 在所有 E 中所占比例为 ,由此可得 S 变化方程为:
d S t d t = − λ 1 E t − λ 2 U t + 1 14 ( 1 − p 1 ) E t \frac{dS_t}{dt} = -\lambda_1E_t - \lambda_2U_t + \frac{1}{14}(1-p_1)E_t dtdSt=−λ1Et−λ2Ut+141(1−p1)Et
U 在易感人群中传播病毒后,被传播病毒的 S 变为 U,这些 U 如果在体温轨迹等监测中出现疑似点,则有一定概率 p2被发现,变为 E,由此可得 U 变化方程为:
d U t d t = λ 2 U t − p 2 U t \frac{dU_t}{dt} = \lambda_2U_t - p_2U_t dtdUt=λ2Ut−p2Ut
带病毒 E(比例为 p1)在单位时间内变为 I 的概率为 p3,未带病毒 E(比例为 1- p1) 在 14 天观察期后,返回 I 中,由此可得 E 变化方程为:
d E t d t = p 2 U t + λ 1 E t − p 1 p 3 E t − 1 14 ( 1 − p 1 ) E t \frac{dE_t}{dt} = p_2U_t + \lambda_1E_t - p_1p_3E_t - \frac{1}{14}(1-p_1)E_t dtdEt=p2Ut+λ1Et−p1p3Et−141(1−p1)Et
E 被确诊后变为 I,而 I 因至于或死亡而变为 R,被治愈者不会被传播,t 时刻的治愈率和死亡率分别为 $p_{c,t} $和 $p_{d,t} $,由此可得 I 和 R 变化方程为:
d I t d t = p 1 p 3 E t − ( p c , t + p D , t ) I t \frac{dI_t}{dt} = p_1p_3E_t - (p_{c,t}+p_{D,t})I_t dtdIt=p1p3Et−(pc,t+pD,t)It
d R t d t = ( p c , t + p D , t ) I t \frac{dR_t}{dt} = (p_{c,t}+p_{D,t})I_t dtdRt=(pc,t+pD,t)It
通过设置可变参数,我们可以观察到各类人群的变化趋势,并分析其中参数的稳定性。
由于每个阶段的控制力度不同,只能较好地拟合了疫情发生的初期阶段,可以为制定未来的疫情干预决策提供一定的理论支持。但是,模型不可避免地会与现实存在一定差异,进而导致分析预测结果存在一定的偏差。
由于每个阶段的控制力度不同,只能较好地拟合了疫情发生的初期阶段,可以为制定未来的疫情干预决策提供一定的理论支持。但是,模型不可避免地会与现实存在一定差异,进而导致分析预测结果存在一定的偏差。
%%%%----------------func.m-------------------------%%%%
function [ wucha ] = func( p1,p2,p3,lamda1,lamda2,pc,pd )
%--------------------------------------------------------------------------
% 初始化
%--------------------------------------------------------------------------
%clear;clc;
%--------------------------------------------------------------------------
% 参数设置
%--------------------------------------------------------------------------
N = 1400000000; %总人口
E = 20; %疑似病人
I = 410; %确诊
S = N - I; %易感人群
R = 0; %退出人群
U = 69921; %无症状
t1 = datetime(2020,1,13);
t2 = datetime(2020,9,6);
t = t1:t2;
T = 1:length(t);
for idx = 1:length(T)-1
S(idx+1) = S(idx) - lamda1*E(idx)-lamda2*U(idx)+1/14*(1-p1)*E(idx);
U(idx+1) = U(idx) + lamda2*U(idx) - p2*U(idx);
E(idx+1) = E(idx) + lamda1*E(idx) - 1/14*(1-p1)*E(idx) - p1*p3*E(idx);
I(idx+1) = I(idx) + p1*p3*E(idx) + p2*U(idx) - (pc+pd)*I(idx);
R(idx+1) = R(idx) + (pc+pd)*I(idx);
end
figure(1)
plot(t,E,t,I,t,R,t,U);grid on;
xlabel('天');ylabel('人数')
legend('疑似','感染者','康复者','无症状')
title('疫情预测趋势图')
%plot(t,E,t,I,t,R,t,U);grid on;
wucha = 1;
end
slider.m
%%%%----------------slider.m-------------------------%%%%
slider.m
function varargout = slider(varargin)
% SLIDER MATLAB code for slider.fig
% SLIDER, by itself, creates a new SLIDER or raises the existing
% singleton*.
%
% H = SLIDER returns the handle to a new SLIDER or the handle to
% the existing singleton*.
%
% SLIDER('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in SLIDER.M with the given input arguments.
%
% SLIDER('Property','Value',...) creates a new SLIDER or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before slider_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to slider_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help slider
% Last Modified by GUIDE v2.5 08-Sep-2020 10:11:21
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @slider_OpeningFcn, ...
'gui_OutputFcn', @slider_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before slider is made visible.
function slider_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to slider (see VARARGIN)
% Choose default command line output for slider
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes slider wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = slider_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on slider movement.
function slider1_Callback(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
p1 = get(handles.slider1,'value');
p2 = get(handles.slider2,'value');
p3 = get(handles.slider3,'value');
lamda1 = get(handles.slider4,'value');
lamda2 = get(handles.slider5,'value');
pc = get(handles.slider6,'value');
pd = get(handles.slider7,'value');
set(handles.edit1,'string',num2str(p1))
[ wucha ] = func( p1,p2,p3,lamda1,lamda2,pc,pd )
% --- Executes during object creation, after setting all properties.
function slider1_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function slider2_Callback(hObject, eventdata, handles)
% hObject handle to slider2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
p1 = get(handles.slider1,'value');
p2 = get(handles.slider2,'value');
p3 = get(handles.slider3,'value');
lamda1 = get(handles.slider4,'value');
lamda2 = get(handles.slider5,'value');
pc = get(handles.slider6,'value');
pd = get(handles.slider7,'value');
set(handles.edit2,'string',num2str(p2))
[ wucha ] = func( p1,p2,p3,lamda1,lamda2,pc,pd )
% --- Executes during object creation, after setting all properties.
function slider2_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function edit2_Callback(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit2 as text
% str2double(get(hObject,'String')) returns contents of edit2 as a double
% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function slider3_Callback(hObject, eventdata, handles)
% hObject handle to slider3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
p1 = get(handles.slider1,'value');
p2 = get(handles.slider2,'value');
p3 = get(handles.slider3,'value');
lamda1 = get(handles.slider4,'value');
lamda2 = get(handles.slider5,'value');
pc = get(handles.slider6,'value');
pd = get(handles.slider7,'value');
set(handles.edit3,'string',num2str(p3))
[ wucha ] = func( p1,p2,p3,lamda1,lamda2,pc,pd )
% --- Executes during object creation, after setting all properties.
function slider3_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function edit3_Callback(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit3 as text
% str2double(get(hObject,'String')) returns contents of edit3 as a double
% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function slider4_Callback(hObject, eventdata, handles)
% hObject handle to slider4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
p1 = get(handles.slider1,'value');
p2 = get(handles.slider2,'value');
p3 = get(handles.slider3,'value');
lamda1 = get(handles.slider4,'value');
lamda2 = get(handles.slider5,'value');
pc = get(handles.slider6,'value');
pd = get(handles.slider7,'value');
set(handles.edit4,'string',num2str(lamda1))
[ wucha ] = func( p1,p2,p3,lamda1,lamda2,pc,pd )
% --- Executes during object creation, after setting all properties.
function slider4_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function edit4_Callback(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit4 as text
% str2double(get(hObject,'String')) returns contents of edit4 as a double
% --- Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function slider5_Callback(hObject, eventdata, handles)
% hObject handle to slider5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
p1 = get(handles.slider1,'value');
p2 = get(handles.slider2,'value');
p3 = get(handles.slider3,'value');
lamda1 = get(handles.slider4,'value');
lamda2 = get(handles.slider5,'value');
pc = get(handles.slider6,'value');
pd = get(handles.slider7,'value');
set(handles.edit5,'string',num2str(lamda2))
[ wucha ] = func( p1,p2,p3,lamda1,lamda2,pc,pd )
% --- Executes during object creation, after setting all properties.
function slider5_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function edit5_Callback(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit5 as text
% str2double(get(hObject,'String')) returns contents of edit5 as a double
% --- Executes during object creation, after setting all properties.
function edit5_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function slider6_Callback(hObject, eventdata, handles)
% hObject handle to slider6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
p1 = get(handles.slider1,'value');
p2 = get(handles.slider2,'value');
p3 = get(handles.slider3,'value');
lamda1 = get(handles.slider4,'value');
lamda2 = get(handles.slider5,'value');
pc = get(handles.slider6,'value');
pd = get(handles.slider7,'value');
set(handles.edit6,'string',num2str(pc))
[ wucha ] = func( p1,p2,p3,lamda1,lamda2,pc,pd )
% --- Executes during object creation, after setting all properties.
function slider6_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function edit6_Callback(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit6 as text
% str2double(get(hObject,'String')) returns contents of edit6 as a double
% --- Executes during object creation, after setting all properties.
function edit6_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function slider7_Callback(hObject, eventdata, handles)
% hObject handle to slider7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
p1 = get(handles.slider1,'value');
p2 = get(handles.slider2,'value');
p3 = get(handles.slider3,'value');
lamda1 = get(handles.slider4,'value');
lamda2 = get(handles.slider5,'value');
pc = get(handles.slider6,'value');
pd = get(handles.slider7,'value');
set(handles.edit7,'string',num2str(pd))
[ wucha ] = func( p1,p2,p3,lamda1,lamda2,pc,pd )
% --- Executes during object creation, after setting all properties.
function slider7_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function edit7_Callback(hObject, eventdata, handles)
% hObject handle to edit7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit7 as text
% str2double(get(hObject,'String')) returns contents of edit7 as a double
% --- Executes during object creation, after setting all properties.
function edit7_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
源代码:https://paste.ubuntu.com/p/vH9g6BtBdW/