File:Suomen koronavirusepidemian 1 aallon skewnorm kayra 1.svg

Original file(SVG file, nominally 891 × 493 pixels, file size: 46 KB)

Captions

Captions

First wave of Covid-19 pandemic in Finland, skew normal distribution of cases against time

Summary

edit
Description
Suomi: Suomen koronavirusepidemian ensimmäinen aalto, vino normaalijakauma jaettuna kahdella
English: First wave of Covid-19 pandemic in Finland, skew normal distribution of cases against time
Date
Source Own work
Author Merikanto

This image is basede net github covid-19 aggrehared data

Python script processing , matplotlib plotting

Python 3 code

    1. covid-19 finland python 3 script
    2. case data
    3. fitted to skew normal distribution, new cases against time

from scipy import stats import matplotlib.pyplot as plt import numpy as np import pandas as pd import locale from datetime import datetime, timedelta from statsmodels.nonparametric.kernel_regression import KernelReg from scipy.signal import savgol_filter

paivaluku=0 peak_rate=1

dates1=None cases1=np.array(0) dailycases1=np.array(0)

def smooth(x,window_len=11,window='hanning'):

if x.ndim != 1: raise (ValueError, "smooth only accepts 1 dimension arrays.")

if x.size < window_len: raise (ValueError, "Input vector needs to be bigger than window size.")

if window_len<3: return (x)

if not window in ['flat', 'hanning', 'hamming', 'bartlett', 'blackman']: raise (ValueError, "Window is on of 'flat', 'hanning', 'hamming', 'bartlett', 'blackman'")

s=np.r_[x[window_len-1:0:-1],x,x[-2:-window_len-1:-1]]

if window == 'flat': w=np.ones(window_len,'d') else: w=eval('np.'+window+'(window_len)')

y=np.convolve(w/w.sum(),s,mode='valid') return y


    1. load data

def load_covid_19_data_for_file(): global dates1 global cases1 global dailycases1 global paivaluku global peak_rate


df = pd.read_csv(r'kovadata3.csv', delimiter=';') ystring=df['Confirmed'] dates0=df['Date'] cases00=np.array(ystring) cases1=cases00.astype(int) locale.setlocale(locale.LC_TIME, "fi_FI") dates1 = [datetime.strptime(d,'%Y-%m-%d').date() for d in dates0] c0=np.array(ystring) c=c0.astype(int) len1=len(c) paivaluku=len1 y0= [0] * len1 indeksi= [0] * len1 for n in range(1,(len1-1)): y0[n]=c[n]-c[n-1] indeksi[n]=n

peak_rate=max(y0)

print (peak_rate)

y1=np.array(y0)

y=y1.astype(int)

dailycases1=y


## generate incidence date s1 = list(); for m in range(1,(len1-1)): idx=indeksi[m] yy=y0[m] for n in range(1,yy): s1.append(idx)


x = np.arange(0,len1,1)


data0=np.array(s1) samples=data0.astype(int)

return(data0)


    1. main program


data=load_covid_19_data_for_file()

lena1=len(data)

  1. estimate parameters from sample

ae, loce, scalee = stats.skewnorm.fit(data)

x=np.linspace(0,paivaluku, paivaluku) p = stats.skewnorm.pdf(x,ae, loce, scalee)


  1. kr = KernelReg(dailycases1,x,'c')
  2. y_pred, y_std = kr.fit(x)

y_pred = savgol_filter(dailycases1, 15, 3)


len1=len(dailycases1)


as1 = list(); for m in range(1,(len1-1)): idx=x[m] yy=y_pred[m].astype(int) for n in range(1,yy): as1.append(idx)


data00=np.array(as1) data20=data00.astype(int)

af, locf, scalef = stats.skewnorm.fit(data20) pf = stats.skewnorm.pdf(x,af, locf, scalef)


maxp=max(p) p2=p/maxp p3=p2*peak_rate

p4=p3/2

maxpf=max(pf) p2f=pf/maxpf p3f=p2f*peak_rate p4f=p3f/2

  1. s1=smooth(dailycases1)
  2. le1=len(s1)
  3. x1=np.linspace(0,le1,le1)
  4. a1, loc1, scale1 = stats.skewnorm.fit(x1)



print (ae) print (loce) print (scalee)

plt.title("Koronan kevään 2020 aalto Suomessa", size=18)

