Skip to content

Instantly share code, notes, and snippets.

@kenmomd
Last active September 20, 2020 11:54
Show Gist options
  • Save kenmomd/03d4502d911e891bb6759b4ebaf2bd0b to your computer and use it in GitHub Desktop.
Save kenmomd/03d4502d911e891bb6759b4ebaf2bd0b to your computer and use it in GitHub Desktop.
dates counts
2020-02-16 1
2020-02-17 0
2020-02-18 0
2020-02-19 3
2020-02-20 0
2020-02-21 1
2020-02-22 1
2020-02-23 1
2020-02-24 4
2020-02-25 2
2020-02-26 3
2020-02-27 4
2020-02-28 7
2020-02-29 5
2020-03-01 6
2020-03-02 6
2020-03-03 5
2020-03-04 8
2020-03-05 4
2020-03-06 1
2020-03-07 4
2020-03-08 5
2020-03-09 9
2020-03-10 3
2020-03-11 5
2020-03-12 5
2020-03-13 11
2020-03-14 5
2020-03-15 5
2020-03-16 10
2020-03-17 18
2020-03-18 17
2020-03-19 14
2020-03-20 19
2020-03-21 16
2020-03-22 23
2020-03-23 35
2020-03-24 34
2020-03-25 43
2020-03-26 36
2020-03-27 79
2020-03-28 64
2020-03-29 66
2020-03-30 102
2020-03-31 88
2020-04-01 105
2020-04-02 88
2020-04-03 99
2020-04-04 91
2020-04-05 92
2020-04-06 117
2020-04-07 93
2020-04-08 90
2020-04-09 65
2020-04-10 68
2020-04-11 60
2020-04-12 57
2020-04-13 62
2020-04-14 68
2020-04-15 51
2020-04-16 38
2020-04-17 40
2020-04-18 32
2020-04-19 35
2020-04-20 29
2020-04-21 29
2020-04-22 36
2020-04-23 20
2020-04-24 34
2020-04-25 27
2020-04-26 24
2020-04-27 28
2020-04-28 25
2020-04-29 15
2020-04-30 22
2020-05-01 21
2020-05-02 21
2020-05-03 8
2020-05-04 13
2020-05-05 10
2020-05-06 9
2020-05-07 14
2020-05-08 10
2020-05-09 7
2020-05-10 11
2020-05-11 8
2020-05-12 11
2020-05-13 8
2020-05-14 8
2020-05-15 10
2020-05-16 6
2020-05-17 9
2020-05-18 2
2020-05-19 5
2020-05-20 3
2020-05-21 0
2020-05-22 3
2020-05-23 3
2020-05-24 5
2020-05-25 2
2020-05-26 5
2020-05-27 4
2020-05-28 4
2020-05-29 4
2020-05-30 1
2020-05-31 4
2020-06-01 2
2020-06-02 6
2020-06-03 0
2020-06-04 2
2020-06-05 7
2020-06-06 4
2020-06-07 5
2020-06-08 5
2020-06-09 6
2020-06-10 2
2020-06-11 7
2020-06-12 2
2020-06-13 3
2020-06-14 7
2020-06-15 1
2020-06-16 7
2020-06-17 5
2020-06-18 9
2020-06-19 7
2020-06-20 11
2020-06-21 7
2020-06-22 16
2020-06-23 16
2020-06-24 16
2020-06-25 13
2020-06-26 12
2020-06-27 19
2020-06-28 14
2020-06-29 18
2020-06-30 17
2020-07-01 18
2020-07-02 29
2020-07-03 23
2020-07-04 25
2020-07-05 32
2020-07-06 40
2020-07-07 25
2020-07-08 40
2020-07-09 40
2020-07-10 36
2020-07-11 42
2020-07-12 39
2020-07-13 62
2020-07-14 43
2020-07-15 50
2020-07-16 42
2020-07-17 53
2020-07-18 39
2020-07-19 55
2020-07-20 56
2020-07-21 65
2020-07-22 70
2020-07-23 64
2020-07-24 80
2020-07-25 79
2020-07-26 75
2020-07-27 109
2020-07-28 94
2020-07-29 114
2020-07-30 99
2020-07-31 84
2020-08-01 105
2020-08-02 75
2020-08-03 117
2020-08-04 101
2020-08-05 95
2020-08-06 93
2020-08-07 69
2020-08-08 94
2020-08-09 80
2020-08-10 92
2020-08-11 96
2020-08-12 102
2020-08-13 118
2020-08-14 96
2020-08-15 78
2020-08-16 75
2020-08-17 93
2020-08-18 85
2020-08-19 83
2020-08-20 56
2020-08-21 72
2020-08-22 63
2020-08-23 65
2020-08-24 74
2020-08-25 72
2020-08-26 76
2020-08-27 76
2020-08-28 77
2020-08-29 47
2020-08-30 67
2020-08-31 73
2020-09-01 74
2020-09-02 63
2020-09-03 65
2020-09-04 59
dates incidence t_start t_end Mean(R) Std(R) Quantile.0.025(R) Quantile.0.05(R) Quantile.0.25(R) Median(R) Quantile.0.75(R) Quantile.0.95(R) Quantile.0.975(R)
2020-02-23 1 2 8 2.72349369450561 1.25620899620936 0.966623468420842 1.14599279203442 1.82819497805034 2.49465147541677 3.36567954848665 5.09663856934792 5.78422489486045
2020-02-24 4 3 9 3.12614854864104 1.0926455693538 1.42220228898676 1.62613855942799 2.3439015644002 2.97195529234846 3.74686958932815 5.15218720513696 5.68664731309936
2020-02-25 2 4 10 2.93622817914256 0.898652371512528 1.48586858454974 1.65334942406118 2.28932412070958 2.83073217686611 3.46554711988265 4.58497418534208 4.9753231169466
2020-02-26 3 5 11 2.37518644789736 0.733931575802689 1.18217778417446 1.32615317769769 1.85263309420236 2.28906087683659 2.81035879590537 3.71396869776431 4.03411955640235
2020-02-27 4 6 12 2.51278223091724 0.710489083719079 1.3648525266447 1.50720135750534 2.00005313848926 2.42947474194399 2.93704165781973 3.79541872709005 4.13870840803241
2020-02-28 7 7 13 2.77172846266061 0.696530297238183 1.62394256224189 1.77102568609552 2.27077276382963 2.69752030004203 3.18534248164837 4.04384076203724 4.34289959459841
2020-02-29 5 8 14 2.65978927226979 0.610953245548475 1.61294712869143 1.7516693748904 2.22598830105877 2.60759441378028 3.03737333228318 3.75332923324499 3.99322828456855
2020-03-01 6 9 15 2.57608491835388 0.575285314955655 1.60855042079687 1.73034599633343 2.15360242769227 2.52362528835385 2.93752189291092 3.61054720922951 3.84468370088259
2020-03-02 6 10 16 2.22307959552943 0.496355074212249 1.39485767314719 1.49359578928537 1.86481988520534 2.17450950049767 2.53326467833729 3.11184870692985 3.31394960965032
2020-03-03 5 11 17 1.96091001122187 0.419694611693872 1.25420677878044 1.34482265902395 1.65833490936713 1.92045049417298 2.22104783579949 2.71519487969163 2.88631482036538
2020-03-04 8 12 18 1.84240443152892 0.35523178358245 1.23989829266653 1.31739786084513 1.58820982456089 1.81227392999692 2.06247877088311 2.47825386615838 2.62257931719213
2020-03-05 4 13 19 1.57542795902303 0.284068519299197 1.07808522452035 1.14783541898251 1.3726800983118 1.55307077518738 1.75645361664626 2.0749569366259 2.18603793028343
2020-03-06 1 14 20 1.18577415815442 0.218325543659824 0.802992721585636 0.854421292238563 1.03228542764164 1.17037289420867 1.3254686365697 1.56841585558049 1.65113333668372
2020-03-07 4 15 21 1.04045487545065 0.187299635691966 0.713410665092346 0.754506162185452 0.908907445267517 1.02788974748007 1.15934107757285 1.36821069461101 1.44573445084672
2020-03-08 5 16 22 0.950996385278888 0.168263971619496 0.651081994195902 0.694632558654793 0.832853020970902 0.940144252439408 1.05759195400354 1.24634297076817 1.31082271456693
2020-03-09 9 17 23 1.00927499410478 0.168214257039542 0.70509222693376 0.74945930341173 0.890910630811928 0.999676871140849 1.11795225786599 1.29958208077129 1.36342310118519
2020-03-10 3 18 24 0.959743116255166 0.164332584426787 0.663116533730367 0.705735674006345 0.845347098133453 0.949977062041315 1.06233345635636 1.24821274432923 1.30806043563119
2020-03-11 5 19 25 0.895891986513204 0.159233116555131 0.609912390777864 0.651540914640158 0.78358526026092 0.887382734942694 0.997243834871649 1.17368536863087 1.23386019706376
2020-03-12 5 20 26 0.937169381219323 0.163843520428541 0.644600384133286 0.684342909140948 0.82250058077865 0.927867528631742 1.04188035525313 1.22099751310475 1.284505487736
2020-03-13 11 21 27 1.24289350679984 0.190413542264215 0.896533682468493 0.946115547502635 1.10948065113971 1.23446151390412 1.36535112539904 1.57034220304522 1.64278502405432
2020-03-14 5 22 28 1.28647442718134 0.195141340749373 0.929360580351794 0.983167008253459 1.15068536601398 1.27688736455318 1.40922561849781 1.6274196017364 1.69942738307243
2020-03-15 5 23 29 1.27964522822107 0.193957299515587 0.926996030873369 0.978790314131298 1.14385451409038 1.2705178379884 1.4038292446416 1.61386757857602 1.68712662483669
2020-03-16 10 24 30 1.26225822574818 0.195389486892952 0.914134005691162 0.961036881491498 1.12475525060976 1.25172200908556 1.38664092149143 1.60349387271909 1.67723681450669
2020-03-17 18 25 31 1.59540604041108 0.219988348459188 1.19595203353665 1.25500906304285 1.44282513074805 1.58330106644856 1.73664309314304 1.97692537355469 2.0567067680074
2020-03-18 17 26 32 1.795263693906 0.225262208184451 1.38223974924711 1.4435446309781 1.63958613988167 1.78447648304365 1.94139427354631 2.17905337052984 2.26667337247741
2020-03-19 14 27 33 1.87270306197001 0.233838396529442 1.44100792873501 1.50194495445706 1.71016943072404 1.86343790799726 2.02563936815677 2.27630483849837 2.35438453047699
2020-03-20 19 28 34 1.8534699988916 0.249469735321765 1.3935496752553 1.45927674590169 1.67845011555901 1.84341375491768 2.01606150043823 2.27958672935535 2.3673261318267
2020-03-21 16 29 35 1.82893374770213 0.257060181236702 1.37274635720245 1.4353738856091 1.64256830783057 1.81545980999562 1.99732485031106 2.27525207924252 2.36331724396593
2020-03-22 23 30 36 1.87086035826654 0.249867147976195 1.42998240871783 1.48781444225133 1.68957885325027 1.85566120443015 2.03354937712589 2.30869099212725 2.39590346402764
2020-03-23 35 31 37 1.97824824331 0.23758833649129 1.54960671910377 1.60922805389752 1.80680454811907 1.96665042437877 2.13674021636077 2.38505940885607 2.46552726457053
2020-03-24 34 32 38 1.92318152793609 0.225367149417631 1.51317772295794 1.57003297972323 1.7620169217741 1.91456414780875 2.07441231405584 2.30761980424245 2.38144362492233
2020-03-25 43 33 39 1.94878354009584 0.229943555455428 1.53255173286311 1.58820311504725 1.78097527012468 1.93997419549397 2.10861705520035 2.34183595554293 2.4092966641088
2020-03-26 36 34 40 1.88875026722661 0.224709087552107 1.48885000865829 1.53824870383581 1.72372187527881 1.88000538849942 2.0436589730549 2.27283173782336 2.3396761257374
2020-03-27 79 35 41 2.10469734965418 0.239571240483267 1.67769030053989 1.73143883389895 1.92768541501937 2.09284180300432 2.27059994923007 2.51631579254932 2.58629144418356
2020-03-28 64 36 42 2.14562677087433 0.234798465306399 1.71750820620078 1.77465108519032 1.97434240629844 2.13889029805201 2.31037443339317 2.54293861766421 2.61236926600103
2020-03-29 66 37 43 2.09590870749449 0.239769253049796 1.65341360726911 1.70931840773748 1.92039962374825 2.09286577559275 2.26618555669842 2.49746038523018 2.55903685425185
2020-03-30 102 38 44 2.11620853750878 0.253394899303599 1.65864622090528 1.71738634388467 1.92391757999135 2.10930101452594 2.30140308329528 2.54012500837366 2.60204715521885
2020-03-31 88 39 45 2.01695701216915 0.242727483729151 1.58988119571761 1.6424266977134 1.83279328363002 2.00560666819234 2.18961580041259 2.43230986357699 2.49885414505138
2020-04-01 105 40 46 1.92911076023758 0.221037042085388 1.54062941267126 1.58532832591293 1.75925055631611 1.92009959014081 2.08841497149937 2.3059596315585 2.36557290746343
2020-04-02 88 41 47 1.80492811206635 0.194173605024659 1.4621948302195 1.50165468967803 1.65904390329703 1.79622453158086 1.94357888225404 2.13496609837248 2.18970936515134
2020-04-03 99 42 48 1.61119354749562 0.161481124031201 1.32785829944646 1.36020300949712 1.48793842019059 1.60379183010402 1.72714834408032 1.88632757413941 1.93026564491454
2020-04-04 91 43 49 1.47180307470418 0.132563221189163 1.24018597269787 1.26659098347219 1.37110180434081 1.46562220478646 1.56717350545985 1.69665969007049 1.73327550315477
2020-04-05 92 44 50 1.36728146936298 0.106111372980906 1.17913007217575 1.20284625557757 1.28814288152609 1.36157615845828 1.44101959678171 1.54976178916124 1.57945299730788
2020-04-06 117 45 51 1.27498617689597 0.083760152097807 1.12406717304351 1.14423087474609 1.21403505796719 1.27146213912328 1.33141959277637 1.41855632288115 1.4463484572109
2020-04-07 93 46 52 1.19417621844111 0.0673896005908758 1.07092630604636 1.08912876217161 1.14692044289282 1.19103170308799 1.23889151675542 1.31027382059801 1.33347235392606
2020-04-08 90 47 53 1.10499726094346 0.0556072398634653 0.999974640206666 1.01581743363161 1.06629900381139 1.10359939963299 1.14180649165503 1.19904033298959 1.219184898092
2020-04-09 65 48 54 1.02338710902981 0.047330051053401 0.933642117781649 0.947170039440192 0.990532820852299 1.02239540074337 1.05501698454989 1.10264963564126 1.11834032913727
2020-04-10 68 49 55 0.947235655220444 0.0409164466364799 0.868045448985148 0.880380657056726 0.9193541814125 0.946858848462236 0.974553399331588 1.01544814289835 1.02835345916419
2020-04-11 60 50 56 0.888276973167288 0.0381543859198043 0.81458407559661 0.826254568011043 0.862455168756317 0.88777349986928 0.913795408490988 0.951736486520224 0.963637045103224
2020-04-12 57 51 57 0.837862817754667 0.0377689463783437 0.766365493465562 0.776889446172483 0.811733281607949 0.837185088529146 0.863222759966486 0.900847259466964 0.912763692807476
2020-04-13 62 52 58 0.768700833160831 0.0378081683983334 0.69711395945357 0.708073166389057 0.743008037510717 0.767970220750286 0.793517872717491 0.832727307943446 0.845669343097061
2020-04-14 68 53 59 0.754070686662022 0.0409223686721205 0.677866471143334 0.689386879546109 0.725558481177307 0.752472940977912 0.781275942651161 0.823501670460641 0.837842571979817
2020-04-15 51 54 60 0.723439149671953 0.0430104034711963 0.644169864459648 0.656003404544229 0.693615630822159 0.72176232469533 0.751471363878454 0.797321047397927 0.812619766921024
2020-04-16 38 55 61 0.716330198305712 0.0460955353056215 0.631877749959151 0.643852023470139 0.683921985490732 0.714168299403062 0.746760707440939 0.795095591528645 0.811320943609929
2020-04-17 40 56 62 0.710855461254644 0.0487620091374308 0.621840570613057 0.634601146821798 0.676175597730185 0.708864093824611 0.743699694363303 0.794655227555599 0.810782378085815
2020-04-18 32 57 63 0.70424448343055 0.0494724711426829 0.613580330758024 0.626468393634127 0.669350786572293 0.702298511805064 0.73676593972853 0.788727527553497 0.805590165487842
2020-04-19 35 58 64 0.708156668799574 0.0510920597025897 0.615634055374649 0.628082317354592 0.672131481935097 0.706158353914758 0.741814239067648 0.795272605732348 0.81297538247319
2020-04-20 29 59 65 0.683382255894487 0.051076929316242 0.589444220901095 0.603420897433755 0.6477975707297 0.68162490148942 0.717077982757709 0.769991701478769 0.788486390260878
2020-04-21 29 60 66 0.636622268519145 0.0501850307285162 0.543862722766928 0.557113306340734 0.601597478333185 0.634493056085612 0.670005596417654 0.722185427935375 0.74026690511448
2020-04-22 36 61 67 0.646402762325826 0.0524912443000249 0.552280953695686 0.564830385785645 0.609468689628047 0.643717577813034 0.680565913658721 0.736781185063476 0.7559196231035
2020-04-23 20 62 68 0.648827186224096 0.0565425562109353 0.546830331495015 0.561104541620508 0.609052049694379 0.645516414043318 0.685218089710179 0.747188021626367 0.768296594999622
2020-04-24 34 63 69 0.688994632516273 0.0623911821448867 0.578105651809149 0.592498516498497 0.644454132831476 0.685455442788249 0.730030270002633 0.797484457864451 0.819458439794879
2020-04-25 27 64 70 0.736776151602234 0.0668902641862128 0.615843036025177 0.632453176991104 0.688882258938021 0.733352806777832 0.780865707462724 0.851266351986581 0.874565860616272
2020-04-26 24 65 71 0.759735748933894 0.066955332059046 0.6372846815419 0.654757097123524 0.713215272543991 0.756854150662122 0.803857862959347 0.875311413694913 0.897551829954419
2020-04-27 28 66 72 0.81390538633731 0.0679840089171624 0.687283253211773 0.706799503988031 0.766480705304643 0.810889716968067 0.859388338820022 0.929678940067315 0.953014117807111
2020-04-28 25 67 73 0.847577478870912 0.0674216249868976 0.720582631825432 0.739755235860777 0.800899475735986 0.845344653662008 0.89248902083396 0.961217321511155 0.984494715739118
2020-04-29 15 68 74 0.79398264715968 0.0652340182836627 0.672307504475247 0.689890393929882 0.749335946636207 0.791899237056147 0.836790237779227 0.903976951602054 0.928270103064295
2020-04-30 22 69 75 0.836799633708458 0.0662947869309598 0.712051128125697 0.730698502270549 0.791044743002831 0.835007146411745 0.87961766611905 0.948380969034608 0.972703416678233
2020-05-01 21 70 76 0.805891019762201 0.0663023274453639 0.681430466524791 0.700657175803988 0.760112494360144 0.803908145768991 0.849659200486955 0.918111195555181 0.941428353737288
2020-05-02 21 71 77 0.807676094361491 0.0677707473004154 0.681339769518033 0.69991544316102 0.760883059963234 0.805555245850252 0.852038771324241 0.923229830114723 0.946925325802453
2020-05-03 8 72 78 0.758231151989937 0.0677737473080559 0.632994092841765 0.651196155762998 0.711486367595103 0.755221567866127 0.802316402829737 0.874104395144021 0.898574962925454
2020-05-04 13 73 79 0.708282064921568 0.0665725942258746 0.585067957292277 0.602154459109925 0.66270614969316 0.705658639899121 0.751383044637285 0.822044329170714 0.846425809051483
2020-05-05 10 74 80 0.657766184804408 0.0667921655697153 0.535114834773826 0.553938767689597 0.611094523575925 0.654567624490396 0.701053594628277 0.772809708426472 0.796954259015419
2020-05-06 9 75 81 0.661856049063918 0.07099417498015 0.531124168013574 0.550363478244177 0.613117743960238 0.658210315990767 0.707140611053908 0.78367664344699 0.810802651065002
2020-05-07 14 76 82 0.658911362211793 0.0763247228948371 0.521381366108784 0.541204780899092 0.605264799392273 0.655099971920953 0.707455487021637 0.791173008194459 0.819832527412037
2020-05-08 10 77 83 0.636180737036551 0.0788020876647023 0.494827703792165 0.513874692862661 0.581126072741721 0.63183599168144 0.686930086448188 0.772018560883328 0.801387336168627
2020-05-09 7 78 84 0.58244186407857 0.0774502728844761 0.44256939751838 0.462204956164633 0.528126609905852 0.57822939158744 0.631936283628202 0.716317525268251 0.744555294278642
2020-05-10 11 79 85 0.665878820821164 0.0867980620973025 0.511631762724123 0.533381289808001 0.603754080933502 0.661171791865873 0.722323645911976 0.814955720664383 0.846669464506338
2020-05-11 8 80 86 0.685153789526582 0.0927144303542489 0.51945169940996 0.542039608727211 0.619263397633425 0.679949410420992 0.74520109318381 0.846838085680197 0.881906341387286
2020-05-12 11 81 87 0.762704527118079 0.102763427366791 0.577607812840069 0.602273659580939 0.690195091374646 0.757252634030285 0.828936107893462 0.940304061331298 0.978415271079738
2020-05-13 8 82 88 0.822675326832933 0.108518699516291 0.626220230483443 0.65359551583973 0.747420086360813 0.817152015458011 0.892864721042656 1.00903855696214 1.05341179795258
2020-05-14 8 83 89 0.807390953104234 0.107298095478993 0.613987824145172 0.641251207893692 0.732966757028481 0.801308050029691 0.876729882244667 0.991989418295558 1.03515623065008
2020-05-15 10 84 90 0.8513543923418 0.109435321698541 0.654086843801278 0.681229100596897 0.774583385160698 0.845966261316664 0.92279943137451 1.03835057017922 1.07936356376299
2020-05-16 6 85 91 0.874148731501964 0.113022156946765 0.66821501530709 0.697499817889633 0.795045599784466 0.868994294108727 0.946813228774029 1.06748629943503 1.11045204750512
2020-05-17 9 86 92 0.877799079271287 0.11398448136004 0.668138032503213 0.69979399707032 0.79736601770471 0.873650115322751 0.950913506347238 1.07443766264737 1.11677786451119
2020-05-18 2 87 93 0.818413124624093 0.111268033423047 0.612740511958073 0.643768796955834 0.741331155337228 0.81366671759599 0.890061479458196 1.0097035561039 1.04981556425675
2020-05-19 5 88 94 0.753676196149705 0.108238849477605 0.556415814290997 0.584780556949847 0.678349350443871 0.748615619752484 0.823275128716761 0.939823682967393 0.979285816156587
2020-05-20 3 89 95 0.701583137717347 0.106660540623838 0.508465794413948 0.535765021672207 0.627218478845829 0.696371329850735 0.770486975343921 0.883515148954013 0.922816476937507
2020-05-21 0 90 96 0.601827931899559 0.103573334341746 0.417543103064026 0.442064755042242 0.528771439052675 0.596138420347261 0.666627951356662 0.782898210129073 0.822342037849625
2020-05-22 3 91 97 0.519591048330531 0.0994832461407776 0.344843637254011 0.366943803749697 0.449642144575769 0.513033621270726 0.583318477479472 0.69393267629539 0.731225914814283
2020-05-23 3 92 98 0.508269433906312 0.106029634209633 0.325633907707874 0.348702015774375 0.433277114853602 0.500185072785019 0.574876003891177 0.69608279586244 0.737717175424513
2020-05-24 5 93 99 0.482378862650813 0.110748581856033 0.293140926641135 0.318818411665017 0.404108957618628 0.47220702141157 0.549584230384964 0.683011827294039 0.727659794019832
2020-05-25 2 94 100 0.550708732511231 0.130224232674256 0.331509077364792 0.359811986207395 0.457791935552443 0.53862184397249 0.630257991169637 0.783969518537435 0.839037068996117
2020-05-26 5 95 101 0.640297950952825 0.152076455054382 0.386457657657502 0.418504262911854 0.531417694099232 0.625148784351742 0.732706274324218 0.913388472701401 0.978950792527609
2020-05-27 4 96 102 0.770407191132923 0.177625336926049 0.464904542949598 0.505894934751996 0.644722271770747 0.755543126300096 0.878254583785935 1.08749316636284 1.1630476509561
2020-05-28 4 97 103 1.02011234943268 0.209674937583882 0.655868478737118 0.704240048698381 0.872621113674832 1.00427260219559 1.15073792226305 1.39113041290125 1.47931564696331
2020-05-29 4 98 104 1.14706390749255 0.226144085289707 0.747053497970343 0.802749313543695 0.98719431916 1.1326630649479 1.2899052739344 1.53989212415032 1.62703637527944
2020-05-30 1 99 105 1.10454339993463 0.220198085819616 0.713481018523841 0.771019248901846 0.95090219696921 1.08858894381678 1.24231960571683 1.49175238029345 1.58480662514125
2020-05-31 4 100 106 1.05225087662229 0.216313320298553 0.672118495350037 0.721855372390063 0.89864388910543 1.03795560570219 1.19154675708608 1.42643000493275 1.51098654289179
2020-06-01 2 101 107 1.02719054585505 0.207995811347245 0.661614963948326 0.711040196936994 0.881633104611694 1.01274230923702 1.15744068216081 1.39007461603155 1.47485073002
2020-06-02 6 102 108 1.0457348927952 0.207711712563296 0.677373839094444 0.729644824906889 0.899357423016009 1.03204767664895 1.17835191800362 1.40747043592331 1.48961257516464
2020-06-03 0 103 109 0.878513911009416 0.187933788105577 0.54914600508192 0.596223420300751 0.746725698907195 0.865842205190318 0.994649506158845 1.21061451240955 1.28535212784949
2020-06-04 2 104 110 0.80390042617597 0.17982871815642 0.490526637414971 0.532181401427191 0.677120271026168 0.790998403882625 0.915202651378967 1.12131651339688 1.1915582072245
2020-06-05 7 105 111 0.941786071593144 0.19616651290834 0.596427519611837 0.644500242958944 0.803050086339572 0.929114729587139 1.06436443089141 1.28648217460592 1.36571678787634
2020-06-06 4 106 112 1.10467310342037 0.218622314941434 0.717623114755897 0.770750720463455 0.950008102986172 1.09111992007755 1.24340297982624 1.48773447445733 1.56947701586906
2020-06-07 5 107 113 1.18388847761548 0.2304272006587 0.779768798662972 0.83179289419638 1.02083987271497 1.16882390355208 1.32914677119995 1.58569569453373 1.6792949302765
2020-06-08 5 108 114 1.33087671103965 0.245260360468541 0.894631442649758 0.953135891214769 1.15850267415192 1.31553420699239 1.48510717423425 1.75887065813097 1.85637922103098
2020-06-09 6 109 115 1.31210036506289 0.244303949049254 0.880396116244829 0.942464139110224 1.13913223403686 1.29554691909431 1.46715133978373 1.73892820729228 1.8397624024478
2020-06-10 2 110 116 1.33320272181804 0.242259886950196 0.905397241994649 0.963065820817747 1.16345344235709 1.31754670682449 1.48336939453615 1.75432197918086 1.85089797837725
2020-06-11 7 111 117 1.45486588782761 0.249106982290685 1.01128692158381 1.07798863818168 1.28034882556362 1.43620397499571 1.61184367783702 1.88691008013376 1.99006921127119
2020-06-12 2 112 118 1.18538527195593 0.21511522021154 0.805299057676625 0.859150420924956 1.03420090538505 1.1706205837476 1.32093583570988 1.56381765551695 1.6485412638856
2020-06-13 3 113 119 1.07826745504675 0.198160365178693 0.732248719240954 0.777371326398272 0.938111868791367 1.06593219086756 1.20326330364282 1.42622463383622 1.50773725011331
2020-06-14 7 114 120 1.09277929757367 0.192684540288367 0.750955027220305 0.796402686272364 0.95766630846112 1.08215183725972 1.21384807218049 1.43014318942611 1.50460712595443
2020-06-15 1 115 121 0.928936485485964 0.173032176683452 0.624476009525145 0.666333549165939 0.806190622698381 0.918181803858005 1.03785788652025 1.23562429824966 1.29815017244306
2020-06-16 7 116 122 0.95309137675985 0.17511133462613 0.644990511705317 0.686713629136999 0.82970040490685 0.941335425080161 1.06438171294473 1.25933751442885 1.32761046595037
2020-06-17 5 117 123 1.05700043449423 0.183881067667159 0.729305158807403 0.774310777599682 0.928346379817409 1.04621156320851 1.17274768510454 1.37902963114818 1.45548228878216
2020-06-18 9 118 124 1.13653898776028 0.193471563942757 0.791990783958307 0.841251182450371 1.0010644689248 1.12420108647905 1.25896948556072 1.47334589683638 1.54906909153897
2020-06-19 7 119 125 1.30948389811407 0.207872794306736 0.934978095594857 0.987437033052621 1.16484726008189 1.29938383732985 1.4419950277457 1.66848137575327 1.74547249845132
2020-06-20 11 120 126 1.5533900430301 0.227053136284024 1.14000594056262 1.20108847304942 1.39415935859756 1.54202648349667 1.70294549426204 1.94255668912988 2.02240175311335
2020-06-21 7 121 127 1.49366512957972 0.2262896242293 1.08343150126181 1.14407837783623 1.33463567717123 1.48121020375854 1.64008436565727 1.88812842622238 1.96853774603997
2020-06-22 16 122 128 1.8251696046106 0.255069732023399 1.36914321467041 1.42842467160492 1.64483172838623 1.81230820500664 1.99320442478538 2.2619972448441 2.35574946765464
2020-06-23 16 123 129 1.89730880764124 0.261661494691122 1.43081165783706 1.49513237610363 1.71307872820123 1.88340087033033 2.06509947896319 2.3522973676414 2.4541075291109
2020-06-24 16 124 130 1.9507167853835 0.268886002661735 1.46746564383757 1.5335886363454 1.75983197975634 1.93653853638664 2.12609433130836 2.41344446417033 2.51055698638788
2020-06-25 13 125 131 1.79243366793694 0.252825784494567 1.34117180078494 1.40189820663283 1.6111275888265 1.77932213985429 1.95891947233141 2.22856379807146 2.325834358702
2020-06-26 12 126 132 1.64651070286785 0.234720462330107 1.22957581059893 1.28612402328977 1.47770160175083 1.63249353574838 1.8006573874571 2.05250009401232 2.13445801638791
2020-06-27 19 127 133 1.56314011769113 0.206980199201727 1.19247302430153 1.24683256029413 1.41516599384958 1.55090525376584 1.6975131704676 1.92414343729972 2.0012883476284
2020-06-28 14 128 134 1.48579542347643 0.177610730780787 1.16708026217712 1.21139544976961 1.36020221659447 1.47544665550524 1.60137056735629 1.79339353831459 1.86069262560094
2020-06-29 18 129 135 1.36766906413581 0.154255466531551 1.08862862194229 1.12781821801674 1.25916766583141 1.36069487409497 1.46756098667787 1.63266032589969 1.69070129206624
2020-06-30 17 130 136 1.26959552629261 0.13638044269691 1.01774242623701 1.05562849384119 1.17445380805094 1.26464611346236 1.3585745485484 1.50157554547684 1.55133037334843
2020-07-01 18 131 137 1.20467300766421 0.125214375512717 0.973518158983991 1.00717822217962 1.11772228754372 1.20028677935769 1.28718618065955 1.41904417034876 1.46192864293028
2020-07-02 29 132 138 1.30013846948558 0.121813305162625 1.07400070110861 1.10740593083009 1.21619534819248 1.29573295209109 1.37938727875024 1.50770928893839 1.54875887187533
2020-07-03 23 133 139 1.34771223501644 0.119182733148228 1.1251574259302 1.15864577664287 1.26496642394784 1.34480546611699 1.4260394111113 1.54926192772477 1.590907156981
2020-07-04 25 134 140 1.3424383310631 0.117967247093549 1.12022402803045 1.15488026954536 1.26044006932562 1.33932574033329 1.41962529336327 1.54285300504336 1.58267567296558
2020-07-05 32 135 141 1.4335222076726 0.124901506026442 1.19441007668543 1.23161958875702 1.34810575036133 1.43000915169936 1.51544899747425 1.64536122495792 1.68705848154655
2020-07-06 40 136 142 1.5275644228328 0.132744382561484 1.28234958967606 1.31724539627592 1.43529020079889 1.52269963686835 1.61623387088773 1.75359710993097 1.79933024493575
2020-07-07 25 137 143 1.47860950691269 0.130118978140587 1.23371841986985 1.26993381063763 1.38853052885587 1.47539858685876 1.56525778938408 1.69926616124853 1.74351653612623
2020-07-08 40 138 144 1.51793565532812 0.133822847033373 1.26801704477439 1.30462006700393 1.42428873851781 1.51480785825798 1.60758670927972 1.74458453113733 1.78864796690187
2020-07-09 40 139 145 1.46382484439625 0.130118071511505 1.22449148699543 1.25585478928265 1.37180304903111 1.45930169386709 1.55109511485533 1.68535955581973 1.72858843335008
2020-07-10 36 140 146 1.41599493566395 0.122463815174751 1.19253232597883 1.22375735800779 1.32810781019771 1.41162072545857 1.49775206920456 1.62485942346497 1.66832247218355
2020-07-11 42 141 147 1.39329860785796 0.11445149999495 1.1829107079412 1.21202647763124 1.31257432799773 1.38900700999591 1.47035816643062 1.58690620440448 1.62472251559158
2020-07-12 39 142 148 1.32345680307627 0.103676327350268 1.12997615860568 1.15973478849008 1.25212754378835 1.31944089821723 1.3918250244901 1.50083795692008 1.53414273792085
2020-07-13 62 143 149 1.33570880359958 0.0984514295612342 1.15198190264947 1.17997758825394 1.26740973843371 1.33210249174304 1.40077810702952 1.5043037088983 1.53743480132491
2020-07-14 43 144 150 1.3315238662267 0.0928499188112007 1.15751542730558 1.1823141512292 1.26675348072828 1.32863245876276 1.39348670199706 1.48937461019271 1.52060085327373
2020-07-15 50 145 151 1.2952154587109 0.0874517248325182 1.13096507198268 1.15541996414301 1.23407521092817 1.29360823265841 1.3531277527319 1.4418208870297 1.47190179857238
2020-07-16 42 146 152 1.2287929561039 0.0834743533618324 1.07200669203293 1.09567631092515 1.17108791901499 1.22674638449924 1.28357723671296 1.37060128222595 1.39958942920027
2020-07-17 53 147 153 1.22470852283525 0.0801414932517792 1.0736507151178 1.09687244037987 1.16917472675194 1.22217381147337 1.27756789181337 1.36043365616686 1.38786432566756
2020-07-18 39 148 154 1.15432238616542 0.0730477276245972 1.01738047252181 1.03643860475043 1.10343222286527 1.15293671886723 1.20267409198665 1.27746324520506 1.30168301175847
2020-07-19 55 149 155 1.15841160551434 0.0689932591663552 1.02744912679772 1.04754224707881 1.1110679024836 1.15693811442464 1.20371872789827 1.27464218959522 1.29876266093263
2020-07-20 56 150 156 1.09930350370023 0.063702509987732 0.97778636592116 0.997040302003631 1.05582614608475 1.09767066888547 1.14134446042603 1.20592138015398 1.22744233855557
2020-07-21 65 151 157 1.13694786834855 0.062818493088725 1.01687456061574 1.03570002558959 1.09372013210285 1.13566362559865 1.17913823980205 1.24161818155473 1.26261914386264
2020-07-22 70 152 158 1.17048811980182 0.0621326219364267 1.05341273865826 1.06979782773408 1.12770697039085 1.16942281759969 1.21170975405461 1.27403942614763 1.29489220274863
2020-07-23 64 153 159 1.2087012841204 0.062878793777276 1.08774326914522 1.10661511941362 1.16652633646673 1.20771711014477 1.25049658971308 1.3135953203457 1.33545874443277
2020-07-24 80 154 160 1.25372901242027 0.0656140067052168 1.12811112382519 1.14786177033607 1.20857842953373 1.2522934719104 1.29780061746074 1.36339378670706 1.3847137441239
2020-07-25 79 155 161 1.32197825341629 0.0701577770750881 1.18758774714474 1.20794577289005 1.27375929052409 1.32151639757621 1.36864358782189 1.43771413988304 1.46133867309814
2020-07-26 75 156 162 1.3183796762293 0.0741220058871685 1.17731269029854 1.19771789838734 1.26703754316765 1.31723528141603 1.36808985843015 1.44219861181874 1.46571599981868
2020-07-27 109 157 163 1.38425510678447 0.0800601377709298 1.23122483319747 1.25496470278272 1.32805883902543 1.38329975081157 1.43919309894223 1.51836254832214 1.54247946159751
2020-07-28 94 158 164 1.37253002883832 0.0815057748374678 1.21737850750739 1.24157226266804 1.31495507026095 1.37136579784497 1.42891361616168 1.50857675099365 1.53107234022484
2020-07-29 114 159 165 1.38516349498156 0.0825279392417527 1.22838731529997 1.25051997809875 1.32730673731901 1.38401350653476 1.44212571911413 1.52277341603027 1.54571282294591
2020-07-30 99 160 166 1.36731475451892 0.0815484141139033 1.21400866505853 1.23495656217127 1.30931439358818 1.36683638861334 1.42384490816923 1.50313501445591 1.52510059876058
2020-07-31 84 161 167 1.2828713070961 0.0765094363820188 1.13772384471443 1.15864511446556 1.22853812663326 1.28203702129609 1.33521028173438 1.41003808179852 1.43224508877649
2020-08-01 105 162 168 1.24738196262862 0.0715197449748242 1.11567181265614 1.132716528458 1.19650149310286 1.24548751048213 1.29697206601524 1.36727050795613 1.38899447428642
2020-08-02 75 163 169 1.17479701737718 0.0621447763875087 1.05816299184338 1.07539361889539 1.13093784680949 1.17286217975681 1.2162547819493 1.27978722473208 1.29991124112397
2020-08-03 117 164 170 1.13010899387015 0.0542135470847291 1.02812250779267 1.04386795073527 1.09235749239526 1.12894917283999 1.16669832155972 1.22169270064015 1.23946392387809
2020-08-04 101 165 171 1.09777626119051 0.048734104922551 1.00555450962706 1.0192903816859 1.06413797612268 1.09673885359093 1.13058916702767 1.17930208631902 1.19470867135876
2020-08-05 95 166 172 1.03692849020006 0.0437452314285156 0.953081717677504 0.966261943754604 1.00723710954768 1.03598722768107 1.06622048258716 1.10953749888711 1.12359278861632
2020-08-06 93 167 173 1.00629306592297 0.040609285657995 0.928468128385455 0.940871764366302 0.978428103764511 1.00556575162399 1.03363091516229 1.07377473151259 1.08656410275013
2020-08-07 69 168 174 0.971632986417653 0.0385497727980521 0.897496025316793 0.908914366950493 0.94563930789098 0.97117448257138 0.99737353931885 1.03600767298529 1.04938015078868
2020-08-08 94 169 175 0.95112101061214 0.0378619461920816 0.877535319681496 0.889223588204935 0.925367317020824 0.95075320924216 0.97665536737051 1.01407908182955 1.0267431882623
2020-08-09 80 170 176 0.961222405975269 0.0386068716451495 0.887824477779787 0.89856200981037 0.934835128025074 0.960680979653862 0.987034567083219 1.02605908697687 1.03912958110936
2020-08-10 92 171 177 0.932136739957269 0.0381184743667263 0.859321308885168 0.870124894381002 0.905986539188147 0.931444522903017 0.957883576386618 0.995196173768441 1.00794165782784
2020-08-11 96 172 178 0.934694053034335 0.0384915875911761 0.860487192299533 0.872233415846689 0.908426255757571 0.934363639047374 0.960359652454043 0.998492726083662 1.01184871284114
2020-08-12 102 173 179 0.957525530462343 0.039191648219416 0.881487246937807 0.893791618305361 0.931001337046448 0.956816009386549 0.983682734731739 1.0225517411636 1.03628592660474
2020-08-13 118 174 180 1.00905847957139 0.0406265836202055 0.931435623385387 0.943767856210717 0.981283166939032 1.0083416575895 1.03590470920221 1.07736448033848 1.09160024039487
2020-08-14 96 175 181 1.06250006942651 0.041239120162441 0.983321037421118 0.995247182804278 1.03442296835148 1.06170128681755 1.0901572825675 1.13131433870834 1.14498775868993
2020-08-15 78 176 182 1.04293385710425 0.0411860129872768 0.963515256704879 0.976040157279632 1.01455501438137 1.04244826655429 1.07076188993653 1.11077344159436 1.12454525521243
2020-08-16 75 177 183 1.03017354834207 0.0416590047246086 0.949735919171667 0.962959287625701 1.00162712359316 1.02925266985689 1.05805163347199 1.09986680722944 1.1137344066395
2020-08-17 93 178 184 1.02099079759126 0.0415682724755598 0.94165888995863 0.953857982099284 0.992741659208707 1.02023710816706 1.04841785932205 1.09053896788034 1.10431385191383
2020-08-18 85 179 185 0.993239442932989 0.0396223702036065 0.916760204456648 0.928647294017859 0.966483342971889 0.99280553243175 1.01969059459019 1.05906179563702 1.07216309201164
2020-08-19 83 180 186 0.958715949242477 0.0385996765018478 0.884566618982415 0.895741450519964 0.93239197445708 0.958325392251626 0.984635671475874 1.02351836048031 1.03550361782936
2020-08-20 56 181 187 0.863569057217278 0.0363717261312842 0.792800602925769 0.804627632069076 0.838911664978878 0.862903575127941 0.887645478562892 0.924514806921986 0.936420204824322
2020-08-21 72 182 188 0.832906899788111 0.0366483101623321 0.763199743196311 0.773897191837996 0.808025171793965 0.832372536854484 0.857089374969099 0.894421145808677 0.907106471072393
2020-08-22 63 183 189 0.824693313629483 0.0389220604710309 0.751769384194458 0.762733692865225 0.798017990654969 0.823369401974239 0.85043826770425 0.89054338619032 0.903473148012977
2020-08-23 65 184 190 0.834735386057028 0.0429564908362254 0.754271659282266 0.766443892731116 0.804750473708972 0.833402053050189 0.863347737086276 0.907421259032724 0.922129658773223
2020-08-24 74 185 191 0.836836309279392 0.0449435592633738 0.752259304165172 0.765546296395509 0.805651348563155 0.835463897125754 0.866798845112527 0.912961687004283 0.928006649448996
2020-08-25 72 186 192 0.849716405985395 0.0452949578564334 0.764339963512679 0.777254566979259 0.818396703308241 0.848992563904152 0.879695040562679 0.925489414020228 0.941097198937767
2020-08-26 76 187 193 0.871585428077125 0.0450711501947684 0.786098009131239 0.799197108570481 0.840019287054646 0.870465495871036 0.901670321270035 0.947545373486796 0.962010316162519
2020-08-27 76 188 194 0.939993023153282 0.0468037761128783 0.852204465359403 0.864893203093848 0.90799897433958 0.939115619119544 0.970905344353407 1.01893292612438 1.03515275280856
2020-08-28 77 189 195 0.978826733781237 0.0471511283412132 0.888341048022784 0.90263825674309 0.946382606053831 0.978127115838501 1.01069548746541 1.05755775340236 1.07263024977122
2020-08-29 47 190 196 0.968104655996004 0.045854361753566 0.880262633494774 0.894202956654791 0.936304041384126 0.967582308635828 0.998391128330106 1.04443059306231 1.06041126345737
2020-08-30 67 191 197 0.983127267063448 0.0454681270446086 0.896759348746916 0.910426838583106 0.952223334351191 0.982255358780979 1.01292656970547 1.0592605133444 1.07391284640047
2020-08-31 73 192 198 0.986104085138112 0.0452968907233769 0.899069114269516 0.913004320978038 0.954922906893138 0.985665636753947 1.01610539651913 1.06133814933692 1.07657658462295
2020-09-01 74 193 199 0.992806520048098 0.0448040786170199 0.907324954438239 0.919791349290971 0.962310678839368 0.991919272852109 1.02231586827552 1.06758921450189 1.08246776912701
2020-09-02 63 194 200 0.969769779106477 0.044258513181212 0.884076851564083 0.898436168370979 0.939451158690571 0.969103532008004 0.999692479754398 1.04353927501247 1.05786764089231
2020-09-03 65 195 201 0.949959228639148 0.0442879768533833 0.865981171877281 0.878806038763802 0.919671589799086 0.949302137823114 0.979585937550103 1.02310031336903 1.03945581738039
2020-09-04 59 196 202 0.917993015746432 0.0436412415074692 0.834597933200334 0.847785904672601 0.888045224249713 0.917289837404539 0.946589079672223 0.991696866217305 1.00660046710701
if (!requireNamespace("pacman", quietly = T)) install.packages("pacman")
pacman::p_load(tidyverse, lubridate, scales, glue, patchwork, ggthemes, incidence, EpiEstim, curl)
# 「含まれるか」を意味する%in%のnot equal版
'%!in%' <- function(x,y)!('%in%'(x,y))
#######################################################
#jagjapan 首都3県の実効再生産数---------------------------
#######################################################
URL = "https://dl.dropboxusercontent.com/s/6mztoeb6xf78g5w/COVID-19.csv"
PATH <- "jagjapan.csv"
download.file(URL,PATH)
jagjapan_master <- read_csv(PATH) %>% dplyr::select(6:16)
#日付
jagjapan_master$確定日 <- lubridate::mdy(jagjapan_master$確定日)
jagjapan_master$発症日 <- lubridate::mdy(jagjapan_master$発症日)
#TimeLag
jagjapan_master$timelag <- jag$確定日 - jag$発症日
#受診都道府県が"千葉県","埼玉県","神奈川県"かつ確定日が3月以降の陽性者を抽出
pref <- c("千葉県","埼玉県","神奈川県")
confirmed_0301 <- jagjapan_master %>% dplyr::filter(確定日>="2020-03-01" & 受診都道府県 %in% pref)
#居住都道府県で抽出
#residence_0301 <- jagjapan_master %>% dplyr::filter(確定日>="2020-03-01" & 居住都道府県 %in% pref)
#発症日がNAの例数
confirmed_0301 %>% dplyr::filter(is.na(発症日)) %>% count()
#n=5398
#NA削除
confirmed_0301 <- confirmed_0301 %>% dplyr::filter(!is.na(発症日))
#incidenceオブジェクト作成
dat_date <- confirmed_0301$発症日
#確認
new_i <- incidence(dat_date)
new_i
plot(new_i)
date_onset_latest <- length(new_i$dates)
#データが不十分な直近をカット
plot(new_i[12:date_onset_latest-12])
T <- nrow(new_i[12:date_onset_latest-12]$counts)
#7日間windowでRtを算出する
t_start <- seq(2, T-6)
t_end <- t_start + 6
#Rt算出
estimated_Rt <- estimate_R(new_i[12:date_onset_latest-12],
method = "uncertain_si",
config = make_config(list(
mean_si = 4.8, std_mean_si = 0.7109351,
min_mean_si = 3.2, max_mean_si = 6,
std_si = 2.3, std_std_si = 0.7695178,
min_std_si = 0.5, max_std_si = 2.5,
t_start = t_start,
t_end = t_end)))
#Rtをcsvに保存
chiba_kanagawa_saitama_rt_by_onset <- as.data.frame(estimated_Rt$R)
write.csv(chiba_kanagawa_saitama_rt_by_onset, file = "chiba_kanagawa_saitama_rt_by_onset.csv", row.names = FALSE)
chiba_kanagawa_saitama_onset_dates <- cbind.data.frame(estimated_Rt$dates, estimated_Rt$I) %>%
as_tibble() %>%
rename(dates=`estimated_Rt$dates`,counts=`estimated_Rt$I`)
#発症日をcsvに保存
write.csv(chiba_kanagawa_saitama_onset_dates, file = "chiba_kanagawa_saitama_onset_dates.csv", row.names = FALSE)
#全体のグラフの確認
plot(estimated_Rt, legend = FALSE)
#描画範囲
lims <- as.Date(strptime(c("2020-03-01","2020-09-05"), format = "%Y-%m-%d"))
#今日の日付
today <- lubridate::today()
#新規陽性者数グラフ
p1 <- plot(estimated_Rt, "incid") +
theme_clean()+
labs(x="", title="COVI-19 千葉県・神奈川県・埼玉県の発症日別陽性者数" ,y="")+
scale_x_date(limits = lims, date_breaks = "3 days", labels = date_format(format = "%B%d日"))+
theme(axis.text.x = element_text(angle = 90,hjust = 1)) +
theme(legend.position = "none")+
scale_y_continuous(expand = c(0,0), breaks = seq(0,500, by=10))+
scale_fill_manual(values = c("#AD002A"))
p1
#Rtグラフ
p2 <- plot(estimated_Rt, "R")+
theme_clean()+
theme(legend.position = "none")+
labs(title = "発症日ベースの実効再生産数", x="", y=bquote("Estimated" ~ R[t]), caption = glue("mean serial interval = 4.8 days, SD = 2.3 days\n(ヽ´ん`)@kenmomd {today}作成 \nDATA:J.A.G JAPAN"))+
geom_hline(yintercept = 1, colour = "steelblue") +
scale_x_date(limits = lims, date_breaks = "3 days", labels = date_format(format = "%B%d日"))+
theme(axis.text.x = element_text(angle = 90,hjust = 1)) +
scale_y_continuous(expand = c(0,0), breaks = seq(0,6, by=0.2))+
coord_cartesian(ylim = c(0.2,2.5)) #y軸範囲
p2
pp <- p1/p2
pp
#グラフ画像の保存
ggsave(filename = glue("Chiba_Kanagawa_Saitama_COVID-19_Rt_by_onset_{today}.png"), plot=pp, width=15, height=10, dpi = 160)
#2軸プロット
chiba_kanagawa_saitama_rt_by_onset <- read_csv("chiba_kanagawa_saitama_rt_by_onset.csv")
p3 <- chiba_kanagawa_saitama_rt_by_onset %>%
select(c(dates,incidence,"Median(R)","Quantile.0.025(R)" ,"Quantile.0.975(R)")) %>%
mutate(rescaled_Rt = (`Median(R)`)*60-60) %>%
mutate(rescaled_Rmin = (`Quantile.0.025(R)`)*60-60) %>%
mutate(rescaled_Rmax = (`Quantile.0.975(R)`)*60-60) %>%
pivot_longer(cols = c(-dates,-rescaled_Rt,-rescaled_Rmin,-rescaled_Rmax), names_to="var", values_to="value") %>%
#dplyr::filter(var != "incidence") %>%
dplyr::filter(var %!in% c("Quantile.0.025(R)", "Quantile.0.975(R)","Median(R)")) %>%
ggplot(aes(x=dates))+
theme_minimal(base_size = 13, base_family = "HiraginoSans-W4")+
theme(axis.text.x = element_text(angle = 45, hjust = 1))+
theme(axis.text.y = element_text(angle = 0))+
scale_x_date(date_breaks = "1 week", labels = date_format(format = "%Y-%m-%d"))+
scale_y_continuous(sec.axis = sec_axis(~./60+1,
name = bquote("Estimated" ~ R[t]), breaks = seq(0,7,0.2)), breaks = seq(-100,300,20))+
coord_cartesian(ylim = c(-40,120))+
geom_bar(aes(y = value), stat="identity", alpha=0.7, fill="orange",colour="orange", width=0.2)+
geom_hline(yintercept=0)+
geom_ribbon(aes(ymin = rescaled_Rmin, ymax = rescaled_Rmax), alpha = 0.4, fill="light blue", colour="light blue") +
geom_line(aes(y=rescaled_Rt), size=0.8, colour="steel blue")+
labs(title="千葉県・神奈川県・埼玉県の発症日別COVID-19陽性者数と発症日基準の実効再生産数",
x = "", y = "Cases",
caption = glue("mean serial interval = 4.8日, SD = 2.3日, 7日間window\n(ヽ´ん`)@kenmomd {today}作成 \nDATA:J.A.G JAPAN"))
p3
ggsave(filename = glue("chiba_kanagawa_saitama_Rt_by_onset2_{today}.png"), plot=p2, width=13, height=10, dpi = 160)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment