├── .DS_Store
├── LICENSE
├── README.md
├── Rmd
├── resources
│ ├── bmj.csl
│ └── library.bib
├── social_distancing_wuhan_report.Rmd
└── social_distancing_wuhan_report.html
├── codes
├── .DS_Store
├── 0_master.r
├── 1_loadData.r
├── 2_simOutbreak_ncov_SEIR.r
├── 2_simOutbreak_ncov_SEIcIscR.r
├── function_modelSEIcIscR.r
└── function_postprocessing.r
├── data
├── .DS_Store
├── china_pop_age_structure.csv
├── contacts.Rdata
├── contacts_china.rdata
├── out_R0.csv
├── out_date.csv
├── wuhan_pop_case_dist.csv
└── wuhanpop.csv
├── outputs
├── .DS_Store
├── SEIR
│ └── .DS_Store
└── SEIcIscR
│ └── .DS_Store
└── plots
├── fig_1.png
├── fig_3.png
└── fig_4.png
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kieshaprem/covid19-agestructureSEIR-wuhan-social-distancing/092dded2cc45967f665a3f0d3f3e41f6e5a3f6b6/.DS_Store
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # The effect of control strategies that reduce social mixing on outcomes of the COVID-19 epidemic in Wuhan, China: a modelling study"
2 |
3 | *Contributors: Kiesha Prem †, Yang Liu †, Timothy W Russell, Adam J Kucharski, Rosalind M Eggo, Nicholas Davies, Centre for the Mathematical Modelling of Infectious Diseases COVID-19 Working Group, Mark Jit, Petra Klepac*
4 |
5 | *Correspondence to: kiesha.prem@lshtm.ac.uk*
6 |
7 | *† authors contributed equally*
8 |
9 | *The full paper accompanying this report can be found [here:](https://www.thelancet.com/journals/lanpub/article/PIIS2468-2667(20)30073-6/fulltext#sec1)*
10 |
11 |
12 | ## Aim
13 |
14 | To assess the impact of a range of control measures that reduce social mixing on data from the COVID-19 outbreak in Wuhan, China. Using the best estimates for the epidemiological parameters, we simulate the effects of the control measures using an age-structured, location-specific transmission model. The model uses data on contact patterns. Specifically, we adjust these patterns according to how they change under certain control measures. We then simulate our transmission model under these different scenarios and assess the impact.
15 |
16 | ## Introduction
17 |
18 | The SARS-CoV-2, a novel coronavirus, emerged in the City of Wuhan, Hubei Province, China, in early December 2019.(1,2) Since then, the local and national governments have taken unprecedented measures in response to the COVID-19 outbreak caused by SARS-CoV-2.(3) Exit screening of passengers was shortly followed by travel restrictions in Wuhan on 23rd January 2020, halting all means of unauthorised travel into and out of the city. Similar control measures were extended to the entire province of Hubei by 26th January 2020.(3) Non-pharmaceutical social distancing interventions such as extended school closure and workplace distancing were introduced to reduce the impact of the COVID-19 outbreak in Wuhan.(4) Within the city, schools remained closed; Lunar New Year holidays were extended so that people stayed away from their workplaces; the local government promoted social distancing and encouraged residents to avoid crowded places. These measures are known to have greatly changed the age-specific mixing patterns within the population in previous outbreak response efforts for other respiratory infectious diseases.(5,6) While travel restrictions undoubtedly had a role in reducing the exportations of infections outside of Wuhan, and delayed the onset of outbreaks in other regions,(7,8) changes in the mixing patterns affected the trajectory of the outbreak within Wuhan itself. In order to estimate the effects of social distancing measures on the progression of the COVID-19 epidemic, we look at Wuhan, hoping to provide some insights for the rest of the world.
19 |
20 | To examine how these changes in population mixing have affected the outbreak progression in Wuhan, we used synthetic location-specific contact patterns in Wuhan and adapted it in the presence of school closures, extended workplace closures, reduction in mixing in the general community. Using these matrices and the latest estimates of the epidemiological parameters of the Wuhan outbreak,(1,9,14–16) we simulated the ongoing trajectory of an outbreak in Wuhan using an age-structured susceptible-exposed-infected-removed (SEIR) model(17,18) for several social distancing measures.
21 |
22 |
23 | ## Discussion
24 | This study describes a mathematical model that quantifies the potential impacts of social distancing policies, relying on Wuhan as a case study. Epidemiological investigations conducted during the WHO-China Joint Mission on COVID-19 found many infections clustered around the households.(35) Extreme social distancing measures, including school closures, workplace closures, and avoiding any public gatherings all at once, can push the transmission to households leading to increased clustering in household cases.(5) As households are not explicitly included in the model, we do not consider heterogeneity and clustering of household transmission. Distinguishing between repeated and new contacts is important for disease propagation in contact network models,(36,37) more sophisticated methods accounting for temporal presence within the household(38) would be needed to characterise higher degrees of contact. Our compartmental model does not capture individual-level heterogeneity in contacts, which could be important in super-spreading events, particularly early on in an epidemic. In combination with nosocomial infections, the risk of COVID-19 infections is potentially amplified in close contacts of confirmed cases and healthcare workers. However, the compartmental model we presented is not equipped to explicitly consider transmission within health care institutions and households. More complex models, such as individual-based models with familial and healthcare structures, should be explored. Further research on the nosocomial infection risks among healthcare workers and patients have been identified as one of the research gaps to be prioritised in the next few months by the WHO.
25 |
26 | While the precise estimates of the impact of interventions may vary by country and indeed different estimates of key parameters, our model highlights the usefulness of social distancing interventions as well as the need to carefully calibrate their lifting to avoid second and subsequent waves of a COVID-19 epidemic. Non-Hubei China, and other east or southeast Asian regions have managed to avert a major outbreak locally and delayed the peak without resorting to Hubei’s extreme measures.(39) Policymakers are advised to reapportion their resources to focus on mitigating the impact of their potentially soon-do-be overwhelmed health system.(40)
27 |
--------------------------------------------------------------------------------
/Rmd/resources/bmj.csl:
--------------------------------------------------------------------------------
1 |
2 |
182 |
--------------------------------------------------------------------------------
/Rmd/resources/library.bib:
--------------------------------------------------------------------------------
1 | @article{kucharski2020early,
2 | title={Early dynamics of transmission and control of COVID-19: a mathematical modelling study},
3 | author={Kucharski, Adam J and Russell, Timothy W and Diamond, Charlie and Liu, Yang and Edmunds, John and Funk, Sebastian and Eggo, Rosalind M and CMMID nCoV working group and others},
4 | journal={medRxiv},
5 | year={2020},
6 | publisher={Cold Spring Harbor Laboratory Press}
7 | }
8 |
9 | @article{kucharski2014case,
10 | title={Case fatality rate for Ebola virus disease in west Africa},
11 | author={Kucharski, Adam J and Edmunds, W John},
12 | journal={The Lancet},
13 | volume={384},
14 | number={9950},
15 | pages={1260},
16 | year={2014},
17 | publisher={Elsevier}
18 | }
19 |
20 |
21 | @article{linton2020incubation,
22 | title={Incubation Period and Other Epidemiological Characteristics of 2019 Novel Coronavirus Infections with Right Truncation: A Statistical Analysis of Publicly Available Case Data},
23 | author={Linton, Natalie M and Kobayashi, Tetsuro and Yang, Yichi and Hayashi, Katsuma and Akhmetzhanov, Andrei R and Jung, Sung-mok and Yuan, Baoyin and Kinoshita, Ryo and Nishiura, Hiroshi},
24 | journal={Journal of Clinical Medicine},
25 | volume={9},
26 | number={2},
27 | pages={538},
28 | year={2020},
29 | publisher={Multidisciplinary Digital Publishing Institute}
30 | }
31 |
32 |
33 | @article{nishiura2009early,
34 | title={Early epidemiological assessment of the virulence of emerging infectious diseases: a case study of an influenza pandemic},
35 | author={Nishiura, Hiroshi and Klinkenberg, Don and Roberts, Mick and Heesterbeek, Johan AP},
36 | journal={PLoS One},
37 | volume={4},
38 | number={8},
39 | year={2009},
40 | publisher={Public Library of Science}
41 | }
42 |
--------------------------------------------------------------------------------
/Rmd/social_distancing_wuhan_report.Rmd:
--------------------------------------------------------------------------------
1 | ---
2 | title: "The effect of control strategies that reduce social mixing on outcomes of the COVID-19 epidemic in Wuhan, China: a modelling study"
3 | output:
4 | html_document:
5 | html_fragment
6 | bibliography: resources/library.bib
7 | csl: resources/bmj.csl
8 | ---
9 |
10 | ```{r setup, include=FALSE}
11 | knitr::opts_chunk$set(echo = FALSE)
12 | ```
13 |
14 | ```{r settings}
15 | ## Report date
16 | target_date <- Sys.Date() - 1
17 | ```
18 |
19 | *Contributors: Kiesha Prem †, Yang Liu †, Timothy W Russell, Adam J Kucharski, Rosalind M Eggo, Nicholas Davies, Centre for the Mathematical Modelling of Infectious Diseases COVID-19 Working Group, Mark Jit, Petra Klepac*
20 |
21 | *Correspondence to: kiesha.prem@lshtm.ac.uk*
22 |
23 | *† authors contributed equally*
24 |
25 | *The full paper accompanying this report can be found as a preprint [here:](https://www.medrxiv.org/content/10.1101/2020.03.09.20033050v1)*
26 |
27 |
28 | ## Aim
29 |
30 | To assess the impact of a range of control measures that reduce social mixing on data from the COVID-19 outbreak in Wuhan, China. Using the best estimates for the epidemiological parameters, we simulate the effects of the control measures using an age-structured, location-specific transmission model. The model uses data on contact patterns. Specifically, we adjust these patterns according to how they change under certain control measures. We then simulate our transmission model under these different scenarios and assess the impact.
31 |
32 | ## Introduction
33 |
34 | The SARS-CoV-2, a novel coronavirus, emerged in the City of Wuhan, Hubei Province, China, in early December 2019.(1,2) Since then, the local and national governments have taken unprecedented measures in response to the COVID-19 outbreak caused by SARS-CoV-2.(3) Exit screening of passengers was shortly followed by travel restrictions in Wuhan on 23rd January 2020, halting all means of unauthorised travel into and out of the city. Similar control measures were extended to the entire province of Hubei by 26th January 2020.(3) Non-pharmaceutical social distancing interventions such as extended school closure and workplace distancing were introduced to reduce the impact of the COVID-19 outbreak in Wuhan.(4) Within the city, schools remained closed; Lunar New Year holidays were extended so that people stayed away from their workplaces; the local government promoted social distancing and encouraged residents to avoid crowded places. These measures are known to have greatly changed the age-specific mixing patterns within the population in previous outbreak response efforts for other respiratory infectious diseases.(5,6) While travel restrictions undoubtedly had a role in reducing the exportations of infections outside of Wuhan, and delayed the onset of outbreaks in other regions,(7,8) changes in the mixing patterns affected the trajectory of the outbreak within Wuhan itself. In order to estimate the effects of social distancing measures on the progression of the COVID-19 epidemic, we look at Wuhan, hoping to provide some insights for the rest of the world.
35 |
36 | To examine how these changes in population mixing have affected the outbreak progression in Wuhan, we used synthetic location-specific contact patterns in Wuhan and adapted it in the presence of school closures, extended workplace closures, reduction in mixing in the general community. Using these matrices and the latest estimates of the epidemiological parameters of the Wuhan outbreak,(1,9,14–16) we simulated the ongoing trajectory of an outbreak in Wuhan using an age-structured susceptible-exposed-infected-removed (SEIR) model(17,18) for several social distancing measures.
37 |
38 | ## Methods
39 |
40 | ### SEIR Model
41 |
42 | We simulated the outbreak in Wuhan using a deterministic stage-structured SEIR model over one year period, during which the modelled outbreak peters out. An implication of this approach is that all demographic changes in the population (i.e., births, deaths, and ageing) are ignored.
43 |
44 | For a given age group , epidemic transitions can be described by:
45 |
46 | $$ S_{i, t+1} = S_{i, t} - \beta S_{i, t} \sum_{j = 1}^n C_{i, j} I_{j, t}^c - \alpha \beta S_{i, t} \sum_{j = 1}^n C_{i, j} I_{j, t}^{SC} $$
47 |
48 | $$ E_{i, t+1} = \beta \sum_{j = 1}^n C_{i, j} I_{j, t}^C + \alpha \beta S_{i, t} \sum_{j = 1}^n C_{i, j} I_{j, t}^{SC} - (1 - \kappa) E_{i, t}$$
49 |
50 | $$ I_{i, t+1}^C = \rho_i \kappa E_{i, t} + (1 - \gamma)I_{j, t}^C$$
51 |
52 | $$ I_{j, t+1}^{SC} = (1 - \rho_i) \kappa E_{i, t} + (1 - \gamma)I_{j, t}^C$$
53 |
54 | $$ R_{i, t+1} = R_{i, t} + \gamma I_{j, t + 1}^C + \gamma I_{j, t + 1}^{SC} $$
55 |
56 | Where $\beta$ is the transmission rate (scaled to the right value of $R_0$), $C_{i,j}$ describe the contacts of age group $j$ made by age group $i$, $\kappa = 1 - \exp(\frac{1}{d_L})$ is the daily probability of exposed individual becoming infectious (with $d_t$ being the average incubation period), and $\gamma = 1 - \exp(\frac{1}{d_I})$ is the daily probability that an infected individual recovers when the average duration of infection is $D_I$. We further incorporated contributions of asymptomatic and subclinical cases, $1 - \rho$ denotes the probability of an infected cases being asymptomatic or subclinical. We assumed that younger individuals are more likely to be asymptomatic (or subclinical) and less infectious (proportion of infectiousness compared to $I^C, \alpha$ ).
57 |
58 |
59 | | Parameter | Values | References |
60 | |-----------|--------|------------|
61 | | Basic reproduction number, $R_o$ | 2·2 (1·6–3·0) 1 | Kucharski and colleagues 1, 4 |
62 | | Average incubation period, $d_L$ | 6·4 days | Backer and colleagues 1,5 |
63 | | Average duration of infection, $d_I$ | 3 or 7 days | Woelfel and colleagues22|
64 | | Initial number of infected, $I_O$ |200 or 2000 |Abbott and colleagues 16 |
65 | |Pr(infected case is clinical), $\rho_i$ |0 or 0·4, for | Bi and colleagues20 |
66 | | |0 or 0·8 for | Davies and colleagues21 |
67 | |Pr(infection acquired from subclinical), $\alpha$ | 0·25 | Liu and colleagues 19 |
68 |
69 |
70 |
71 | ```{r fig_1, fig.align='center', fig.cap="_**Figure 1. Age-structured SEIR model and details of the modelled social distancing interventions.** The age-specific mixing patterns of individuals in age group alter their likelihood of being exposed to the virus given a certain number of infectives in the population. Younger individuals are more likely to be asymptomatic and less infectious, i.e. subclinical (SC). When $\\rho_i = 0$ for all $i$, the model simplifies to a standard SEIR. The force of infection $\\phi_{i, t}$ is given by $1 - (\\beta \\sum_j C_{i,j} I_{j,t}^C + \\alpha \\beta \\sum_j C_{i,j} I_{j, t}^{SC})$_", out.width = '80%'}
72 | knitr::include_graphics("../plots/fig_1.png")
73 | ```
74 |
75 | ## Results
76 |
77 | Our simulations show that the control measures aimed at reducing the social mixing in the population can be effective in reducing the magnitude and delaying the peak of the outbreak. Figure 3 shows the effects of different control measures among individuals aged 55–60 and 10–15 years old. The standard school winter break and holidays for the Lunar New Year would have had little effect on progression of the outbreak had the school and workplace re-opened as normal.
78 |
79 | ```{r fig_3, echo=FALSE, fig.align='center', fig.cap="_**Figure 3. Effects of different intervention strategies on the cumulative incidence and new cases per day among individuals aged 55–60 (A to D) and 10–15 (E to H) from late 2019 to end-2020.** Under two scenarios children being equally infectious and children being less infectious, the effects of social distancing measures were investigated. Theoretical no intervention (black line), school break and LNY (blue line) and intense control measures that are relaxed in a staggered fashion at the beginning of March (red line), and intense control measures that are relaxed in a staggered fashion at the beginning of April (orange line). Shading indicates the timing of the school holidays, Lunar New Year (dark vertical line), intense control measures (dark grey), and staggered return to work followed by school opening (lighter grey)._", out.width = '80%'}
80 | knitr::include_graphics("../plots/fig_3.png")
81 | ```
82 |
83 | We presented the median cumulative incidence (Fig 4A), incident case per day (Fig 4B) and age-specific incidence per day (Fig 4C–G) of the 200 simulated outbreaks. The 25th and 75th percentile outbreaks are represented by the shaded area in the cumulative incidence. The intense control measures of prolonged school closure and work holidays reduced the final size (Fig 4A) and peak incidence, while also delaying the peak of the outbreak (Fig 4B). Our model suggests that the effects of these social distancing strategies vary across age categories, the reduction in incidence is highest among school children and older individuals and lowest among working-aged adults (Fig 4C–G and Fig 5).
84 |
85 |
86 | ```{r fig_4, echo=FALSE, fig.align='center', fig.cap="_**Figure 4. Effects of the different social distancing measures on the cumulative incidence (A) and new cases per day (B), and age-specific incidence per day (C to G) from late 2019 to end-2020.** The median cumulative incidence, incident cases per day and age-specific incidence per day are represented as solid lines. The 25th and 75th percentile outbreaks are represented by the shaded area in the cumulative incidence. Theoretical no intervention (black line), school break and Lunar New Year (blue line) and intense control measures that are relaxed in a staggered fashion at the beginning of March (red line), and intense control measured that are relaxed in a staggered fashion at the beginning of April (orange line). Shading indicates the timing of the school holidays, Lunar New Year weekend (dark vertical line), intense control measures (dark grey), and staggered return to work followed by school opening (lighter grey)._", out.width = '80%'}
87 | knitr::include_graphics("../plots/fig_4.png")
88 | ```
89 |
90 | These measures were most effective if staggered return to work was at the beginning of April; this reduced the median number of infections by more than 92% (interquartile range: 66–97%) and 24% (interquartile range: 13–90%) in mid-2020 and end-2020, respectively, (Fig 5 and Fig S4) should the disease have a longer duration of infectiousness, and reduced the magnitude and delayed the peak incidence across all age categories (Fig 4C–E) which can have further beneficial impact by relieving the pressure on the healthcare system in the immediate few months. Uncertainty in $R_o$ values has a large impact on the timing of the peak and the final size of the outbreak (Fig 4A).
91 |
92 | ## Discussion
93 |
94 | This study describes a mathematical model that quantifies the potential impacts of social distancing policies, relying on Wuhan as a case study. Epidemiological investigations conducted during the WHO-China Joint Mission on COVID-19 found many infections clustered around the households.(35) Extreme social distancing measures, including school closures, workplace closures, and avoiding any public gatherings all at once, can push the transmission to households leading to increased clustering in household cases.(5) As households are not explicitly included in the model, we do not consider heterogeneity and clustering of household transmission. Distinguishing between repeated and new contacts is important for disease propagation in contact network models,(36,37) more sophisticated methods accounting for temporal presence within the household(38) would be needed to characterise higher degrees of contact. Our compartmental model does not capture individual-level heterogeneity in contacts, which could be important in super-spreading events, particularly early on in an epidemic. In combination with nosocomial infections, the risk of COVID-19 infections is potentially amplified in close contacts of confirmed cases and healthcare workers. However, the compartmental model we presented is not equipped to explicitly consider transmission within health care institutions and households. More complex models, such as individual-based models with familial and healthcare structures, should be explored. Further research on the nosocomial infection risks among healthcare workers and patients have been identified as one of the research gaps to be prioritised in the next few months by the WHO.
95 |
96 | While the precise estimates of the impact of interventions may vary by country and indeed different estimates of key parameters, our model highlights the usefulness of social distancing interventions as well as the need to carefully calibrate their lifting to avoid second and subsequent waves of a COVID-19 epidemic. Non-Hubei China, and other east or southeast Asian regions have managed to avert a major outbreak locally and delayed the peak without resorting to Hubei’s extreme measures.(39) Policymakers are advised to reapportion their resources to focus on mitigating the impact of their potentially soon-do-be overwhelmed health system.(40)
97 |
98 |
99 | ## References
100 |
101 | For cited articles and referenced figures (other than Figures 1, 3 and 4 which appear here, please see the preprint of the accepted paper [here:](https://www.medrxiv.org/content/10.1101/2020.03.09.20033050v1))
--------------------------------------------------------------------------------
/codes/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kieshaprem/covid19-agestructureSEIR-wuhan-social-distancing/092dded2cc45967f665a3f0d3f3e41f6e5a3f6b6/codes/.DS_Store
--------------------------------------------------------------------------------
/codes/0_master.r:
--------------------------------------------------------------------------------
1 | # load relevant the data files
2 | source('codes/1_loadData.r')
3 |
4 | # source the age-structured SEIcIscR model functions
5 | source('codes/function_modelSEIcIscR.r')
6 |
7 | # source the age-structured SEIcIscR model functions
8 | source('codes/function_postprocessing.r')
9 |
10 | # simulate N oubtreaks
11 | source('codes/2_simOutbreak_ncov_SEIR.r')
12 | source('codes/2_simOutbreak_ncov_SEIcIscR.r')
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/codes/1_loadData.r:
--------------------------------------------------------------------------------
1 | require(data.table)
2 | require(Matrix)
3 | require(matrixcalc)
4 |
5 | ## load data: Wuhan's population age structure and Contact matrices
6 |
7 | loadPopData = TRUE
8 | loadContactMatrices = TRUE
9 | loadCaseData =TRUE
10 | loadR0posterior =TRUE
11 |
12 |
13 | ## load data: Population age structure (currently using China's) and Contact matrices
14 |
15 | # 1) population data
16 | if(loadPopData)
17 | {
18 | wuhanpop = read.csv('data/wuhanpop.csv',as.is = TRUE)
19 | }
20 |
21 | # 2) (projected) contact matrices
22 | ### Acknowlegments: codes from Petra Klepac (petrakle)
23 | normalize.contact.matrices <- function(C, popv, make.sym = F){
24 | # FUN normalize them so that
25 | # the matrix with all the contacts is normalized so that its dominant eigenvalue is 1
26 | # and other matrices keep their contributions
27 | if (make.sym){
28 | Csym <- lapply(C, function(x, popv) (x + t(x)*((popv)%*%t(1/popv)))/2, popv) # make sure contacts are reciprocal
29 | } else {
30 | Csym <- C # if make.sym = F leave it as is
31 | }
32 | eig1 <- Re(eigen(Csym["all"]$all)$value[1]) # save dominant eigenvalue of the matrix with all contacts
33 |
34 | # divide all matrices by the real part of the dominant matrix of all of the contacts
35 | # that way all the rescaled matrices still sum to C_all = C_work + C_home + C_school + C_other
36 | Cnorm <- lapply(Csym, function(x,eig1) x/eig1, eig1)
37 |
38 | return(Cnorm)
39 | }
40 |
41 | # Synthetic contact matrices for China from Prem, Cook and Jit (2017) https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1005697
42 | if(loadContactMatrices)
43 | {
44 | load(paste0('data/contacts_china.rdata'))
45 | contacts <- contacts_china # normalize.contact.matrices(contacts_china,wuhanpop$popage, make.sym=T)
46 | rm(contacts_china)
47 | }
48 |
49 | # case age distribution
50 | if(loadCaseData)
51 | {
52 | wuhancaseraw = read.csv('data/wuhan_pop_case_dist.csv',as.is = TRUE)
53 | caseage = rep(wuhancaseraw$wuhan,each=2)/2
54 | wuhancase = data.frame(agegroup = 1:16, caseage = c(caseage[1:15],sum(caseage[16:20])))
55 | rm(wuhancaseraw,caseage)
56 | }
57 |
58 | if(loadR0posterior)
59 | {
60 | # --- read in R0 posterior
61 | R0_plot <-read.csv(paste0("data/out_R0.csv"))
62 | R0_dates <- read.csv(paste0('data/out_date.csv'))
63 | start_date <- as.Date(R0_dates[1,1]) # first case
64 | end_date <- as.Date(R0_dates[nrow(R0_dates),1]) # period to forecast ahead
65 | date_range <- seq.Date(start_date,end_date,1)
66 |
67 | # extract all estimates from 01.01.2020 - 23.01.2020
68 | R0_posterior <- R0_plot[which(date_range == as.Date("2020-01-01") ):which(date_range == as.Date("2020-01-23")),]
69 | range(R0_posterior)
70 | r0posterior = as.vector((unlist(R0_posterior)))
71 | par(mfrow=c(2,1))
72 | R0_dense = (density((r0posterior)))
73 | plot(x = R0_dense$x,y=R0_dense$y,type='l',xlab='R0',ylab='Density',lwd=2)
74 | R0_dense = (density(log(r0posterior)))
75 | plot(x = R0_dense$x,y=R0_dense$y,type='l',xlab='ln(R0)',ylab='Density',lwd=2)
76 |
77 |
78 | rm(R0_dense,R0_plot,R0_posterior,date_range,end_date,start_date)
79 |
80 | }
81 |
82 |
83 | rm(loadContactMatrices,loadPopData,loadR0posterior,loadCaseData)
84 |
--------------------------------------------------------------------------------
/codes/2_simOutbreak_ncov_SEIR.r:
--------------------------------------------------------------------------------
1 | ## To simulate n_simSEIR outbreaks
2 |
3 | nsim = 200
4 |
5 | set.seed(123)
6 | r0postCrI = r0posterior
7 | # hist(r0postCrI)
8 | # summary(r0postCrI)
9 | R0est = sample(x = r0postCrI,size = nsim)
10 | # print(R0est)
11 |
12 | ## To simulate n_simSEIR outbreaks: duration of infection = 3 days, initial infected n=~200 infected
13 | epi_doNothingDurInf3 = vector('list',nsim)
14 | epi_baseDurInf3 = vector('list',nsim)
15 | epi_marchDurInf3 = vector('list',nsim)
16 | epi_aprilDurInf3 = vector('list',nsim)
17 | start = Sys.time()
18 | durInfSim = 3
19 | initialI = 0.0002
20 | for(sim in 1:nsim)
21 | {
22 | epi_doNothingDurInf3[[sim]] = simulateOutbreakSEIR(R0t =R0est[sim] ,rho = rep(0.5,3660),dateStartSchoolClosure = as.Date('2019-11-01'),
23 | dateStartIntenseIntervention = as.Date('2019-11-01'), dateEndIntenseIntervention = as.Date('2019-11-01'),
24 | pWorkOpen = c(1,1,1,1),numWeekStagger = c(0,0,0),pInfected=initialI,durInf = durInfSim)
25 | epi_baseDurInf3[[sim]] = simulateOutbreakSEIR(R0t =R0est[sim] ,rho = rep(0.5,3660),dateEndIntenseIntervention = as.Date('2020-01-31'),pWorkOpen = c(0.1,0.75,1,1),
26 | numWeekStagger = c(10/7,10/7,10/7),pInfected=initialI,durInf = durInfSim)
27 | epi_marchDurInf3[[sim]] = simulateOutbreakSEIR(R0t =R0est[sim] ,rho = rep(0.5,3660),dateEndIntenseIntervention = as.Date('2020-03-01'),
28 | pInfected=initialI,durInf = durInfSim)
29 | epi_aprilDurInf3[[sim]] = simulateOutbreakSEIR(R0t =R0est[sim] ,rho = rep(0.5,3660),dateEndIntenseIntervention = as.Date('2020-04-01'),
30 | pInfected=initialI,durInf = durInfSim)
31 | if(sim%%10==0) print(paste0('Done with simulation ',sim))
32 | }
33 | end = Sys.time()
34 | print(end-start)
35 |
36 | covid_SDurInf3 = list()
37 | covid_SDurInf3[[1]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_doNothingDurInf3)
38 | covid_SDurInf3[[2]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_baseDurInf3)
39 | covid_SDurInf3[[3]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_marchDurInf3)
40 | covid_SDurInf3[[4]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_aprilDurInf3)
41 |
42 | covid_IDurInf3 = list()
43 | covid_IDurInf3[[1]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_doNothingDurInf3)
44 | covid_IDurInf3[[2]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_baseDurInf3)
45 | covid_IDurInf3[[3]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_marchDurInf3)
46 | covid_IDurInf3[[4]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_aprilDurInf3)
47 |
48 | peaktime_DurInf3 = list()
49 | peaktime_DurInf3[[1]] = summarisePeakTimePeakSize(SIMS = epi_doNothingDurInf3)
50 | peaktime_DurInf3[[2]] = summarisePeakTimePeakSize(SIMS = epi_baseDurInf3)
51 | peaktime_DurInf3[[3]] = summarisePeakTimePeakSize(SIMS = epi_marchDurInf3)
52 | peaktime_DurInf3[[4]] = summarisePeakTimePeakSize(SIMS = epi_aprilDurInf3)
53 |
54 | covid_DurInf3 = list()
55 | covid_DurInf3[[1]] = summariseSimulations_mid(CI = 50,SIMS = epi_doNothingDurInf3)
56 | covid_DurInf3[[2]] = summariseSimulations_mid(CI = 50,SIMS = epi_baseDurInf3)
57 | covid_DurInf3[[3]] = summariseSimulations_mid(CI = 50,SIMS = epi_marchDurInf3)
58 | covid_DurInf3[[4]] = summariseSimulations_mid(CI = 50,SIMS = epi_aprilDurInf3)
59 |
60 | AGEcovid_IDurInf3 = list()
61 | AGEcovid_IDurInf3[[1]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_doNothingDurInf3)
62 | AGEcovid_IDurInf3[[2]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_baseDurInf3)
63 | AGEcovid_IDurInf3[[3]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_marchDurInf3)
64 | AGEcovid_IDurInf3[[4]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_aprilDurInf3)
65 |
66 | epiFirstSimDurInf3 = list(epi_doNothingDurInf3 = epi_doNothingDurInf3[[1]],
67 | epi_baseDurInf3= epi_baseDurInf3[[1]],
68 | epi_marchDurInf3 = epi_marchDurInf3[[1]],
69 | epi_aprilDurInf3 = epi_aprilDurInf3[[1]])
70 |
71 |
72 |
73 | ## To simulate n_simSEIR outbreaks: duration of infection = 7 days, initial infected n=~200 infected
74 |
75 | epi_doNothingDurInf7 = vector('list',nsim)
76 | epi_baseDurInf7 = vector('list',nsim)
77 | epi_marchDurInf7 = vector('list',nsim)
78 | epi_aprilDurInf7 = vector('list',nsim)
79 | start = Sys.time()
80 | durInfSim = 7
81 | initialI = 0.0002
82 | for(sim in 1:nsim)
83 | {
84 | epi_doNothingDurInf7[[sim]] = simulateOutbreakSEIR(R0t =R0est[sim] ,rho = rep(0.5,3660),dateStartSchoolClosure = as.Date('2019-11-01'),
85 | dateStartIntenseIntervention = as.Date('2019-11-01'), dateEndIntenseIntervention = as.Date('2019-11-01'),
86 | pWorkOpen = c(1,1,1,1),numWeekStagger = c(0,0,0,0),pInfected=initialI,durInf = durInfSim)
87 | epi_baseDurInf7[[sim]] = simulateOutbreakSEIR(R0t =R0est[sim] ,rho = rep(0.5,3660),dateEndIntenseIntervention = as.Date('2020-01-31'),pWorkOpen = c(0.1,0.75,1,1),
88 | numWeekStagger = c(10/7,10/7,10/7),pInfected=initialI,durInf = durInfSim)
89 | epi_marchDurInf7[[sim]] = simulateOutbreakSEIR(R0t =R0est[sim] ,rho = rep(0.5,3660),dateEndIntenseIntervention = as.Date('2020-03-01'),
90 | pInfected=initialI,durInf = durInfSim)
91 | epi_aprilDurInf7[[sim]] = simulateOutbreakSEIR(R0t =R0est[sim] ,rho = rep(0.5,3660),dateEndIntenseIntervention = as.Date('2020-04-01'),
92 | pInfected=initialI,durInf = durInfSim)
93 | if(sim%%10==0) print(paste0('Done with simulation ',sim))
94 | }
95 | end = Sys.time()
96 | print(end-start)
97 |
98 | covid_SDurInf7 = list()
99 | covid_SDurInf7[[1]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_doNothingDurInf7)
100 | covid_SDurInf7[[2]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_baseDurInf7)
101 | covid_SDurInf7[[3]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_marchDurInf7)
102 | covid_SDurInf7[[4]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_aprilDurInf7)
103 |
104 | covid_IDurInf7 = list()
105 | covid_IDurInf7[[1]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_doNothingDurInf7)
106 | covid_IDurInf7[[2]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_baseDurInf7)
107 | covid_IDurInf7[[3]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_marchDurInf7)
108 | covid_IDurInf7[[4]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_aprilDurInf7)
109 |
110 | peaktime_DurInf7 = list()
111 | peaktime_DurInf7[[1]] = summarisePeakTimePeakSize(SIMS = epi_doNothingDurInf7)
112 | peaktime_DurInf7[[2]] = summarisePeakTimePeakSize(SIMS = epi_baseDurInf7)
113 | peaktime_DurInf7[[3]] = summarisePeakTimePeakSize(SIMS = epi_marchDurInf7)
114 | peaktime_DurInf7[[4]] = summarisePeakTimePeakSize(SIMS = epi_aprilDurInf7)
115 |
116 | covid_DurInf7 = list()
117 | covid_DurInf7[[1]] = summariseSimulations_mid(CI = 50,SIMS = epi_doNothingDurInf7)
118 | covid_DurInf7[[2]] = summariseSimulations_mid(CI = 50,SIMS = epi_baseDurInf7)
119 | covid_DurInf7[[3]] = summariseSimulations_mid(CI = 50,SIMS = epi_marchDurInf7)
120 | covid_DurInf7[[4]] = summariseSimulations_mid(CI = 50,SIMS = epi_aprilDurInf7)
121 |
122 | AGEcovid_IDurInf7 = list()
123 | AGEcovid_IDurInf7[[1]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_doNothingDurInf7)
124 | AGEcovid_IDurInf7[[2]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_baseDurInf7)
125 | AGEcovid_IDurInf7[[3]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_marchDurInf7)
126 | AGEcovid_IDurInf7[[4]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_aprilDurInf7)
127 |
128 | epiFirstSimDurInf7 = list(epi_doNothingDurInf7 = epi_doNothingDurInf7[[1]],
129 | epi_baseDurInf7= epi_baseDurInf7[[1]],
130 | epi_marchDurInf7 = epi_marchDurInf7[[1]],
131 | epi_aprilDurInf7 = epi_aprilDurInf7[[1]])
132 |
133 | save(covid_IDurInf3,file = 'outputs/SEIR/covid_IDurInf3.rdata')
134 | save(covid_SDurInf3,file = 'outputs/SEIR/covid_SDurInf3.rdata')
135 | save(covid_IDurInf7,file = 'outputs/SEIR/covid_IDurInf7.rdata')
136 | save(covid_SDurInf7,file = 'outputs/SEIR/covid_SDurInf7.rdata')
137 |
138 | save(peaktime_DurInf3,file = 'outputs/SEIR/peaktime_DurInf3.rdata')
139 | save(peaktime_DurInf7,file = 'outputs/SEIR/peaktime_DurInf7.rdata')
140 |
141 | save(covid_DurInf3,file ='outputs/SEIR/covid_DurInf3.rdata')
142 | save(covid_DurInf7,file ='outputs/SEIR/covid_DurInf7.rdata')
143 |
144 | save(AGEcovid_IDurInf3,file ='outputs/SEIR/AGEcovid_IDurInf3.rdata')
145 | save(AGEcovid_IDurInf7,file ='outputs/SEIR/AGEcovid_IDurInf7.rdata')
146 |
147 | save(epiFirstSimDurInf3,file ='outputs/SEIR/epiFirstSimDurInf3.rdata')
148 | save(epiFirstSimDurInf7,file ='outputs/SEIR/epiFirstSimDurInf7.rdata')
149 |
150 | rm(epi_doNothingDurInf3,epi_baseDurInf3,epi_marchDurInf3,epi_aprilDurInf3)
151 | rm(epi_doNothingDurInf7,epi_baseDurInf7,epi_marchDurInf7,epi_aprilDurInf7)
152 |
153 |
154 | ## To simulate n_simSEIR outbreaks: duration of infection = 3 days, initial infected n=~2000 infected
155 | epi_doNothingDurInf3I2000 = vector('list',nsim)
156 | epi_baseDurInf3I2000 = vector('list',nsim)
157 | epi_marchDurInf3I2000 = vector('list',nsim)
158 | epi_aprilDurInf3I2000 = vector('list',nsim)
159 | start = Sys.time()
160 | durInfSim = 3
161 | initialI = 0.002
162 | for(sim in 1:nsim)
163 | {
164 | epi_doNothingDurInf3I2000[[sim]] = simulateOutbreakSEIR(R0t =R0est[sim] ,rho = rep(0.5,3660),dateStartSchoolClosure = as.Date('2019-11-01'),
165 | dateStartIntenseIntervention = as.Date('2019-11-01'), dateEndIntenseIntervention = as.Date('2019-11-01'),
166 | pWorkOpen = c(1,1,1,1),numWeekStagger = c(0,0,0),pInfected=initialI,durInf = durInfSim)
167 | epi_baseDurInf3I2000[[sim]] = simulateOutbreakSEIR(R0t =R0est[sim] ,rho = rep(0.5,3660),dateEndIntenseIntervention = as.Date('2020-01-31'),pWorkOpen = c(0.1,0.75,1,1),
168 | numWeekStagger = c(10/7,10/7,10/7),pInfected=initialI,durInf = durInfSim)
169 | epi_marchDurInf3I2000[[sim]] = simulateOutbreakSEIR(R0t =R0est[sim] ,rho = rep(0.5,3660),dateEndIntenseIntervention = as.Date('2020-03-01'),
170 | pInfected=initialI,durInf = durInfSim)
171 | epi_aprilDurInf3I2000[[sim]] = simulateOutbreakSEIR(R0t =R0est[sim] ,rho = rep(0.5,3660),dateEndIntenseIntervention = as.Date('2020-04-01'),
172 | pInfected=initialI,durInf = durInfSim)
173 | if(sim%%10==0) print(paste0('Done with simulation ',sim))
174 | }
175 | end = Sys.time()
176 | print(end-start)
177 |
178 | covid_SDurInf3I2000 = list()
179 | covid_SDurInf3I2000[[1]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_doNothingDurInf3I2000)
180 | covid_SDurInf3I2000[[2]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_baseDurInf3I2000)
181 | covid_SDurInf3I2000[[3]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_marchDurInf3I2000)
182 | covid_SDurInf3I2000[[4]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_aprilDurInf3I2000)
183 |
184 | covid_IDurInf3I2000 = list()
185 | covid_IDurInf3I2000[[1]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_doNothingDurInf3I2000)
186 | covid_IDurInf3I2000[[2]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_baseDurInf3I2000)
187 | covid_IDurInf3I2000[[3]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_marchDurInf3I2000)
188 | covid_IDurInf3I2000[[4]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_aprilDurInf3I2000)
189 |
190 | peaktime_DurInf3I2000 = list()
191 | peaktime_DurInf3I2000[[1]] = summarisePeakTimePeakSize(SIMS = epi_doNothingDurInf3I2000)
192 | peaktime_DurInf3I2000[[2]] = summarisePeakTimePeakSize(SIMS = epi_baseDurInf3I2000)
193 | peaktime_DurInf3I2000[[3]] = summarisePeakTimePeakSize(SIMS = epi_marchDurInf3I2000)
194 | peaktime_DurInf3I2000[[4]] = summarisePeakTimePeakSize(SIMS = epi_aprilDurInf3I2000)
195 |
196 | covid_DurInf3I2000 = list()
197 | covid_DurInf3I2000[[1]] = summariseSimulations_mid(CI = 50,SIMS = epi_doNothingDurInf3I2000)
198 | covid_DurInf3I2000[[2]] = summariseSimulations_mid(CI = 50,SIMS = epi_baseDurInf3I2000)
199 | covid_DurInf3I2000[[3]] = summariseSimulations_mid(CI = 50,SIMS = epi_marchDurInf3I2000)
200 | covid_DurInf3I2000[[4]] = summariseSimulations_mid(CI = 50,SIMS = epi_aprilDurInf3I2000)
201 |
202 | AGEcovid_IDurInf3I2000 = list()
203 | AGEcovid_IDurInf3I2000[[1]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_doNothingDurInf3I2000)
204 | AGEcovid_IDurInf3I2000[[2]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_baseDurInf3I2000)
205 | AGEcovid_IDurInf3I2000[[3]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_marchDurInf3I2000)
206 | AGEcovid_IDurInf3I2000[[4]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_aprilDurInf3I2000)
207 |
208 | epiFirstSimDurInf3I2000 = list(epi_doNothingDurInf3I2000 = epi_doNothingDurInf3I2000[[1]],
209 | epi_baseDurInf3I2000= epi_baseDurInf3I2000[[1]],
210 | epi_marchDurInf3I2000 = epi_marchDurInf3I2000[[1]],
211 | epi_aprilDurInf3I2000 = epi_aprilDurInf3I2000[[1]])
212 |
213 |
214 |
215 | ## To simulate n_simSEIR outbreaks: duration of infection = 7 days, initial infected n=~2000 infected
216 |
217 | epi_doNothingDurInf7I2000 = vector('list',nsim)
218 | epi_baseDurInf7I2000 = vector('list',nsim)
219 | epi_marchDurInf7I2000 = vector('list',nsim)
220 | epi_aprilDurInf7I2000 = vector('list',nsim)
221 | start = Sys.time()
222 | durInfSim = 7
223 | initialI = 0.002
224 | for(sim in 1:nsim)
225 | {
226 | epi_doNothingDurInf7I2000[[sim]] = simulateOutbreakSEIR(R0t =R0est[sim] ,rho = rep(0.5,3660),dateStartSchoolClosure = as.Date('2019-11-01'),
227 | dateStartIntenseIntervention = as.Date('2019-11-01'), dateEndIntenseIntervention = as.Date('2019-11-01'),
228 | pWorkOpen = c(1,1,1,1),numWeekStagger = c(0,0,0),pInfected=initialI,durInf = durInfSim)
229 | epi_baseDurInf7I2000[[sim]] = simulateOutbreakSEIR(R0t =R0est[sim] ,rho = rep(0.5,3660),dateEndIntenseIntervention = as.Date('2020-01-31'),pWorkOpen = c(0.1,0.75,1,1),
230 | numWeekStagger = c(10/7,10/7,10/7),pInfected=initialI,durInf = durInfSim)
231 | epi_marchDurInf7I2000[[sim]] = simulateOutbreakSEIR(R0t =R0est[sim] ,rho = rep(0.5,3660),dateEndIntenseIntervention = as.Date('2020-03-01'),
232 | pInfected=initialI,durInf = durInfSim)
233 | epi_aprilDurInf7I2000[[sim]] = simulateOutbreakSEIR(R0t =R0est[sim] ,rho = rep(0.5,3660),dateEndIntenseIntervention = as.Date('2020-04-01'),
234 | pInfected=initialI,durInf = durInfSim)
235 | if(sim%%10==0) print(paste0('Done with simulation ',sim))
236 | }
237 | end = Sys.time()
238 | print(end-start)
239 |
240 | covid_SDurInf7I2000 = list()
241 | covid_SDurInf7I2000[[1]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_doNothingDurInf7I2000)
242 | covid_SDurInf7I2000[[2]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_baseDurInf7I2000)
243 | covid_SDurInf7I2000[[3]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_marchDurInf7I2000)
244 | covid_SDurInf7I2000[[4]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_aprilDurInf7I2000)
245 |
246 | covid_IDurInf7I2000 = list()
247 | covid_IDurInf7I2000[[1]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_doNothingDurInf7I2000)
248 | covid_IDurInf7I2000[[2]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_baseDurInf7I2000)
249 | covid_IDurInf7I2000[[3]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_marchDurInf7I2000)
250 | covid_IDurInf7I2000[[4]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_aprilDurInf7I2000)
251 |
252 | peaktime_DurInf7I2000 = list()
253 | peaktime_DurInf7I2000[[1]] = summarisePeakTimePeakSize(SIMS = epi_doNothingDurInf7I2000)
254 | peaktime_DurInf7I2000[[2]] = summarisePeakTimePeakSize(SIMS = epi_baseDurInf7I2000)
255 | peaktime_DurInf7I2000[[3]] = summarisePeakTimePeakSize(SIMS = epi_marchDurInf7I2000)
256 | peaktime_DurInf7I2000[[4]] = summarisePeakTimePeakSize(SIMS = epi_aprilDurInf7I2000)
257 |
258 | covid_DurInf7I2000 = list()
259 | covid_DurInf7I2000[[1]] = summariseSimulations_mid(CI = 50,SIMS = epi_doNothingDurInf7I2000)
260 | covid_DurInf7I2000[[2]] = summariseSimulations_mid(CI = 50,SIMS = epi_baseDurInf7I2000)
261 | covid_DurInf7I2000[[3]] = summariseSimulations_mid(CI = 50,SIMS = epi_marchDurInf7I2000)
262 | covid_DurInf7I2000[[4]] = summariseSimulations_mid(CI = 50,SIMS = epi_aprilDurInf7I2000)
263 |
264 | AGEcovid_IDurInf7I2000 = list()
265 | AGEcovid_IDurInf7I2000[[1]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_doNothingDurInf7I2000)
266 | AGEcovid_IDurInf7I2000[[2]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_baseDurInf7I2000)
267 | AGEcovid_IDurInf7I2000[[3]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_marchDurInf7I2000)
268 | AGEcovid_IDurInf7I2000[[4]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_aprilDurInf7I2000)
269 |
270 | epiFirstSimDurInf7I2000 = list(epi_doNothingDurInf7I2000 = epi_doNothingDurInf7I2000[[1]],
271 | epi_baseDurInf7I2000= epi_baseDurInf7I2000[[1]],
272 | epi_marchDurInf7I2000 = epi_marchDurInf7I2000[[1]],
273 | epi_aprilDurInf7I2000 = epi_aprilDurInf7I2000[[1]])
274 |
275 | save(covid_IDurInf3I2000,file = 'outputs/SEIR/covid_IDurInf3I2000.rdata')
276 | save(covid_SDurInf3I2000,file = 'outputs/SEIR/covid_SDurInf3I2000.rdata')
277 | save(covid_IDurInf7I2000,file = 'outputs/SEIR/covid_IDurInf7I2000.rdata')
278 | save(covid_SDurInf7I2000,file = 'outputs/SEIR/covid_SDurInf7I2000.rdata')
279 |
280 | save(peaktime_DurInf3I2000,file = 'outputs/SEIR/peaktime_DurInf3I2000.rdata')
281 | save(peaktime_DurInf7I2000,file = 'outputs/SEIR/peaktime_DurInf7I2000.rdata')
282 |
283 | save(covid_DurInf3I2000,file ='outputs/SEIR/covid_DurInf3I2000.rdata')
284 | save(covid_DurInf7I2000,file ='outputs/SEIR/covid_DurInf7I2000.rdata')
285 |
286 | save(AGEcovid_IDurInf3I2000,file ='outputs/SEIR/AGEcovid_IDurInf3I2000.rdata')
287 | save(AGEcovid_IDurInf7I2000,file ='outputs/SEIR/AGEcovid_IDurInf7I2000.rdata')
288 |
289 | save(epiFirstSimDurInf3I2000,file ='outputs/SEIR/epiFirstSimDurInf3I2000.rdata')
290 | save(epiFirstSimDurInf7I2000,file ='outputs/SEIR/epiFirstSimDurInf7I2000.rdata')
291 |
292 | rm(epi_doNothingDurInf3I2000,epi_baseDurInf3I2000,epi_marchDurInf3I2000,epi_aprilDurInf3I2000)
293 | rm(epi_doNothingDurInf7I2000,epi_baseDurInf7I2000,epi_marchDurInf7I2000,epi_aprilDurInf7I2000)
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
--------------------------------------------------------------------------------
/codes/2_simOutbreak_ncov_SEIcIscR.r:
--------------------------------------------------------------------------------
1 | ## To simulate n_simSEIcIscR outbreaks
2 |
3 | nsim = 200
4 |
5 | set.seed(123)
6 | r0postCrI = r0posterior
7 | # hist(r0postCrI)
8 | # summary(r0postCrI)
9 | R0est = sample(x = r0postCrI,size = nsim)
10 | # print(R0est)
11 |
12 | ## To simulate n_sim SEIcIscR outbreaks: duration of infection = 3 days, initial infected n=~200 infected
13 | epi_doNothingDurInf3 = vector('list',nsim)
14 | epi_baseDurInf3 = vector('list',nsim)
15 | epi_marchDurInf3 = vector('list',nsim)
16 | epi_aprilDurInf3 = vector('list',nsim)
17 | start = Sys.time()
18 | durInfSim = 3
19 | initialI = 0.0002
20 | for(sim in 1:nsim)
21 | {
22 | epi_doNothingDurInf3[[sim]] = simulateOutbreakSEIcIscR(R0t =R0est[sim] ,dateStartSchoolClosure = as.Date('2019-11-01'),
23 | dateStartIntenseIntervention = as.Date('2019-11-01'), dateEndIntenseIntervention = as.Date('2019-11-01'),
24 | pWorkOpen = c(1,1,1,1),numWeekStagger = c(0,0,0),pInfected=initialI,durInf = durInfSim)
25 | epi_baseDurInf3[[sim]] = simulateOutbreakSEIcIscR(R0t =R0est[sim] ,dateEndIntenseIntervention = as.Date('2020-01-31'),pWorkOpen = c(0.1,0.75,1,1),
26 | numWeekStagger = c(10/7,10/7,10/7),pInfected=initialI,durInf = durInfSim)
27 | epi_marchDurInf3[[sim]] = simulateOutbreakSEIcIscR(R0t =R0est[sim] ,dateEndIntenseIntervention = as.Date('2020-03-01'),
28 | pInfected=initialI,durInf = durInfSim)
29 | epi_aprilDurInf3[[sim]] = simulateOutbreakSEIcIscR(R0t =R0est[sim] ,dateEndIntenseIntervention = as.Date('2020-04-01'),
30 | pInfected=initialI,durInf = durInfSim)
31 | if(sim%%10==0) print(paste0('Done with simulation ',sim))
32 | }
33 | end = Sys.time()
34 | print(end-start)
35 |
36 | covid_SDurInf3sc = list()
37 | covid_SDurInf3sc[[1]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_doNothingDurInf3)
38 | covid_SDurInf3sc[[2]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_baseDurInf3)
39 | covid_SDurInf3sc[[3]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_marchDurInf3)
40 | covid_SDurInf3sc[[4]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_aprilDurInf3)
41 |
42 | covid_IDurInf3sc = list()
43 | covid_IDurInf3sc[[1]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_doNothingDurInf3)
44 | covid_IDurInf3sc[[2]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_baseDurInf3)
45 | covid_IDurInf3sc[[3]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_marchDurInf3)
46 | covid_IDurInf3sc[[4]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_aprilDurInf3)
47 |
48 | peaktime_DurInf3sc = list()
49 | peaktime_DurInf3sc[[1]] = summarisePeakTimePeakSize(SIMS = epi_doNothingDurInf3)
50 | peaktime_DurInf3sc[[2]] = summarisePeakTimePeakSize(SIMS = epi_baseDurInf3)
51 | peaktime_DurInf3sc[[3]] = summarisePeakTimePeakSize(SIMS = epi_marchDurInf3)
52 | peaktime_DurInf3sc[[4]] = summarisePeakTimePeakSize(SIMS = epi_aprilDurInf3)
53 |
54 | covid_DurInf3sc = list()
55 | covid_DurInf3sc[[1]] = summariseSimulations_mid(CI = 50,SIMS = epi_doNothingDurInf3)
56 | covid_DurInf3sc[[2]] = summariseSimulations_mid(CI = 50,SIMS = epi_baseDurInf3)
57 | covid_DurInf3sc[[3]] = summariseSimulations_mid(CI = 50,SIMS = epi_marchDurInf3)
58 | covid_DurInf3sc[[4]] = summariseSimulations_mid(CI = 50,SIMS = epi_aprilDurInf3)
59 |
60 | AGEcovid_IDurInf3sc = list()
61 | AGEcovid_IDurInf3sc[[1]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_doNothingDurInf3)
62 | AGEcovid_IDurInf3sc[[2]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_baseDurInf3)
63 | AGEcovid_IDurInf3sc[[3]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_marchDurInf3)
64 | AGEcovid_IDurInf3sc[[4]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_aprilDurInf3)
65 |
66 | epiFirstSimDurInf3sc = list(epi_doNothingDurInf3 = epi_doNothingDurInf3[[1]],
67 | epi_baseDurInf3= epi_baseDurInf3[[1]],
68 | epi_marchDurInf3 = epi_marchDurInf3[[1]],
69 | epi_aprilDurInf3 = epi_aprilDurInf3[[1]])
70 |
71 |
72 |
73 | ## To simulate n_simSEIcIscR outbreaks: duration of infection = 7 days, initial infected n=~200 infected
74 |
75 | epi_doNothingDurInf7 = vector('list',nsim)
76 | epi_baseDurInf7 = vector('list',nsim)
77 | epi_marchDurInf7 = vector('list',nsim)
78 | epi_aprilDurInf7 = vector('list',nsim)
79 | start = Sys.time()
80 | durInfSim = 7
81 | initialI = 0.0002
82 | for(sim in 1:nsim)
83 | {
84 | epi_doNothingDurInf7[[sim]] = simulateOutbreakSEIcIscR(R0t =R0est[sim] ,dateStartSchoolClosure = as.Date('2019-11-01'),
85 | dateStartIntenseIntervention = as.Date('2019-11-01'), dateEndIntenseIntervention = as.Date('2019-11-01'),
86 | pWorkOpen = c(1,1,1,1),numWeekStagger = c(0,0,0,0),pInfected=initialI,durInf = durInfSim)
87 | epi_baseDurInf7[[sim]] = simulateOutbreakSEIcIscR(R0t =R0est[sim] ,dateEndIntenseIntervention = as.Date('2020-01-31'),pWorkOpen = c(0.1,0.75,1,1),
88 | numWeekStagger = c(10/7,10/7,10/7),pInfected=initialI,durInf = durInfSim)
89 | epi_marchDurInf7[[sim]] = simulateOutbreakSEIcIscR(R0t =R0est[sim] ,dateEndIntenseIntervention = as.Date('2020-03-01'),
90 | pInfected=initialI,durInf = durInfSim)
91 | epi_aprilDurInf7[[sim]] = simulateOutbreakSEIcIscR(R0t =R0est[sim] ,dateEndIntenseIntervention = as.Date('2020-04-01'),
92 | pInfected=initialI,durInf = durInfSim)
93 | if(sim%%10==0) print(paste0('Done with simulation ',sim))
94 | }
95 | end = Sys.time()
96 | print(end-start)
97 |
98 | covid_SDurInf7sc = list()
99 | covid_SDurInf7sc[[1]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_doNothingDurInf7)
100 | covid_SDurInf7sc[[2]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_baseDurInf7)
101 | covid_SDurInf7sc[[3]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_marchDurInf7)
102 | covid_SDurInf7sc[[4]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_aprilDurInf7)
103 |
104 | covid_IDurInf7sc = list()
105 | covid_IDurInf7sc[[1]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_doNothingDurInf7)
106 | covid_IDurInf7sc[[2]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_baseDurInf7)
107 | covid_IDurInf7sc[[3]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_marchDurInf7)
108 | covid_IDurInf7sc[[4]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_aprilDurInf7)
109 |
110 | peaktime_DurInf7sc = list()
111 | peaktime_DurInf7sc[[1]] = summarisePeakTimePeakSize(SIMS = epi_doNothingDurInf7)
112 | peaktime_DurInf7sc[[2]] = summarisePeakTimePeakSize(SIMS = epi_baseDurInf7)
113 | peaktime_DurInf7sc[[3]] = summarisePeakTimePeakSize(SIMS = epi_marchDurInf7)
114 | peaktime_DurInf7sc[[4]] = summarisePeakTimePeakSize(SIMS = epi_aprilDurInf7)
115 |
116 | covid_DurInf7sc = list()
117 | covid_DurInf7sc[[1]] = summariseSimulations_mid(CI = 50,SIMS = epi_doNothingDurInf7)
118 | covid_DurInf7sc[[2]] = summariseSimulations_mid(CI = 50,SIMS = epi_baseDurInf7)
119 | covid_DurInf7sc[[3]] = summariseSimulations_mid(CI = 50,SIMS = epi_marchDurInf7)
120 | covid_DurInf7sc[[4]] = summariseSimulations_mid(CI = 50,SIMS = epi_aprilDurInf7)
121 |
122 | AGEcovid_IDurInf7sc = list()
123 | AGEcovid_IDurInf7sc[[1]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_doNothingDurInf7)
124 | AGEcovid_IDurInf7sc[[2]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_baseDurInf7)
125 | AGEcovid_IDurInf7sc[[3]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_marchDurInf7)
126 | AGEcovid_IDurInf7sc[[4]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_aprilDurInf7)
127 |
128 | epiFirstSimDurInf7sc = list(epi_doNothingDurInf7 = epi_doNothingDurInf7[[1]],
129 | epi_baseDurInf7= epi_baseDurInf7[[1]],
130 | epi_marchDurInf7 = epi_marchDurInf7[[1]],
131 | epi_aprilDurInf7 = epi_aprilDurInf7[[1]])
132 |
133 | save(covid_IDurInf3sc,file = 'outputs/SEIcIscR/covid_IDurInf3.rdata')
134 | save(covid_SDurInf3sc,file = 'outputs/SEIcIscR/covid_SDurInf3.rdata')
135 | save(covid_IDurInf7sc,file = 'outputs/SEIcIscR/covid_IDurInf7.rdata')
136 | save(covid_SDurInf7sc,file = 'outputs/SEIcIscR/covid_SDurInf7.rdata')
137 |
138 | save(peaktime_DurInf3sc,file = 'outputs/SEIcIscR/peaktime_DurInf3.rdata')
139 | save(peaktime_DurInf7sc,file = 'outputs/SEIcIscR/peaktime_DurInf7.rdata')
140 |
141 | save(covid_DurInf3sc,file ='outputs/SEIcIscR/covid_DurInf3.rdata')
142 | save(covid_DurInf7sc,file ='outputs/SEIcIscR/covid_DurInf7.rdata')
143 |
144 | save(AGEcovid_IDurInf3sc,file ='outputs/SEIcIscR/AGEcovid_IDurInf3.rdata')
145 | save(AGEcovid_IDurInf7sc,file ='outputs/SEIcIscR/AGEcovid_IDurInf7.rdata')
146 |
147 | save(epiFirstSimDurInf3sc,file ='outputs/SEIcIscR/epiFirstSimDurInf3.rdata')
148 | save(epiFirstSimDurInf7sc,file ='outputs/SEIcIscR/epiFirstSimDurInf7.rdata')
149 |
150 | rm(epi_doNothingDurInf3,epi_baseDurInf3,epi_marchDurInf3,epi_aprilDurInf3)
151 | rm(epi_doNothingDurInf7,epi_baseDurInf7,epi_marchDurInf7,epi_aprilDurInf7)
152 |
153 |
154 | ## To simulate n_simSEIcIscR outbreaks: duration of infection = 3 days, initial infected n=~2000 infected
155 | epi_doNothingDurInf3I2000 = vector('list',nsim)
156 | epi_baseDurInf3I2000 = vector('list',nsim)
157 | epi_marchDurInf3I2000 = vector('list',nsim)
158 | epi_aprilDurInf3I2000 = vector('list',nsim)
159 | start = Sys.time()
160 | durInfSim = 3
161 | initialI = 0.002
162 | for(sim in 1:nsim)
163 | {
164 | epi_doNothingDurInf3I2000[[sim]] = simulateOutbreakSEIcIscR(R0t =R0est[sim] ,dateStartSchoolClosure = as.Date('2019-11-01'),
165 | dateStartIntenseIntervention = as.Date('2019-11-01'), dateEndIntenseIntervention = as.Date('2019-11-01'),
166 | pWorkOpen = c(1,1,1,1),numWeekStagger = c(0,0,0),pInfected=initialI,durInf = durInfSim)
167 | epi_baseDurInf3I2000[[sim]] = simulateOutbreakSEIcIscR(R0t =R0est[sim] ,dateEndIntenseIntervention = as.Date('2020-01-31'),pWorkOpen = c(0.1,0.75,1,1),
168 | numWeekStagger = c(10/7,10/7,10/7),pInfected=initialI,durInf = durInfSim)
169 | epi_marchDurInf3I2000[[sim]] = simulateOutbreakSEIcIscR(R0t =R0est[sim] ,dateEndIntenseIntervention = as.Date('2020-03-01'),
170 | pInfected=initialI,durInf = durInfSim)
171 | epi_aprilDurInf3I2000[[sim]] = simulateOutbreakSEIcIscR(R0t =R0est[sim] ,dateEndIntenseIntervention = as.Date('2020-04-01'),
172 | pInfected=initialI,durInf = durInfSim)
173 | if(sim%%10==0) print(paste0('Done with simulation ',sim))
174 | }
175 | end = Sys.time()
176 | print(end-start)
177 |
178 | covid_SDurInf3I2000sc = list()
179 | covid_SDurInf3I2000sc[[1]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_doNothingDurInf3I2000)
180 | covid_SDurInf3I2000sc[[2]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_baseDurInf3I2000)
181 | covid_SDurInf3I2000sc[[3]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_marchDurInf3I2000)
182 | covid_SDurInf3I2000sc[[4]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_aprilDurInf3I2000)
183 |
184 | covid_IDurInf3I2000sc = list()
185 | covid_IDurInf3I2000sc[[1]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_doNothingDurInf3I2000)
186 | covid_IDurInf3I2000sc[[2]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_baseDurInf3I2000)
187 | covid_IDurInf3I2000sc[[3]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_marchDurInf3I2000)
188 | covid_IDurInf3I2000sc[[4]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_aprilDurInf3I2000)
189 |
190 | peaktime_DurInf3I2000sc = list()
191 | peaktime_DurInf3I2000sc[[1]] = summarisePeakTimePeakSize(SIMS = epi_doNothingDurInf3I2000)
192 | peaktime_DurInf3I2000sc[[2]] = summarisePeakTimePeakSize(SIMS = epi_baseDurInf3I2000)
193 | peaktime_DurInf3I2000sc[[3]] = summarisePeakTimePeakSize(SIMS = epi_marchDurInf3I2000)
194 | peaktime_DurInf3I2000sc[[4]] = summarisePeakTimePeakSize(SIMS = epi_aprilDurInf3I2000)
195 |
196 | covid_DurInf3I2000sc = list()
197 | covid_DurInf3I2000sc[[1]] = summariseSimulations_mid(CI = 50,SIMS = epi_doNothingDurInf3I2000)
198 | covid_DurInf3I2000sc[[2]] = summariseSimulations_mid(CI = 50,SIMS = epi_baseDurInf3I2000)
199 | covid_DurInf3I2000sc[[3]] = summariseSimulations_mid(CI = 50,SIMS = epi_marchDurInf3I2000)
200 | covid_DurInf3I2000sc[[4]] = summariseSimulations_mid(CI = 50,SIMS = epi_aprilDurInf3I2000)
201 |
202 | AGEcovid_IDurInf3I2000sc = list()
203 | AGEcovid_IDurInf3I2000sc[[1]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_doNothingDurInf3I2000)
204 | AGEcovid_IDurInf3I2000sc[[2]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_baseDurInf3I2000)
205 | AGEcovid_IDurInf3I2000sc[[3]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_marchDurInf3I2000)
206 | AGEcovid_IDurInf3I2000sc[[4]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_aprilDurInf3I2000)
207 |
208 | epiFirstSimDurInf3I2000sc = list(epi_doNothingDurInf3I2000 = epi_doNothingDurInf3I2000[[1]],
209 | epi_baseDurInf3I2000= epi_baseDurInf3I2000[[1]],
210 | epi_marchDurInf3I2000 = epi_marchDurInf3I2000[[1]],
211 | epi_aprilDurInf3I2000 = epi_aprilDurInf3I2000[[1]])
212 |
213 |
214 |
215 | ## To simulate n_simSEIcIscR outbreaks: duration of infection = 7 days, initial infected n=~2000 infected
216 |
217 | epi_doNothingDurInf7I2000 = vector('list',nsim)
218 | epi_baseDurInf7I2000 = vector('list',nsim)
219 | epi_marchDurInf7I2000 = vector('list',nsim)
220 | epi_aprilDurInf7I2000 = vector('list',nsim)
221 | start = Sys.time()
222 | durInfSim = 7
223 | initialI = 0.002
224 | for(sim in 1:nsim)
225 | {
226 | epi_doNothingDurInf7I2000[[sim]] = simulateOutbreakSEIcIscR(R0t =R0est[sim] ,dateStartSchoolClosure = as.Date('2019-11-01'),
227 | dateStartIntenseIntervention = as.Date('2019-11-01'), dateEndIntenseIntervention = as.Date('2019-11-01'),
228 | pWorkOpen = c(1,1,1,1),numWeekStagger = c(0,0,0),pInfected=initialI,durInf = durInfSim)
229 | epi_baseDurInf7I2000[[sim]] = simulateOutbreakSEIcIscR(R0t =R0est[sim] ,dateEndIntenseIntervention = as.Date('2020-01-31'),pWorkOpen = c(0.1,0.75,1,1),
230 | numWeekStagger = c(10/7,10/7,10/7),pInfected=initialI,durInf = durInfSim)
231 | epi_marchDurInf7I2000[[sim]] = simulateOutbreakSEIcIscR(R0t =R0est[sim] ,dateEndIntenseIntervention = as.Date('2020-03-01'),
232 | pInfected=initialI,durInf = durInfSim)
233 | epi_aprilDurInf7I2000[[sim]] = simulateOutbreakSEIcIscR(R0t =R0est[sim] ,dateEndIntenseIntervention = as.Date('2020-04-01'),
234 | pInfected=initialI,durInf = durInfSim)
235 | if(sim%%10==0) print(paste0('Done with simulation ',sim))
236 | }
237 | end = Sys.time()
238 | print(end-start)
239 |
240 | covid_SDurInf7I2000sc = list()
241 | covid_SDurInf7I2000sc[[1]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_doNothingDurInf7I2000)
242 | covid_SDurInf7I2000sc[[2]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_baseDurInf7I2000)
243 | covid_SDurInf7I2000sc[[3]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_marchDurInf7I2000)
244 | covid_SDurInf7I2000sc[[4]] = summariseSimulations(VAR = 'S',CI = 50,SIMS = epi_aprilDurInf7I2000)
245 |
246 | covid_IDurInf7I2000sc = list()
247 | covid_IDurInf7I2000sc[[1]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_doNothingDurInf7I2000)
248 | covid_IDurInf7I2000sc[[2]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_baseDurInf7I2000)
249 | covid_IDurInf7I2000sc[[3]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_marchDurInf7I2000)
250 | covid_IDurInf7I2000sc[[4]] = summariseSimulations(VAR = 'incidence',CI = 50,SIMS = epi_aprilDurInf7I2000)
251 |
252 | peaktime_DurInf7I2000sc = list()
253 | peaktime_DurInf7I2000sc[[1]] = summarisePeakTimePeakSize(SIMS = epi_doNothingDurInf7I2000)
254 | peaktime_DurInf7I2000sc[[2]] = summarisePeakTimePeakSize(SIMS = epi_baseDurInf7I2000)
255 | peaktime_DurInf7I2000sc[[3]] = summarisePeakTimePeakSize(SIMS = epi_marchDurInf7I2000)
256 | peaktime_DurInf7I2000sc[[4]] = summarisePeakTimePeakSize(SIMS = epi_aprilDurInf7I2000)
257 |
258 | covid_DurInf7I2000sc = list()
259 | covid_DurInf7I2000sc[[1]] = summariseSimulations_mid(CI = 50,SIMS = epi_doNothingDurInf7I2000)
260 | covid_DurInf7I2000sc[[2]] = summariseSimulations_mid(CI = 50,SIMS = epi_baseDurInf7I2000)
261 | covid_DurInf7I2000sc[[3]] = summariseSimulations_mid(CI = 50,SIMS = epi_marchDurInf7I2000)
262 | covid_DurInf7I2000sc[[4]] = summariseSimulations_mid(CI = 50,SIMS = epi_aprilDurInf7I2000)
263 |
264 | AGEcovid_IDurInf7I2000sc = list()
265 | AGEcovid_IDurInf7I2000sc[[1]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_doNothingDurInf7I2000)
266 | AGEcovid_IDurInf7I2000sc[[2]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_baseDurInf7I2000)
267 | AGEcovid_IDurInf7I2000sc[[3]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_marchDurInf7I2000)
268 | AGEcovid_IDurInf7I2000sc[[4]] = summariseSimulationsAGE(VAR = 'incidence',CI = 50,SIMS = epi_aprilDurInf7I2000)
269 |
270 | epiFirstSimDurInf7I2000sc = list(epi_doNothingDurInf7I2000 = epi_doNothingDurInf7I2000[[1]],
271 | epi_baseDurInf7I2000= epi_baseDurInf7I2000[[1]],
272 | epi_marchDurInf7I2000 = epi_marchDurInf7I2000[[1]],
273 | epi_aprilDurInf7I2000 = epi_aprilDurInf7I2000[[1]])
274 |
275 | save(covid_IDurInf3I2000sc,file = 'outputs/SEIcIscR/covid_IDurInf3I2000.rdata')
276 | save(covid_SDurInf3I2000sc,file = 'outputs/SEIcIscR/covid_SDurInf3I2000.rdata')
277 | save(covid_IDurInf7I2000sc,file = 'outputs/SEIcIscR/covid_IDurInf7I2000.rdata')
278 | save(covid_SDurInf7I2000sc,file = 'outputs/SEIcIscR/covid_SDurInf7I2000.rdata')
279 |
280 | save(peaktime_DurInf3I2000sc,file = 'outputs/SEIcIscR/peaktime_DurInf3I2000.rdata')
281 | save(peaktime_DurInf7I2000sc,file = 'outputs/SEIcIscR/peaktime_DurInf7I2000.rdata')
282 |
283 | save(covid_DurInf3I2000sc,file ='outputs/SEIcIscR/covid_DurInf3I2000.rdata')
284 | save(covid_DurInf7I2000sc,file ='outputs/SEIcIscR/covid_DurInf7I2000.rdata')
285 |
286 | save(AGEcovid_IDurInf3I2000sc,file ='outputs/SEIcIscR/AGEcovid_IDurInf3I2000.rdata')
287 | save(AGEcovid_IDurInf7I2000sc,file ='outputs/SEIcIscR/AGEcovid_IDurInf7I2000.rdata')
288 |
289 | save(epiFirstSimDurInf3I2000sc,file ='outputs/SEIcIscR/epiFirstSimDurInf3I2000.rdata')
290 | save(epiFirstSimDurInf7I2000sc,file ='outputs/SEIcIscR/epiFirstSimDurInf7I2000.rdata')
291 |
292 | rm(epi_doNothingDurInf3I2000,epi_baseDurInf3I2000,epi_marchDurInf3I2000,epi_aprilDurInf3I2000)
293 | rm(epi_doNothingDurInf7I2000,epi_baseDurInf7I2000,epi_marchDurInf7I2000,epi_aprilDurInf7I2000)
294 |
295 |
296 |
297 |
298 |
299 |
300 |
--------------------------------------------------------------------------------
/codes/function_modelSEIcIscR.r:
--------------------------------------------------------------------------------
1 | ## functions to simulate the SEIR and SEIcIscR outbreak
2 |
3 | ## load data: Population age structure
4 |
5 | loadPopInfo = function(POP)
6 | {
7 | pop = list()
8 | pop$N = sum(POP$popage) # Population size
9 | pop$p_age = POP$propage # Population age structure of China
10 | return(pop)
11 | }
12 |
13 | loadInterventions = function(p_workopen)
14 | {
15 | list(
16 | # constraints under a DO-NOTHING scenario
17 | base =list(home = diag(1,16,16),
18 | work = diag(1,16,16),
19 | school = diag(1,16,16),
20 | others = diag(1,16,16)),
21 | # Wuhan's lockdown--assume from XX Jan to XX Feb
22 | wuhanlockdown = list(home = diag(1,16,16),
23 | work = diag(0.1,16,16),
24 | school = diag(0,16,16),
25 | others = diag(c(rep(0.1,4),rep(0.1,12)))),
26 | # constraints under school closure + some social distancing for school-age going children but 100% workplace
27 | schcloseonly = list(home = diag(c(rep(1,4),rep(1,12))),
28 | work = diag(1,16,16),
29 | school = diag(0,16,16),
30 | others = diag(c(rep(0.5,4),rep(1,12)))),
31 | # constraints under work place distancing only (MAYBE UNREALISTIC, should close schools too)
32 | workplacedistonly = list(home = diag(1,16,16),
33 | work = diag(0.5,16,16),
34 | school = diag(1,16,16),
35 | others = diag(0.1,16,16)) ,
36 |
37 | # constraints under work place distancing + schoolclosure
38 | schcloseworkplacedist = list(home = diag(1,16,16),
39 | work = diag(p_workopen,16,16),
40 | school = diag(0,16,16),
41 | others = diag(c(rep(0.1,4),rep(0.1,12)))),
42 | # Post Outbeak, people still cautious
43 | postoutbreak = list(home = diag(1,16,16),
44 | work = diag(1.0,16,16),
45 | school = diag(1.0,16,16),
46 | others = diag(c(rep(1.0,4),rep(1.0,12)))))
47 |
48 | }
49 |
50 |
51 | getbeta = function(R0t,constraints,gamma,p_age,calculate_transmission_probability=1,CONTACTMATRIX = contacts)
52 | {
53 | # 1) R0
54 | # 2) gamma = removal rate
55 | # 3) f = population age proportion
56 | # 4) constraints = a scale matrix contstraint age- and location-specific contact matrices (a linear combination over all locations; TODO to specify carefully based on interventions)
57 | # 5) calculate_transmission_probability if this is 1, then calculate the transmission probability from R0 otherwise, assume it is beta=0.05
58 | # 6) npop = population size
59 |
60 | # constraints for age-specific contacts at home, work, school, others
61 | n = 16 #length(p_age)
62 | constraints_base = list(home = diag(1,n),
63 | work = diag(1,n),
64 | school = diag(1,n),
65 | others = diag(1,n)) # constraints under a DO-NOTHING scenario
66 |
67 | Csym <- lapply(CONTACTMATRIX, function(x, p_age) (x + t(x)*((p_age)%*%t(1/p_age)))/2, p_age) # make sure contacts are reciprocal
68 | CONTACTMATRIX=Csym
69 | C = constraints_base[[1]]%*%CONTACTMATRIX[[1]]+
70 | constraints_base[[2]]%*%CONTACTMATRIX[[2]]+
71 | constraints_base[[3]]%*%CONTACTMATRIX[[3]]+
72 | constraints_base[[4]]%*%CONTACTMATRIX[[4]]
73 |
74 |
75 | if (calculate_transmission_probability==1){
76 | M = C
77 | for(i in 1:n)
78 | {
79 | for(j in 1:n){
80 | M[i,j] = C[i,j]*p_age[i]/p_age[j]
81 | }
82 | }
83 | eig = eigen(M)
84 | beta = R0t*gamma/max(Re(eig$values)) # reverse engineer beta from the R0 and gamma
85 | beta = beta
86 | }else{
87 | beta = 0.025#0.05
88 | }
89 | results = list(beta)
90 | names(results) =c('beta')
91 | return(results)
92 | }
93 |
94 |
95 | # Children as infectious and as susceptible
96 | simulateOutbreakSEIR = function(R0t,rho, R0tpostoutbreak = 1.5,dateEndIntenseIntervention, #date we begin relaxing intense intervention
97 | pWorkOpen = c(0.1,0.25,0.5,0.9), # pWorkOpen: proportion of the work force that is working (will be time-varying)
98 | dateStartSchoolClosure = as.Date('2020-01-15') , # cause winter term break
99 | dateStartIntenseIntervention = as.Date('2020-01-23') , #Intense intervention: starts at Wuhan Lockdown
100 | dateStart = as.Date('2019-11-01'),POP = wuhanpop,numWeekStagger=c(2,4,6),pInfected=0.0002,durInf = 7,contacts_china=contacts)
101 | {
102 | # debug dateStartIntenseIntervention = as.Date('2020-01-23')
103 | # debug dateEndIntenseIntervention = as.Date('2020-03-01')
104 | # debug R0est = rep(2,3660)
105 | # debug rho = rep(0.8,3660)
106 | # debug pWorkOpen = c(0.1,0.25,0.5,1)
107 |
108 |
109 | # Load population information
110 | # pop = loadPopInfo(POP = wuhanpop)
111 | pop = list()
112 | pop$N = sum(POP$popage)
113 | pop$p_age = wuhanpop$propage
114 | N_age = pop$N*pop$p_age # Population age structure (in numbers)
115 | # contacts_china = CONTACTS
116 |
117 |
118 | # Specify epi info
119 | durLat = 6.4; # Mean latent period (days) from Backer, et al (2020)
120 | durInf = durInf; # Mean duration of infectiousness (days)
121 | gamma = 1-exp(-1/durInf); # removal rate
122 | alpha = 1-exp(-1/durLat); # infection rate
123 | dt = 1; # Time step (days)
124 | tmax = 428; # Time horizon (days) 366 days in 2020 cause of leap year
125 | numSteps = tmax/dt; # Total number of simulation time steps
126 | # dateStart = as.Date('2019-12-01') # included as a function argument
127 | dateEnd = dateStart+(tmax-1)
128 | dateStartCNY = as.Date('2020-01-25')
129 | dateEndCNY = as.Date('2020-01-31')
130 |
131 | # Declare the state variables and related variables:
132 | # The values of these variables change over time
133 | S = E = I = R = H = array(0,c(numSteps,length(pop$p_age)))
134 | lambda = incidence = reported = cumulativeIncidence = array(0,c(numSteps,length(pop$p_age)))
135 | time = array(0,numSteps)
136 |
137 |
138 | # Initialise the time-dependent variables, i.e. setting the values of the variables at time 0
139 | E[1,] = 0
140 | I[1,] = pInfected*sum(N_age)/16#rpois(length(N_age),lambda = pInfected*sum(N_age)/16) # 100 # Assign 100 infected person in each age group (TODO RELAX?)
141 | R[1,] = 0
142 | S[1,] = N_age-E[1,]-I[1,]-R[1,]
143 | H[1,] = 0 # Accumulator function for the infected cases (I) that get re
144 | incidence[1,] = 0;
145 | reported[1,] = 0;
146 | time[1] = 0;
147 |
148 |
149 | ## INTERVENTIONS
150 | # School closed 2020-02-10, lockdown (intense intervention) started 2020-01-23, end of intense intervention: user-specified
151 | # note that intense intervention is time-varying control by pWorkOpen: proportion of the work force that is working
152 | # debug pWorkOpen = c(0.1,0.25,0.5,1)
153 | tStartSchoolClosure = as.vector(dateStartSchoolClosure - dateStart)+1
154 | tStartIntenseIntervention = as.vector(dateStartIntenseIntervention - dateStart)+1 # for pw = 0.1
155 | tEndIntenseIntervention = as.vector(dateEndIntenseIntervention - dateStart)+1 # for pw = 0.1
156 | tRelaxIntervention1 = tEndIntenseIntervention + numWeekStagger[1]*7 # for pw = 0.25
157 | tRelaxIntervention2 = tEndIntenseIntervention + numWeekStagger[2]*7 # for pw = 0.5
158 | tRelaxIntervention3 = tEndIntenseIntervention + numWeekStagger[3]*7 # for pw = 1
159 | # tStartEndClosure = as.vector(dateEndSchoolClosure - dateStart)+1
160 | pwork = array(1,numSteps)
161 | pwork[1:tRelaxIntervention3] =c(rep(1,(tStartIntenseIntervention-0)), # dont know there is outbreak
162 | rep(pWorkOpen[1],(tEndIntenseIntervention-tStartIntenseIntervention)),
163 | rep(pWorkOpen[2],(tRelaxIntervention1-tEndIntenseIntervention)),
164 | rep(pWorkOpen[3],(tRelaxIntervention2-tRelaxIntervention1)),
165 | rep(pWorkOpen[4],(tRelaxIntervention3-tRelaxIntervention2)))
166 | R0tpostoutbreak = R0t #overwrites the default reduction in R0 post-outbreak
167 |
168 | beta = getbeta(R0t = R0t,constraints = constraintsIntervention$base,gamma = gamma,p_age = pop$p_age)
169 | if(pWorkOpen[2]<1) beta_postfirstwave = getbeta(R0t = R0tpostoutbreak,constraints = constraintsIntervention$base,gamma = gamma,p_age = pop$p_age)
170 | if(pWorkOpen[2]>=1) beta_postfirstwave = beta#getbeta(R0t = R0t[2],constraints = constraintsIntervention$base,gamma = gamma,p_age = pop$p_age)
171 | for (stepIndex in 1: (numSteps-1))
172 | {
173 |
174 | # load plausible intervetions
175 | constraintsIntervention = loadInterventions(p_workopen = pwork[stepIndex])
176 |
177 | ## Age- and location-specific contact rates for the given interventions
178 |
179 | # I0: before school winter break intervention period, use base-case
180 | if(time[stepIndex] < tStartSchoolClosure)
181 | {
182 | CONSTRAINT = constraintsIntervention$base
183 | }
184 | # I1: When school winter break but before lockdown period, use 'schcloseonly'
185 | if(time[stepIndex] >= tStartSchoolClosure & time[stepIndex] < tStartIntenseIntervention)
186 | {
187 | INTERVENTION = "schcloseonly"
188 | CONSTRAINT = constraintsIntervention[[INTERVENTION]]
189 | }
190 | # I2: Wuhan lockdown period, use 'schcloseonly'
191 | if(time[stepIndex] >= tStartIntenseIntervention & time[stepIndex] < tRelaxIntervention3)
192 | {
193 | INTERVENTION = "schcloseworkplacedist"
194 | CONSTRAINT = constraintsIntervention[[INTERVENTION]]
195 | }
196 | # I0: before school winter break intervention period, use base-case
197 | if(time[stepIndex] >= tRelaxIntervention3)
198 | {
199 | if(pWorkOpen[2]<1) CONSTRAINT = constraintsIntervention$postoutbreak
200 | if(pWorkOpen[2]>=1) CONSTRAINT = constraintsIntervention$base
201 | }
202 | #
203 |
204 | C = CONSTRAINT[[1]]%*%contacts_china[[1]]+
205 | CONSTRAINT[[2]]%*%contacts_china[[2]]+
206 | CONSTRAINT[[3]]%*%contacts_china[[3]]+
207 | CONSTRAINT[[4]]%*%contacts_china[[4]]
208 |
209 | # calculate the force of infection
210 |
211 | # beta = getbeta(R0t = R0t[stepIndex],constraints = constraintsIntervention$base,gamma = gamma,p_age = pop$p_age)
212 |
213 | if(time[stepIndex] < tEndIntenseIntervention+0) lambda[stepIndex,] = as.numeric(beta)*(as.matrix(C)%*%as.matrix(I[stepIndex,]/N_age));
214 | if(time[stepIndex] >= tEndIntenseIntervention+0) lambda[stepIndex,] = as.numeric(beta_postfirstwave)*(as.matrix(C)%*%as.matrix(I[stepIndex,]/N_age));
215 | # lambda[stepIndex,] = as.numeric(beta)*(as.matrix(C)%*%as.matrix(I[stepIndex,]/N_age));
216 | # calculate the number of infections and recoveries between time t and t+dt
217 |
218 | numInfection = lambda[stepIndex,]*S[stepIndex,]*dt; # S to E
219 | numInfected = alpha*E[stepIndex,]*dt; # E to I
220 | numRecovery = gamma*I[stepIndex,]*dt; # I to R
221 | numReported = numInfected*rho[stepIndex]; # I to H, but not removed from I (remember this is an accumulator function)
222 |
223 | # SEIR difference equations
224 | S[stepIndex+1,] = S[stepIndex,]-numInfection;
225 | E[stepIndex+1,] = E[stepIndex,]+numInfection-numInfected;
226 | I[stepIndex+1,] = I[stepIndex,]+numInfected-numRecovery;
227 | R[stepIndex+1,] = R[stepIndex,]+numRecovery;
228 | H[stepIndex+1,] = H[stepIndex,]+numReported;
229 | incidence[stepIndex+1,] = numInfected/dt;
230 | reported[stepIndex+1,] = numReported/dt;
231 | time[stepIndex+1] = time[stepIndex]+dt;
232 |
233 | }
234 | output = list(S =S, E = E, I = I, R = R, time = time,lambda=lambda,
235 | incidence = incidence, N_age= N_age, #reported = reported,
236 | R0t = R0t,#rho = rho,
237 | dateStart = dateStart, dateEnd = dateEnd,
238 | dateStartIntenseIntervention = dateStartIntenseIntervention, dateEndIntenseIntervention = dateEndIntenseIntervention,
239 | dateStartSchoolClosure = dateStartSchoolClosure, dateStartCNY = dateStartCNY,dateEndCNY = dateEndCNY)
240 | return(output)
241 | }
242 |
243 | # Children less infectious and as susceptible
244 | simulateOutbreakSEIcIscR = function(R0t,rho=c(rep(0.4,4),rep(0.8,12)), R0tpostoutbreak = 1.5,dateEndIntenseIntervention, #date we begin relaxing intense intervention
245 | pWorkOpen = c(0.1,0.25,0.5,0.9), # pWorkOpen: proportion of the work force that is working (will be time-varying)
246 | dateStartSchoolClosure = as.Date('2020-01-15') , # cause winter term break
247 | dateStartIntenseIntervention = as.Date('2020-01-23') , #Intense intervention: starts at Wuhan Lockdown
248 | dateStart = as.Date('2019-11-01'),POP = wuhanpop,numWeekStagger=c(2,4,6),pInfected=0.0002,durInf = 7,contacts_china=contacts)
249 | {
250 | # debug dateStartIntenseIntervention = as.Date('2020-01-23')
251 | # debug dateEndIntenseIntervention = as.Date('2020-03-01')
252 | # debug R0est = rep(2,3660)
253 | # debug rho = rep(0.8,3660)
254 | # debug pWorkOpen = c(0.1,0.25,0.5,1)
255 |
256 |
257 | # Load population information
258 | # pop = loadPopInfo(POP = wuhanpop)
259 | pop = list()
260 | pop$N = sum(POP$popage)
261 | pop$p_age = wuhanpop$propage
262 | N_age = pop$N*pop$p_age # Population age structure (in numbers)
263 | # contacts_china = CONTACTS
264 |
265 |
266 | # Specify epi info
267 | durLat = 6.4; # Mean latent period (days) from Backer, et al (2020)
268 | durInf = durInf; # Mean duration of infectiousness (days)
269 | gamma = 1-exp(-1/durInf); # removal rate
270 | alpha = 1-exp(-1/durLat); # infection rate
271 | dt = 1; # Time step (days)
272 | tmax = 428; # Time horizon (days) 366 days in 2020 cause of leap year
273 | numSteps = tmax/dt; # Total number of simulation time steps
274 | # dateStart = as.Date('2019-12-01') # included as a function argument
275 | dateEnd = dateStart+(tmax-1)
276 | dateStartCNY = as.Date('2020-01-25')
277 | dateEndCNY = as.Date('2020-01-31')
278 |
279 | # Declare the state variables and related variables:
280 | # The values of these variables change over time
281 | S = E = Isc = Ic = R = array(0,c(numSteps,length(pop$p_age)))
282 | lambda = incidence = subclinical = cumulativeIncidence = array(0,c(numSteps,length(pop$p_age)))
283 | time = array(0,numSteps)
284 |
285 |
286 | # Initialise the time-dependent variables, i.e. setting the values of the variables at time 0
287 | E[1,] = 0
288 | Ic[1,] = pInfected*sum(N_age)/16#rpois(length(N_age),lambda = pInfected*sum(N_age)/16) # 100 # Assign 100 infected person in each age group (TODO RELAX?)
289 | Isc[1,] = 0
290 | R[1,] = 0
291 | S[1,] = N_age-E[1,]-Ic[1,]-Isc[1,]-R[1,]
292 | incidence[1,] = 0;
293 | subclinical[1,] = 0;
294 | time[1] = 0;
295 |
296 |
297 | ## INTERVENTIONS
298 | # School closed 2020-02-10, lockdown (intense intervention) started 2020-01-23, end of intense intervention: user-specified
299 | # note that intense intervention is time-varying control by pWorkOpen: proportion of the work force that is working
300 | # debug pWorkOpen = c(0.1,0.25,0.5,1)
301 | tStartSchoolClosure = as.vector(dateStartSchoolClosure - dateStart)+1
302 | tStartIntenseIntervention = as.vector(dateStartIntenseIntervention - dateStart)+1 # for pw = 0.1
303 | tEndIntenseIntervention = as.vector(dateEndIntenseIntervention - dateStart)+1 # for pw = 0.1
304 | tRelaxIntervention1 = tEndIntenseIntervention + numWeekStagger[1]*7 # for pw = 0.25
305 | tRelaxIntervention2 = tEndIntenseIntervention + numWeekStagger[2]*7 # for pw = 0.5
306 | tRelaxIntervention3 = tEndIntenseIntervention + numWeekStagger[3]*7 # for pw = 1
307 | # tStartEndClosure = as.vector(dateEndSchoolClosure - dateStart)+1
308 | pwork = array(1,numSteps)
309 | pwork[1:tRelaxIntervention3] =c(rep(1,(tStartIntenseIntervention-0)), # dont know there is outbreak
310 | rep(pWorkOpen[1],(tEndIntenseIntervention-tStartIntenseIntervention)),
311 | rep(pWorkOpen[2],(tRelaxIntervention1-tEndIntenseIntervention)),
312 | rep(pWorkOpen[3],(tRelaxIntervention2-tRelaxIntervention1)),
313 | rep(pWorkOpen[4],(tRelaxIntervention3-tRelaxIntervention2)))
314 | R0tpostoutbreak = R0t #overwrites the default reduction in R0 post-outbreak
315 | beta = getbeta(R0t = R0t,constraints = constraintsIntervention$base,gamma = gamma,p_age = pop$p_age)
316 | if(pWorkOpen[2]<1) beta_postfirstwave = getbeta(R0t = R0tpostoutbreak,constraints = constraintsIntervention$base,gamma = gamma,p_age = pop$p_age)
317 | if(pWorkOpen[2]>=1) beta_postfirstwave = beta#getbeta(R0t = R0t[2],constraints = constraintsIntervention$base,gamma = gamma,p_age = pop$p_age)
318 | for (stepIndex in 1: (numSteps-1))
319 | {
320 |
321 | # load plausible intervetions
322 | constraintsIntervention = loadInterventions(p_workopen = pwork[stepIndex])
323 |
324 | ## Age- and location-specific contact rates for the given interventions
325 |
326 | # I0: before school winter break intervention period, use base-case
327 | if(time[stepIndex] < tStartSchoolClosure)
328 | {
329 | CONSTRAINT = constraintsIntervention$base
330 | }
331 | # I1: When school winter break but before lockdown period, use 'schcloseonly'
332 | if(time[stepIndex] >= tStartSchoolClosure & time[stepIndex] < tStartIntenseIntervention)
333 | {
334 | INTERVENTION = "schcloseonly"
335 | CONSTRAINT = constraintsIntervention[[INTERVENTION]]
336 | }
337 | # I2: Intense intervention
338 | if(time[stepIndex] >= tStartIntenseIntervention & time[stepIndex] < tRelaxIntervention3)
339 | {
340 | INTERVENTION = "schcloseworkplacedist"
341 | CONSTRAINT = constraintsIntervention[[INTERVENTION]]
342 | }
343 | # I3: post outbreak
344 | if(time[stepIndex] >= tRelaxIntervention3)
345 | {
346 | CONSTRAINT = constraintsIntervention$postoutbreak
347 | }
348 | #
349 |
350 | C = CONSTRAINT[[1]]%*%contacts_china[[1]]+
351 | CONSTRAINT[[2]]%*%contacts_china[[2]]+
352 | CONSTRAINT[[3]]%*%contacts_china[[3]]+
353 | CONSTRAINT[[4]]%*%contacts_china[[4]]
354 |
355 | # calculate the force of infection
356 |
357 | # beta = getbeta(R0t = R0t[stepIndex],constraints = constraintsIntervention$base,gamma = gamma,p_age = pop$p_age)
358 | if(time[stepIndex] < tEndIntenseIntervention+0) lambda[stepIndex,] = as.numeric(beta)*(as.matrix(C)%*%(as.matrix(Ic[stepIndex,]/N_age) + 0.25*as.matrix(Isc[stepIndex,]/N_age)));
359 | if(time[stepIndex] >= tEndIntenseIntervention+0)lambda[stepIndex,] = as.numeric(beta_postfirstwave)*(as.matrix(C)%*%(as.matrix(Ic[stepIndex,]/N_age) + 0.25*as.matrix(Isc[stepIndex,]/N_age)));
360 | # calculate the number of infections and recoveries between time t and t+dt
361 |
362 | numStoE = lambda[stepIndex,]*S[stepIndex,]*dt; # S to E
363 | numEtoIc = alpha*rho*E[stepIndex,]*dt; # E to Ic
364 | numEtoIsc = alpha*(1-rho)*E[stepIndex,]*dt; # E to Isc
365 | numIctoR = gamma*Ic[stepIndex,]*dt; # Ic to R
366 | numIsctoR = gamma*Isc[stepIndex,]*dt; # Isc to R
367 |
368 | # Difference equations
369 | S[stepIndex+1,] = S[stepIndex,]-numStoE;
370 | E[stepIndex+1,] = E[stepIndex,]+numStoE-numEtoIc-numEtoIsc;
371 | Ic[stepIndex+1,] = Ic[stepIndex,]+numEtoIc-numIctoR;
372 | Isc[stepIndex+1,] = Isc[stepIndex,]+numEtoIsc-numIsctoR;
373 | R[stepIndex+1,] = R[stepIndex,]+numIctoR+numIsctoR;
374 |
375 | incidence[stepIndex+1,] = numEtoIc/dt;
376 | subclinical[stepIndex+1,] = numEtoIsc/dt;
377 | time[stepIndex+1] = time[stepIndex]+dt;
378 |
379 |
380 | }
381 | output = list(S = S, E = E, Ic = Ic, Isc = Isc, R = R, time = time, lambda=lambda,
382 | incidence = incidence, N_age= N_age, subclinical = subclinical,
383 | R0t = R0t,#rho = rho,
384 | dateStart = dateStart, dateEnd = dateEnd,
385 | dateStartIntenseIntervention = dateStartIntenseIntervention, dateEndIntenseIntervention = dateEndIntenseIntervention,
386 | dateStartSchoolClosure = dateStartSchoolClosure, dateStartCNY = dateStartCNY,dateEndCNY = dateEndCNY)
387 | return(output)
388 | }
389 |
390 |
391 | CHECKMODEL = FALSE
392 |
393 | if(CHECKMODEL)
394 | {
395 | # Quick checks: Simulate an outbreak for sanity checks
396 | set.seed(666)
397 |
398 |
399 | # test for an R0 value of 2.2
400 | R0est = 2.2
401 | # R0est = sample(x = r0posterior,size = 100)
402 |
403 | nsim = 1
404 | epi_doNothing = vector('list',nsim)
405 | epi_base = vector('list',nsim)
406 | epi_march = vector('list',nsim)
407 | epi_april = vector('list',nsim)
408 |
409 | for(sim in 1:nsim)
410 | {
411 | epi_doNothing[[sim]] = simulateOutbreakSEIR(R0t =R0est,rho = rep(0.5,3660),dateStartSchoolClosure = as.Date('2019-12-01'),
412 | dateStartIntenseIntervention =as.Date('2019-12-01'),
413 | dateEndIntenseIntervention = as.Date('2019-12-01'),
414 | pWorkOpen = c(1,1,1,1),numWeekStagger = c(0,0,0,0),durInf = 7)
415 | epi_base[[sim]] = simulateOutbreakSEIR(R0t =R0est ,rho = rep(0.5,3660),dateEndIntenseIntervention = as.Date('2020-01-27'),
416 | pWorkOpen = c(0.5,1,1,1),numWeekStagger = c(0,0,0,0),durInf = 7)
417 | epi_march[[sim]] = simulateOutbreakSEIR(R0t =R0est,rho = rep(0.5,3660), dateEndIntenseIntervention = as.Date('2020-03-01'),durInf = 7)
418 | epi_april[[sim]] = simulateOutbreakSEIR(R0t =R0est,rho = rep(0.5,3660), dateEndIntenseIntervention = as.Date('2020-04-01'),durInf = 7)
419 | # epi_doNothing[[sim]] = simulateOutbreakSEIcIscR(R0t =R0est,dateStartSchoolClosure = as.Date('2019-12-01'),
420 | # dateStartIntenseIntervention =as.Date('2019-12-01'),
421 | # dateEndIntenseIntervention = as.Date('2019-12-01'),
422 | # pWorkOpen = c(1,1,1,1),numWeekStagger = c(0,0,0,0),durInf = 14)
423 | # epi_base[[sim]] = simulateOutbreakSEIcIscR(R0t =R0est ,dateEndIntenseIntervention = as.Date('2020-01-27'),
424 | # pWorkOpen = c(0.5,1,1,1),numWeekStagger = c(0,0,0,0),durInf = 14)
425 | # epi_march[[sim]] = simulateOutbreakSEIcIscR(R0t =R0est, dateEndIntenseIntervention = as.Date('2020-03-01'),durInf = 14)
426 | # epi_april[[sim]] = simulateOutbreakSEIcIscR(R0t =R0est, dateEndIntenseIntervention = as.Date('2020-04-01'),durInf = 14)
427 | }
428 | par(mfrow=c(2,1))
429 |
430 | # incidence over time
431 | agegp =3
432 | plot(epi_doNothing[[1]]$time, epi_doNothing[[1]]$incidence[,agegp], type='l', lwd=2,
433 | main=paste0("Incidence for age [",(agegp-1)*5,',',agegp*5,')'),
434 | xlab="Time(days)", ylab="Daily no. of infections");
435 | lines(x=epi_base[[1]]$time,y=epi_base[[1]]$incidence[,agegp],lwd=2,col='grey40')
436 | lines(x=epi_march[[1]]$time,y=epi_march[[1]]$incidence[,agegp],lwd=2,col='steelblue')
437 | lines(x=epi_april[[1]]$time,y=epi_april[[1]]$incidence[,agegp],lwd=2,col='tomato',lty='dashed')
438 |
439 | # cumulative incidence over time
440 | plot(epi_doNothing[[1]]$time, (epi_doNothing[[1]]$N_age[agegp]-epi_doNothing[[1]]$S[,agegp])/epi_doNothing[[1]]$N_age[agegp], lwd=2,type='l',
441 | main=paste0("Cum incidence for age [",(agegp-1)*5,',',agegp*5,')'),
442 | xlab="Time(days)", ylab="Cum incidence",ylim = c(0,1));
443 | lines(epi_base[[1]]$time, (epi_base[[1]]$N_age[agegp]-epi_base[[1]]$S[,agegp])/epi_base[[1]]$N_age[agegp],lwd=2,col='grey40')
444 | lines(epi_march[[1]]$time, (epi_march[[1]]$N_age[agegp]-epi_march[[1]]$S[,agegp])/epi_march[[1]]$N_age[agegp],lwd=2,col='steelblue')
445 | lines(epi_april[[1]]$time, (epi_april[[1]]$N_age[agegp]-epi_april[[1]]$S[,agegp])/epi_april[[1]]$N_age[agegp],lwd=2,col='tomato',lty='dashed')
446 | legend(0.25, 0.98, legend=c("Do Nothing", "Base","Lockdown->March","Lockdown->April"),
447 | col=c("black", "grey40","steelblue",'tomato'), bty='n',lty=c(1,1,1,1),lwd=c(2,2,2,2), cex=0.7)
448 |
449 | # incidence over time
450 | agegp =13
451 | plot(epi_doNothing[[1]]$time, epi_doNothing[[1]]$incidence[,agegp], type='l', lwd=2,
452 | main=paste0("Incidence for age [",(agegp-1)*5,',',agegp*5,')'),
453 | xlab="Time(days)", ylab="Daily no. of infections");
454 | lines(x=epi_base[[1]]$time,y=epi_base[[1]]$incidence[,agegp],lwd=2,col='grey40')
455 | lines(x=epi_march[[1]]$time,y=epi_march[[1]]$incidence[,agegp],lwd=2,col='steelblue')
456 | lines(x=epi_april[[1]]$time,y=epi_april[[1]]$incidence[,agegp],lwd=2,col='tomato',lty='dashed')
457 |
458 | # cumulative incidence over time
459 | plot(epi_doNothing[[1]]$time, (epi_doNothing[[1]]$N_age[agegp]-epi_doNothing[[1]]$S[,agegp])/epi_doNothing[[1]]$N_age[agegp], lwd=2,type='l',
460 | main=paste0("Cum incidence for age [",(agegp-1)*5,',',agegp*5,')'),
461 | xlab="Time(days)", ylab="Cum incidence",ylim = c(0,1));
462 | lines(epi_base[[1]]$time, (epi_base[[1]]$N_age[agegp]-epi_base[[1]]$S[,agegp])/epi_base[[1]]$N_age[agegp],lwd=2,col='grey40')
463 | lines(epi_march[[1]]$time, (epi_march[[1]]$N_age[agegp]-epi_march[[1]]$S[,agegp])/epi_march[[1]]$N_age[agegp],lwd=2,col='steelblue')
464 | lines(epi_april[[1]]$time, (epi_april[[1]]$N_age[agegp]-epi_april[[1]]$S[,agegp])/epi_april[[1]]$N_age[agegp],lwd=2,col='tomato',lty='dashed')
465 | legend(0.25, 0.98, legend=c("Do Nothing", "Base","Lockdown->March","Lockdown->April"),
466 | col=c("black", "grey40","steelblue",'tomato'), bty='n',lty=c(1,1,1,1),lwd=c(2,2,2,2), cex=0.7)
467 |
468 | }
469 |
--------------------------------------------------------------------------------
/codes/function_postprocessing.r:
--------------------------------------------------------------------------------
1 | summariseSimulations = function(VAR,CI,SIMS)
2 | {
3 | temp = lapply(SIMS,FUN = function(x) rowSums(x[[VAR]]))
4 | temp1 = do.call(cbind.data.frame, temp)
5 | var_p_median = apply(temp1,1,function(x) quantile(x,0.5))
6 | var_p_lci = apply(temp1,1,function(x) quantile(x,(1-CI/100)/2))
7 | var_p_uci = apply(temp1,1,function(x) quantile(x,1-(1-CI/100)/2))
8 | SUMMARY = list(median = var_p_median,lci = var_p_lci,uci=var_p_uci)
9 | rm(temp,temp1,var_p_median,var_p_lci,var_p_uci)
10 |
11 |
12 | results = list(summary=SUMMARY, Sim1 = SIMS[[1]])
13 | return(results)
14 |
15 | }
16 |
17 | summarisePeakTimePeakSize= function(VAR = 'incidence',SIMS)
18 | {
19 | time = SIMS[[1]]$time
20 | temp = lapply(SIMS,FUN = function(x) rowSums(x[[VAR]]))
21 | temp1 = do.call(cbind.data.frame, temp)
22 | peaksize = as.numeric(apply(temp1,2,max))
23 | peaktime = time[as.numeric(apply(temp1,2,function(x) which.max(x)))]
24 | results = list(time = time, peaktime = peaktime,peaksize = peaksize)
25 | return(results)
26 | }
27 |
28 |
29 | summariseSimulations_mid = function(CI,SIMS)
30 | {
31 | temp = lapply(SIMS,FUN = function(x) rowSums(x[['S']]))
32 | temp1 = do.call(cbind.data.frame, temp)
33 | i = which.min(abs(as.numeric(temp1[nrow(temp1),])-as.numeric(quantile(temp1[nrow(temp1),],0.5))))
34 | j = which.min(abs(as.numeric(temp1[nrow(temp1),])-as.numeric(quantile(temp1[nrow(temp1),],0.25))))
35 | k = which.min(abs(as.numeric(temp1[nrow(temp1),])-as.numeric(quantile(temp1[nrow(temp1),],0.75))))
36 |
37 | S = data.frame(med = temp[[i]],lci = temp[[k]],uci = temp[[j]],time = SIMS[[1]]$time)
38 | S_age = list(med = SIMS[[i]]$S,lci = SIMS[[k]]$S,uci = SIMS[[j]]$S)
39 | inc = list(med = SIMS[[i]]$incidence,lci = SIMS[[k]]$incidence,uci = SIMS[[j]]$incidence)
40 | time = SIMS[[1]]$time
41 | N_age = SIMS[[1]]$N_age
42 | results = list(S=S,inc = inc, time = time,N_age=N_age,S_age = S_age)
43 | return(results)
44 | }
45 |
46 | summariseSimulationsAGE = function(VAR,CI,SIMS)
47 | {
48 | var_p_median = var_p_lci = var_p_uci = array(NA,c(length(SIMS[[1]]$time),16))
49 | for(age in 1:16)
50 | {
51 | temp = lapply(SIMS,FUN = function(x) (x[[VAR]][,age]))
52 | temp1 = do.call(cbind.data.frame, temp)
53 | var_p_median[,age] = apply(temp1,1,function(x) quantile(x,0.5))
54 | var_p_lci[,age] = apply(temp1,1,function(x) quantile(x,(1-CI/100)/2))
55 | var_p_uci[,age] = apply(temp1,1,function(x) quantile(x,1-(1-CI/100)/2))
56 | rm(temp,temp1)
57 | }
58 |
59 | SUMMARY = list(median = var_p_median,lci = var_p_lci,uci=var_p_uci)
60 | rm(var_p_median,var_p_lci,var_p_uci)
61 |
62 |
63 | results = list(summary=SUMMARY, Sim1 = SIMS[[1]])
64 | return(results)
65 |
66 | }
--------------------------------------------------------------------------------
/data/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kieshaprem/covid19-agestructureSEIR-wuhan-social-distancing/092dded2cc45967f665a3f0d3f3e41f6e5a3f6b6/data/.DS_Store
--------------------------------------------------------------------------------
/data/china_pop_age_structure.csv:
--------------------------------------------------------------------------------
1 | agegroup,males,propmales,females,propfemales,popage,propage
2 | 1,44456332.00,0.53,39476105.00,0.47,83932437.00,0.06
3 | 2,46320144.00,0.53,40415039.00,0.47,86735183.00,0.06
4 | 3,45349923.00,0.54,38912828.00,0.46,84262751.00,0.06
5 | 4,44103122.00,0.54,38238737.00,0.46,82341859.00,0.06
6 | 5,46273865.00,0.53,40884302.00,0.47,87158167.00,0.06
7 | 6,51522843.00,0.53,46466160.00,0.47,97989003.00,0.07
8 | 7,66443228.00,0.52,62295742.00,0.48,128738970.00,0.09
9 | 8,51345507.00,0.51,48745948.00,0.49,100091455.00,0.07
10 | 9,49289359.00,0.51,46984787.00,0.49,96274146.00,0.07
11 | 10,61173349.00,0.51,58664268.00,0.49,119837617.00,0.08
12 | 11,62348020.00,0.51,61097362.00,0.49,123445382.00,0.09
13 | 12,49958045.00,0.51,48782446.00,0.49,98740491.00,0.07
14 | 13,38917285.00,0.50,38596854.00,0.50,77514139.00,0.05
15 | 14,36526788.00,0.49,37622978.00,0.51,74149766.00,0.05
16 | 15,21425163.00,0.48,23524526.00,0.52,44949689.00,0.03
17 | 16,12207276.00,0.46,14337340.00,0.54,26544616.00,0.02
18 | 17,6883629.00,0.43,9297788.00,0.57,16181417.00,0.01
19 | 18,2843084.00,0.38,4738693.00,0.63,7581777.00,0.01
20 | 19,731228.00,0.32,1573796.00,0.68,2305024.00,0.00
21 | 20,116377.00,0.24,358816.00,0.76,475193.00,0.00
22 | 21,12773.00,0.17,61919.00,0.83,74692.00,0.00
--------------------------------------------------------------------------------
/data/contacts.Rdata:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kieshaprem/covid19-agestructureSEIR-wuhan-social-distancing/092dded2cc45967f665a3f0d3f3e41f6e5a3f6b6/data/contacts.Rdata
--------------------------------------------------------------------------------
/data/contacts_china.rdata:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kieshaprem/covid19-agestructureSEIR-wuhan-social-distancing/092dded2cc45967f665a3f0d3f3e41f6e5a3f6b6/data/contacts_china.rdata
--------------------------------------------------------------------------------
/data/out_date.csv:
--------------------------------------------------------------------------------
1 | value
2 | 2019-11-22
3 | 2019-11-23
4 | 2019-11-24
5 | 2019-11-25
6 | 2019-11-26
7 | 2019-11-27
8 | 2019-11-28
9 | 2019-11-29
10 | 2019-11-30
11 | 2019-12-01
12 | 2019-12-02
13 | 2019-12-03
14 | 2019-12-04
15 | 2019-12-05
16 | 2019-12-06
17 | 2019-12-07
18 | 2019-12-08
19 | 2019-12-09
20 | 2019-12-10
21 | 2019-12-11
22 | 2019-12-12
23 | 2019-12-13
24 | 2019-12-14
25 | 2019-12-15
26 | 2019-12-16
27 | 2019-12-17
28 | 2019-12-18
29 | 2019-12-19
30 | 2019-12-20
31 | 2019-12-21
32 | 2019-12-22
33 | 2019-12-23
34 | 2019-12-24
35 | 2019-12-25
36 | 2019-12-26
37 | 2019-12-27
38 | 2019-12-28
39 | 2019-12-29
40 | 2019-12-30
41 | 2019-12-31
42 | 2020-01-01
43 | 2020-01-02
44 | 2020-01-03
45 | 2020-01-04
46 | 2020-01-05
47 | 2020-01-06
48 | 2020-01-07
49 | 2020-01-08
50 | 2020-01-09
51 | 2020-01-10
52 | 2020-01-11
53 | 2020-01-12
54 | 2020-01-13
55 | 2020-01-14
56 | 2020-01-15
57 | 2020-01-16
58 | 2020-01-17
59 | 2020-01-18
60 | 2020-01-19
61 | 2020-01-20
62 | 2020-01-21
63 | 2020-01-22
64 | 2020-01-23
65 | 2020-01-24
66 | 2020-01-25
67 | 2020-01-26
68 | 2020-01-27
69 | 2020-01-28
70 | 2020-01-29
71 | 2020-01-30
72 | 2020-01-31
73 | 2020-02-01
74 | 2020-02-02
75 | 2020-02-03
76 | 2020-02-04
77 | 2020-02-05
78 | 2020-02-06
79 | 2020-02-07
80 | 2020-02-08
81 | 2020-02-09
82 | 2020-02-10
83 | 2020-02-11
84 |
--------------------------------------------------------------------------------
/data/wuhan_pop_case_dist.csv:
--------------------------------------------------------------------------------
1 | bin_start,bin_end,national,wuhan
2 | 0,9,0.006,0.002
3 | 10,19,0.014,0.003
4 | 20,29,0.118,0.064
5 | 30,39,0.206,0.163
6 | 40,49,0.205,0.148
7 | 50,59,0.214,0.221
8 | 60,69,0.152,0.231
9 | 70,79,0.066,0.123
10 | 80,89,0.018,0.042
11 | 90,99,0.001,0.004
--------------------------------------------------------------------------------
/data/wuhanpop.csv:
--------------------------------------------------------------------------------
1 | "agegroup","popage","propage"
2 | 1,407903,0.0378873697311958
3 | 2,282264,0.0262176069551002
4 | 3,817453,0.0759277182292731
5 | 4,1430272,0.132848358752392
6 | 5,896025,0.0832257435306794
7 | 6,842295,0.0782351247422489
8 | 7,701197,0.0651294792963163
9 | 8,864953,0.0803396741654437
10 | 9,1049332,0.0974654009771321
11 | 10,431113,0.040043190726533
12 | 11,691750,0.0642520109230741
13 | 12,726228,0.0674544407497539
14 | 13,568724,0.0528249521651093
15 | 14,352535,0.0327446081254296
16 | 15,273800,0.0254314428489161
17 | 16,430356,0.0399728780814029
18 |
--------------------------------------------------------------------------------
/outputs/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kieshaprem/covid19-agestructureSEIR-wuhan-social-distancing/092dded2cc45967f665a3f0d3f3e41f6e5a3f6b6/outputs/.DS_Store
--------------------------------------------------------------------------------
/outputs/SEIR/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kieshaprem/covid19-agestructureSEIR-wuhan-social-distancing/092dded2cc45967f665a3f0d3f3e41f6e5a3f6b6/outputs/SEIR/.DS_Store
--------------------------------------------------------------------------------
/outputs/SEIcIscR/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kieshaprem/covid19-agestructureSEIR-wuhan-social-distancing/092dded2cc45967f665a3f0d3f3e41f6e5a3f6b6/outputs/SEIcIscR/.DS_Store
--------------------------------------------------------------------------------
/plots/fig_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kieshaprem/covid19-agestructureSEIR-wuhan-social-distancing/092dded2cc45967f665a3f0d3f3e41f6e5a3f6b6/plots/fig_1.png
--------------------------------------------------------------------------------
/plots/fig_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kieshaprem/covid19-agestructureSEIR-wuhan-social-distancing/092dded2cc45967f665a3f0d3f3e41f6e5a3f6b6/plots/fig_3.png
--------------------------------------------------------------------------------
/plots/fig_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kieshaprem/covid19-agestructureSEIR-wuhan-social-distancing/092dded2cc45967f665a3f0d3f3e41f6e5a3f6b6/plots/fig_4.png
--------------------------------------------------------------------------------