plt.legend(fontsize=14) plt.xlabel("Kuukausi", fontsize=16) plt.ylabel("Koronatapauksia", fontsize=16) plt.xticks(fontsize=15) plt.yticks(fontsize=15)


plt.plot(dates1,dailycases1,linewidth=1, label="Päivittäiset koronatapaukset")

  1. plt.plot(dates1,p4,'r--',linewidth=1.5, label="Teoreettinen käyrä: \n vino normaalijakauma\n jaettuna kahdella")

plt.plot(dates1,y_pred,'g--',linewidth=2, label="15 päivän keskiarvo") plt.plot(dates1,p4f,'r--',linewidth=1.5, label="15 päivän keskiarvo ja vino normaalijakauma")


  1. plt.plot(x,dailycases1,linewidth=2, label="Päivittäiset koronatapaukset")
  2. plt.plot(x,p4,'r--',linewidth=1.5, label="Teoreettinen käyrä: \n vino normaalijakauma\n jaettuna kahdella")
  3. plt.plot(x,y_pred,'g--',linewidth=1, label="15 päivän Savizky-Golay")
  4. plt.plot(x,p4f,'r--',linewidth=1.5, label="15 päivän Savizky-Golay ja vino normaalijakauma")



plt.legend()

plt.show()


Data

