Skip to content

Commit dd95c85

Browse files
committed
I have modified some textual expressions in sir_model.md
1 parent 2fd1dd1 commit dd95c85

File tree

1 file changed

+43
-46
lines changed

1 file changed

+43
-46
lines changed

lectures/sir_model.md

Lines changed: 43 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -8,45 +8,44 @@ kernelspec:
88
language: python
99
name: python3
1010
---
11-
12-
```{raw} jupyter
11+
```{raw}
1312
<div id="qe-notebook-header" align="right" style="text-align:right;">
1413
<a href="https://quantecon.org/" title="quantecon.org">
1514
<img style="width:250px;display:inline;" width="250px" src="https://assets.quantecon.org/img/qe-menubar-logo.svg" alt="QuantEcon">
1615
</a>
1716
</div>
1817
```
1918

20-
# {index}`新冠病毒建模 <single: Modeling COVID 19>`
19+
# `新冠病毒建模 <single: Modeling COVID 19>`
2120

22-
```{contents} 目录
21+
```{contents}
2322
:depth: 2
2423
```
2524

2625
## 概述
2726

28-
这是由[Andrew Atkeson](https://sites.google.com/site/andyatkeson/)提供的用于分析新冠疫情的代码的Python版本
27+
这是由[Andrew Atkeson](https://sites.google.com/site/andyatkeson/)提供的用于分析新冠疫情的Python代码
2928

3029
特别参见
3130

3231
* [NBER工作论文第26867号](https://www.nber.org/papers/w26867)
3332
* [COVID-19工作论文和代码](https://sites.google.com/site/andyatkeson/home?authuser=0)
3433

35-
他的这些笔记的目的是向经济学家介绍定量建模
34+
他的这些笔记主要是介绍了定量建模
3635

3736
传染病动态研究。
3837

3938
疾病传播使用标准SIR(易感者-感染者-移除者)模型进行建模。
4039

4140
模型动态用常微分方程组表示。
4241

43-
主要目标是研究通过社交距离实施的抑制措施对感染传播的影响
42+
其主要目的是研究通过社交距离实施的抑制措施对感染传播的影响
4443

45-
研究重点是美国的结果,但可以调整参数来研究其他国家
44+
本课程主要模拟的是美国的结果,当然,也可以调整参数来研究其他国家
4645

4746
我们将使用以下标准导入:
4847

49-
```{code-cell} ipython3
48+
```{code-cell}
5049
import matplotlib.pyplot as plt
5150
import matplotlib as mpl
5251
FONTPATH = "fonts/SourceHanSerifSC-SemiBold.otf"
@@ -58,9 +57,9 @@ import numpy as np
5857
from numpy import exp
5958
```
6059

61-
我们还将使用SciPy的数值例程odeint来求解微分方程
60+
最后,我们使用SciPy的数值例程odeint来求解微分方程
6261

63-
```{code-cell} ipython3
62+
```{code-cell}
6463
from scipy.integrate import odeint
6564
```
6665

@@ -88,8 +87,8 @@ from scipy.integrate import odeint
8887

8988
主要关注的是
9089

91-
* 在给定时间的感染人数(这决定了医疗系统是否会被压垮)以及
92-
* 病例负荷可以推迟多长时间(希望能够推迟到疫苗出现
90+
* 在给定时间的感染人数(这决定了医疗系统是否会被压垮)
91+
* 病例负荷可以推迟多长时间(我们希望能够推迟到疫苗出现
9392

9493
使用小写字母表示处于各状态的人口比例,其动态方程为
9594

@@ -139,7 +138,7 @@ $\sigma$和$\gamma$都被视为固定的、由生物学决定的参数。
139138
* $\sigma = 1/5.2$,反映平均潜伏期为5.2天。
140139
* $\gamma = 1/18$,对应平均病程18天。
141140

142-
传播率被建模为
141+
传播率被构造为
143142

144143
* $\beta(t) := R(t) \gamma$,其中$R(t)$是时间$t$时的*有效再生数*
145144

@@ -149,20 +148,20 @@ $\sigma$和$\gamma$都被视为固定的、由生物学决定的参数。
149148

150149
首先我们将人口规模设置为与美国相匹配。
151150

152-
```{code-cell} ipython3
151+
```{code-cell}
153152
pop_size = 3.3e8
154153
```
155154

156155
接下来我们按照上述方法固定参数。
157156

158-
```{code-cell} ipython3
157+
```{code-cell}
159158
γ = 1 / 18
160159
σ = 1 / 5.2
161160
```
162161

163162
现在我们构建一个函数来表示{eq}`dfcv`中的$F$
164163

165-
```{code-cell} ipython3
164+
```{code-cell}
166165
def F(x, t, R0=1.6):
167166
"""
168167
状态向量的时间导数。
@@ -190,7 +189,7 @@ def F(x, t, R0=1.6):
190189

191190
初始条件设置为
192191

193-
```{code-cell} ipython3
192+
```{code-cell}
194193
# initial conditions of s, e, i
195194
i_0 = 1e-7
196195
e_0 = 4 * i_0
@@ -199,13 +198,13 @@ s_0 = 1 - i_0 - e_0
199198

200199
用向量形式表示的初始条件是
201200

202-
```{code-cell} ipython3
201+
```{code-cell}
203202
x_0 = s_0, e_0, i_0
204203
```
205204

206-
我们使用odeint在一系列时间点`t_vec`上通过数值积分求解时间路径。
205+
我们使用odeint在一系列时间点 `t_vec`上通过数值积分求解时间路径。
207206

208-
```{code-cell} ipython3
207+
```{code-cell}
209208
def solve_path(R0, t_vec, x_init=x_0):
210209
"""
211210
通过数值积分求解i(t)和c(t),
@@ -225,19 +224,19 @@ def solve_path(R0, t_vec, x_init=x_0):
225224

226225
我们要研究的时间段为550天,大约18个月:
227226

228-
```{code-cell} ipython3
227+
```{code-cell}
229228
t_length = 550
230229
grid_size = 1000
231230
t_vec = np.linspace(0, t_length, grid_size)
232231
```
233232

234233
### 实验1:固定R0的情况
235234

236-
让我们从`R0`为常数的情况开始。
235+
让我们从 `R0`为常数的情况开始。
237236

238-
我们在不同`R0`值的假设下计算感染人数的时间路径:
237+
我们在不同 `R0`值的假设下计算感染人数的时间路径:
239238

240-
```{code-cell} ipython3
239+
```{code-cell}
241240
R0_vals = np.linspace(1.6, 3.0, 6)
242241
labels = [f'$R0 = {r:.2f}$' for r in R0_vals]
243242
i_paths, c_paths = [], []
@@ -250,7 +249,7 @@ for r in R0_vals:
250249

251250
这是一些用于绘制时间路径的代码。
252251

253-
```{code-cell} ipython3
252+
```{code-cell}
254253
def plot_paths(paths, labels, times=t_vec):
255254
256255
fig, ax = plt.subplots()
@@ -265,27 +264,27 @@ def plot_paths(paths, labels, times=t_vec):
265264

266265
让我们绘制当前病例数占人口的比例。
267266

268-
```{code-cell} ipython3
267+
```{code-cell}
269268
plot_paths(i_paths, labels)
270269
```
271270

272271
正如预期的那样,较低的有效传播率会推迟感染高峰。
273272

274-
它们也会导致当前病例的峰值降低
273+
同时也会导致当前病例的峰值降低
275274

276275
以下是累计病例数(占总人口的比例):
277276

278-
```{code-cell} ipython3
277+
```{code-cell}
279278
plot_paths(c_paths, labels)
280279
```
281280

282281
### 实验2:改变缓解措施
283282

284283
让我们来看一个逐步实施缓解措施(例如社交距离)的场景。
285284

286-
以下是一个关于`R0`随时间变化的函数规范。
285+
以下是一个关于 `R0`随时间变化的函数规范。
287286

288-
```{code-cell} ipython3
287+
```{code-cell}
289288
def R0_mitigating(t, r0=3, η=1, r_bar=1.6):
290289
R0 = r0 * exp(- η * t) + (1 - exp(- η * t)) * r_bar
291290
return R0
@@ -299,14 +298,14 @@ def R0_mitigating(t, r0=3, η=1, r_bar=1.6):
299298

300299
我们考虑几个不同的速率:
301300

302-
```{code-cell} ipython3
301+
```{code-cell}
303302
η_vals = 1/5, 1/10, 1/20, 1/50, 1/100
304303
labels = [fr'$\eta = {η:.2f}$' for η in η_vals]
305304
```
306305

307306
以下是在这些不同速率下 `R0` 的时间路径:
308307

309-
```{code-cell} ipython3
308+
```{code-cell}
310309
fig, ax = plt.subplots()
311310
312311
for η, label in zip(η_vals, labels):
@@ -318,7 +317,7 @@ plt.show()
318317

319318
让我们计算感染者人数的时间路径:
320319

321-
```{code-cell} ipython3
320+
```{code-cell}
322321
i_paths, c_paths = [], []
323322
324323
for η in η_vals:
@@ -330,13 +329,13 @@ for η in η_vals:
330329

331330
以下是不同场景下的当前案例:
332331

333-
```{code-cell} ipython3
332+
```{code-cell}
334333
plot_paths(i_paths, labels)
335334
```
336335

337336
以下是累计病例数(占总人口的比例):
338337

339-
```{code-cell} ipython3
338+
```{code-cell}
340339
plot_paths(c_paths, labels)
341340
```
342341

@@ -347,22 +346,21 @@ plot_paths(c_paths, labels)
347346
考虑以下两种缓解情景:
348347

349348
1. 前30天$R_t = 0.5$,之后17个月$R_t = 2$。这相当于30天后解除封锁。
350-
1. 前120天$R_t = 0.5$,之后14个月$R_t = 2$。这相当于4个月后解除封锁。
349+
2. 前120天$R_t = 0.5$,之后14个月$R_t = 2$。这相当于4个月后解除封锁。
351350

352351
这里考虑的参数设置模型的初始状态为25,000个活跃感染者,以及75,000个已经接触病毒因此即将具有传染性的个体。
353352

354-
```{code-cell} ipython3
353+
```{code-cell}
355354
# 初始条件
356355
i_0 = 25_000 / pop_size
357356
e_0 = 75_000 / pop_size
358357
s_0 = 1 - i_0 - e_0
359358
x_0 = s_0, e_0, i_0
360359
```
361360

362-
363361
让我们计算路径:
364362

365-
```{code-cell} ipython3
363+
```{code-cell}
366364
R0_paths = (lambda t: 0.5 if t < 30 else 2,
367365
lambda t: 0.5 if t < 120 else 2)
368366
@@ -378,31 +376,30 @@ for R0 in R0_paths:
378376

379377
这是活跃感染病例数:
380378

381-
```{code-cell} ipython3
379+
```{code-cell}
382380
plot_paths(i_paths, labels)
383381
```
384382

385-
在这些场景下我们可以预期什么样的死亡率
383+
在这些场景下,死亡率会是怎样的呢
386384

387385
假设1%的病例会导致死亡
388386

389-
```{code-cell} ipython3
387+
```{code-cell}
390388
ν = 0.01
391389
```
392390

393391
这是累计死亡人数:
394392

395-
```{code-cell} ipython3
393+
```{code-cell}
396394
paths = [path * ν * pop_size for path in c_paths]
397395
plot_paths(paths, labels)
398396
```
399397

400398
这是每日死亡率:
401399

402-
```{code-cell} ipython3
400+
```{code-cell}
403401
paths = [path * ν * γ * pop_size for path in i_paths]
404402
plot_paths(paths, labels)
405403
```
406404

407405
如果能找到疫苗,将曲线峰值推迟到更远的未来可能会减少累计死亡人数。
408-

0 commit comments

Comments
 (0)