KK;Date;Confirmed;Recovered;Deaths 6641;2020-02-26;2;1;0 6829;2020-02-27;2;1;0 7017;2020-02-28;2;1;0 7205;2020-02-29;3;1;0 7393;2020-03-01;6;1;0 7581;2020-03-02;6;1;0 7769;2020-03-03;6;1;0 7957;2020-03-04;6;1;0 8145;2020-03-05;12;1;0 8333;2020-03-06;15;1;0 8521;2020-03-07;15;1;0 8709;2020-03-08;23;1;0 8897;2020-03-09;30;1;0 9085;2020-03-10;40;1;0 9273;2020-03-11;59;1;0 9461;2020-03-12;59;1;0 9649;2020-03-13;155;1;0 9837;2020-03-14;225;1;0 10025;2020-03-15;244;10;0 10213;2020-03-16;277;10;0 10401;2020-03-17;321;10;0 10589;2020-03-18;336;10;0 10777;2020-03-19;400;10;0 10965;2020-03-20;450;10;0 11153;2020-03-21;523;10;1 11341;2020-03-22;626;10;1 11529;2020-03-23;700;10;1 11717;2020-03-24;792;10;1 11905;2020-03-25;880;10;3 12093;2020-03-26;958;10;5 12281;2020-03-27;1041;10;7 12469;2020-03-28;1167;10;9 12657;2020-03-29;1240;10;11 12845;2020-03-30;1352;10;13 13033;2020-03-31;1418;10;17 13221;2020-04-01;1446;10;17 13409;2020-04-02;1518;300;19 13597;2020-04-03;1615;300;20 13785;2020-04-04;1882;300;25 13973;2020-04-05;1927;300;28 14161;2020-04-06;2176;300;27 14349;2020-04-07;2308;300;34 14537;2020-04-08;2487;300;40 14725;2020-04-09;2605;300;42 14913;2020-04-10;2769;300;48 15101;2020-04-11;2905;300;49 15289;2020-04-12;2974;300;56 15477;2020-04-13;3064;300;59 15665;2020-04-14;3161;300;64 15853;2020-04-15;3237;300;72 16041;2020-04-16;3369;1700;75 16229;2020-04-17;3489;1700;82 16417;2020-04-18;3681;1700;90 16605;2020-04-19;3783;1700;94 16793;2020-04-20;3868;2000;98 16981;2020-04-21;4014;2000;141 17169;2020-04-22;4129;2000;149 17357;2020-04-23;4284;2000;172 17545;2020-04-24;4395;2500;177 17733;2020-04-25;4475;2500;186 17921;2020-04-26;4576;2500;190 18109;2020-04-27;4695;2500;193 18297;2020-04-28;4740;2800;199 18485;2020-04-29;4906;2800;206 18673;2020-04-30;4995;3000;211 18861;2020-05-01;5051;3000;218 19049;2020-05-02;5176;3000;220 19237;2020-05-03;5254;3000;230 19425;2020-05-04;5327;3500;240 19613;2020-05-05;5412;3500;246 19801;2020-05-06;5573;3500;252 19989;2020-05-07;5673;3500;255 20177;2020-05-08;5738;4000;260 20365;2020-05-09;5880;4000;265 20553;2020-05-10;5962;4000;267 20741;2020-05-11;5984;4000;271 20929;2020-05-12;6003;4300;275 21117;2020-05-13;6054;4300;284 21305;2020-05-14;6145;4300;287 21493;2020-05-15;6228;5000;293 21681;2020-05-16;6286;5000;297 21869;2020-05-17;6347;5000;298 22057;2020-05-18;6380;5000;300 22245;2020-05-19;6399;5000;301 22433;2020-05-20;6443;4800;304 22621;2020-05-21;6493;4800;306 22809;2020-05-22;6537;4800;306 22997;2020-05-23;6568;4800;306 23185;2020-05-24;6579;4800;307 23373;2020-05-25;6599;5100;308 23561;2020-05-26;6628;5100;312 23749;2020-05-27;6692;5100;313 23937;2020-05-28;6743;5500;313 24125;2020-05-29;6776;5500;314 24313;2020-05-30;6826;5500;316 24501;2020-05-31;6859;5500;320 24689;2020-06-01;6885;5500;318 24877;2020-06-02;6887;5500;320 25065;2020-06-03;6911;5500;321 25253;2020-06-04;6911;5800;322 25441;2020-06-05;6941;5800;322 25629;2020-06-06;6964;5800;322 25817;2020-06-07;6981;5800;323 26005;2020-06-08;7001;5800;323 26193;2020-06-09;7025;5800;324 26381;2020-06-10;7040;5800;324 26569;2020-06-11;7064;6200;325 26757;2020-06-12;7073;6200;325 26945;2020-06-13;7087;6200;325 27133;2020-06-14;7104;6200;326 27321;2020-06-15;7108;6200;326 27509;2020-06-16;7112;6200;326 27697;2020-06-17;7117;6200;326 27885;2020-06-18;7119;6200;326 28073;2020-06-19;7133;6200;326 28261;2020-06-20;7142;6200;326 28449;2020-06-21;7143;6200;326 28637;2020-06-22;7144;6400;327 28825;2020-06-23;7155;6400;327 29013;2020-06-24;7167;6600;327 29201;2020-06-25;7172;6600;327 29389;2020-06-26;7191;6600;328 29577;2020-06-27;7198;6600;328 29765;2020-06-28;7198;6600;328 29953;2020-06-29;7209;6600;328 30141;2020-06-30;7214;6600;328 30329;2020-07-01;7236;6700;328 30517;2020-07-02;7241;6700;328 30705;2020-07-03;7242;6700;329 30893;2020-07-04;7248;6700;329 31081;2020-07-05;7253;6700;329 31269;2020-07-06;7257;6700;329 31457;2020-07-07;7262;6700;329 31645;2020-07-08;7265;6800;329 31833;2020-07-09;7273;6800;329 32021;2020-07-10;7279;6800;329 32209;2020-07-11;7291;6800;329 32397;2020-07-12;7294;6800;329 32585;2020-07-13;7295;6800;329 32773;2020-07-14;7301;6800;329 32961;2020-07-15;7296;6880;328 33149;2020-07-16;7293;6880;328 33337;2020-07-17;7301;6880;328 33525;2020-07-18;7318;6880;328 33713;2020-07-19;7335;6880;328 33901;2020-07-20;7340;6880;328 34089;2020-07-21;7351;6880;328 34277;2020-07-22;7362;6920;328 34465;2020-07-23;7372;6920;328 34653;2020-07-24;7380;6920;329 34841;2020-07-25;7388;6920;329 35029;2020-07-26;7393;6920;329 35217;2020-07-27;7398;6920;329 35405;2020-07-28;7404;6920;329 35593;2020-07-29;7414;6950;329 35781;2020-07-30;7423;6950;329

Licensing

edit
I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current14:27, 2 August 2020Thumbnail for version as of 14:27, 2 August 2020891 × 493 (46 KB)Merikanto (talk | contribs)Correct of text in image
14:24, 2 August 2020Thumbnail for version as of 14:24, 2 August 2020918 × 539 (48 KB)Merikanto (talk | contribs)Update of image
08:10, 2 August 2020Thumbnail for version as of 08:10, 2 August 20201,020 × 491 (48 KB)Merikanto (talk | contribs)Uploaded own work with UploadWizard

There are no pages that use this file.

Metadata