File:Uudet covid tapaukset paivittain kevat 2020 1.svg
Original file (SVG file, nominally 865 × 361 pixels, file size: 74 KB)
Captions
Contents
Summary
[edit]DescriptionUudet covid tapaukset paivittain kevat 2020 1.svg |
English: New covid-19 cases in finland, day by day in 2020 |
Date | |
Source | Own work |
Author | Merikanto |
Info
[edit]Bars represnt tested covid-19 cases in Finland. Dashed line is 7 day moving average of daily cases.
Additional data
[edit]Data used draw this doc with libreoffice calc
Data is fetched with r script to data file.
Data file is edited with geany (Date format truncation)
"IDX","Pvm","Paivittaiset tapaukset"
"8","29.01.",1
"9","30.01.",0
"10","31.01.",0
"11","01.02.",0
"12","02.02.",0
"13","03.02.",0
"14","04.02.",0
"15","05.02.",0
"16","06.02.",0
"17","07.02.",0
"18","08.02.",0
"19","09.02.",0
"20","10.02.",0
"21","11.02.",0
"22","12.02.",0
"23","13.02.",0
"24","14.02.",0
"25","15.02.",0
"26","16.02.",0
"27","17.02.",0
"28","18.02.",0
"29","19.02.",0
"30","20.02.",0
"31","21.02.",0
"32","22.02.",0
"33","23.02.",0
"34","24.02.",0
"35","25.02.",0
"36","26.02.",1
"37","27.02.",0
"38","28.02.",0
"39","29.02.",1
"40","01.03.",3
"41","02.03.",0
"42","03.03.",0
"43","04.03.",0
"44","05.03.",6
"45","06.03.",3
"46","07.03.",0
"47","08.03.",8
"48","09.03.",7
"49","10.03.",10
"50","11.03.",19
"51","12.03.",0
"52","13.03.",96
"53","14.03.",70
"54","15.03.",19
"55","16.03.",33
"56","17.03.",44
"57","18.03.",15
"58","19.03.",64
"59","20.03.",50
"60","21.03.",73
"61","22.03.",103
"62","23.03.",74
"63","24.03.",92
"64","25.03.",88
"65","26.03.",78
"66","27.03.",83
"67","28.03.",126
"68","29.03.",73
"69","30.03.",112
"70","31.03.",66
"71","01.04.",28
"72","02.04.",72
"73","03.04.",97
"74","04.04.",267
"75","05.04.",45
"76","06.04.",249
"77","07.04.",132
"78","08.04.",179
"79","09.04.",118
"80","10.04.",164
"81","11.04.",136
"82","12.04.",69
"83","13.04.",90
"84","14.04.",97
"85","15.04.",76
"86","16.04.",132
"87","17.04.",120
"88","18.04.",192
"89","19.04.",102
"90","20.04.",85
"91","21.04.",146
"92","22.04.",115
"93","23.04.",155
"94","24.04.",111
"95","25.04.",80
"96","26.04.",101
"97","27.04.",119
"98","28.04.",45
"99","29.04.",166
"100","30.04.",89
"101","01.05.",56
"102","02.05.",125
"103","03.05.",78
"104","04.05.",73
"105","05.05.",85
"106","06.05.",161
"107","07.05.",100
"108","08.05.",65
"109","09.05.",142
"110","10.05.",82
"111","11.05.",22
"112","12.05.",19
"113","13.05.",51
"114","14.05.",91
"115","15.05.",83
"116","16.05.",58
"117","17.05.",61
"118","18.05.",33
"119","19.05.",19
"120","20.05.",44
"121","21.05.",50
"122","22.05.",44
"123","23.05.",31
"124","24.05.",11
"125","25.05.",20
"126","26.05.",29
"127","27.05.",64
"128","28.05.",51
"129","29.05.",33
"130","30.05.",50
"131","31.05.",33
"132","01.06.",26
"133","02.06.",2
"134","03.06.",24
"135","04.06.",0
"136","05.06.",30
"137","06.06.",23
"138","07.06.",17
"139","08.06.",20
"140","09.06.",24
"141","10.06.",15
"142","11.06.",24
"143","12.06.",9
"144","13.06.",14
"145","14.06.",17
"146","15.06.",4
"147","16.06.",4
"148","17.06.",5
"149","18.06.",2
"150","19.06.",14
"151","20.06.",9
"152","21.06.",1
"153","22.06.",1
"154","23.06.",11
"155","24.06.",12
"156","25.06.",5
"157","26.06.",19
"158","27.06.",7
"159","28.06.",0
"160","29.06.",11
"161","30.06.",5
"162","01.07.",22
"163","02.07.",5
"164","03.07.",1
"165","04.07.",6
"166","05.07.",5
"167","06.07.",4
"168","07.07.",5
"169","08.07.",3
"170","09.07.",8
"171","10.07.",6
"172","11.07.",12
"173","12.07.",3
"174","13.07.",1
"175","14.07.",6
"176","15.07.",-5
"177","16.07.",-3
"178","17.07.",8
"179","18.07.",17
"180","19.07.",17
"181","20.07.",5
"182","21.07.",11
"183","22.07.",11
"184","23.07.",10
"185","24.07.",8
"186","25.07.",8
"187","26.07.",5
"188","27.07.",5
"189","28.07.",6
"190","29.07.",10
"191","30.07.",9
"192","31.07.",9
"193","01.08.",11
"194","02.08.",10
"195","03.08.",13
"196","04.08.",17
"197","05.08.",29
"198","06.08.",20
"199","07.08.",22
"200","08.08.",14
"201","09.08.",16
R script to fetch the data
- experimental calculation of R0
- R code
- calculate R0 from COVID-19 epidemic data
- additional script only, meybe needs adjust
- v 0001.0000
- 11.1.2021
-
- install.packages("ggplot2", "plotly", repos ="https://ftp.acc.umu.se/mirror/CRAN/")
- install.packages("R0",repos ="https://ftp.acc.umu.se/mirror/CRAN/")
- library(plotly)
library (R0)
library (ggplot2)
plottaa=1 ## 0, 1 or 2 -1 debug
plotname="R0_Suomessa_1.svg"
polku<-"/Users/himot/akor1/"
library(svglite)
library(rvest)
library(readtext)
library(stringi)
library(stringr)
library(datamart)
library(XML)
beginday1='01/04/2020'
- limits of input data
datelimits1=c('2020/04/01', '2020/01/07')
- dates of prediction
datelimits2=c('2020/04/01', '2021/02/15')
load_data_from=2
- 0, 1 or 2 , 0 none plot, 1 plot, 2 ggplot, -1 debug
plottaa<-1
levylle<-1 ## 0 to display, 1 to disc
plotname<-"R0_Suomessa_4.svg" ## name of plot file
polku<-"/Users/himot/akor1/" ## path of plot file
today=Sys.Date()
- jos ylläoleva ei toimi, niin tää
- if above not func, this
- today=Sys.Date()-1
- print(today)
today1=format(today, "%d/%m/%Y")
today2=format(today, "%Y/%m/%d")
- print(today1)
- print(today2)
- stop(-1)
datelimits1=c(beginday1, today1)
paivat1=seq(as.Date("2020/4/1"), as.Date(today2), "days")
load_data_from_finnish_wiki<-function()
{
url1="https://fi.wikipedia.org/wiki/Suomen_koronaviruspandemian_aikajana"
destfile1="./ward0.txt"
download.file(url1, destfile1)
texti000<-readtext(destfile1)
texti0<-texti000$text
etsittava1="1. huhtikuuta 2020 alkaen"
len1=nchar(texti0)
k1=regexpr(pattern=etsittava1, texti0)
k1b=len1-k1
texti1=strtail(texti0,k1b)
sink("out1.txt")
print (texti1)
sink()
etsittava2=""
k2=regexpr(pattern=etsittava2, texti1)
texti2=strhead(texti1,k2)
sample1<-minimal_html(texti2)
tabu1 <- html_table(sample1, fill=TRUE)1
colnames(tabu1) <- c("V1","V2", "V3","V4", "V5","V6", "V7","V8" )
- print(tabu1)
sairaalassa00<-tabu1$V4
sairaalassa=as.integer(sairaalassa00)
teholla00<-tabu1$V5
teholla=as.integer(teholla00)
uusiatapauksia00<-tabu1$V3
uusiatapauksia0<-gsub(" ", "", uusiatapauksia00)
uusia_tapauksia=as.integer(uusiatapauksia0)
uusiakuolleita00<-tabu1$V7
uusiakuolleita1=as.integer(uusiakuolleita00)
uusiakuolleita2<-uusiakuolleita1
uusiakuolleita2[uusiakuolleita2<0]<-0
uusia_kuolleita<-uusiakuolleita2
toipuneita00<-tabu1$V8
toipuneita01<-gsub(" ", "", toipuneita00)
toipuneita0<-gsub("[^0-9.-]", "", toipuneita01)
toipuneita=as.integer(toipuneita0)
tapauksia00<-tabu1$V2
tapauksia01<-gsub(" ", "", tapauksia00)
tapauksia0<-gsub("[^0-9.-]", "", tapauksia01)
tapauksia=as.integer(tapauksia0)
kuolleita00<-tabu1$V6
kuolleita=as.integer(kuolleita00)
aktiivisia_tapauksia=tapauksia-kuolleita-toipuneita
- print (paivat1)
- print (teholla)
- print (sairaalassa)
- print (tapauksia)
- print (kuolleita)
- print (toipuneita)
- print (uusia_tapauksia)
- print (uusia_kuolleita)
- plot(paivat1,aktiivisia_tapauksia)
- xy<-data.frame(paivat1, sairaalassa)
xy<-data.frame(paivat1, uusia_tapauksia)
- xy<-data.frame(paivat1, tapauksia)
xyz<-data.frame(paivat1, sairaalassa, teholla)
dfout1<-data.frame(paivat1, aktiivisia_tapauksia, uusia_tapauksia, sairaalassa, teholla, uusia_kuolleita )
names(dfout1)<-c("Pvm", "Aktiivisia_tapauksia","Uusia_tapauksia", "Sairaalassa", "Teholla", "Uusia_kuolleita")
write.csv2(dfout1, "./sairaalassa.csv",row.names=FALSE )
return(xy)
}
load_data_from_aggregated<-function()
{
- fetch the data
srkurl='https://datahub.io/core/covid-19/r/countries-aggregated.csv'
dfine <- read.csv(file=srkurl)
- head(dfine)
- class(dfine)
- tail(dfine, 5)
dfinland <- dfine[ which(dfine$Country=='Finland'), ]
- head(dfinland)
kols <- c("Date", "Confirmed","Recovered","Deaths")
tapaukset <- dfinland[kols]
- head(tapaukset)
len1=nrow(tapaukset)
- len1
len2=len1-1
len3=len2
confirmed<-tapaukset$Confirmed
deaths<-tapaukset$Deaths
dailycases <- vector()
dailycases <- c(dailycases, 0:(len2))
dailydeaths <- vector()
dailydeaths <- c(dailydeaths, 0:(len2))
m=0
dailycases[1]<-tapaukset$Confirmed[1]
- dailydeaths[1]<-tapaukset$Deaths[1]
dailydeaths[1]<-0
- confirmed
- deaths
m=1
for(n in 2:(len3+1)) {
a<-confirmed[n]
b<-confirmed[m]
#print (a)
#print (b)
cee<- (a-b)
#print(cee)
dailycases[n]=cee
m=m+1
}
mm=1
for(nn in 2:(len3+1)) {
aa<-deaths[nn]
bb<-deaths[mm]
#print ("_")
#print (aa)
#print (bb)
ceb=aa-bb
#if (ceb<0) ceb=0
#print(ceb)
dailydeaths[nn]=ceb
mm=mm+1
}
- deaths
- dailycases
- dailydeaths
dfout1<-dfinland
- print(nrow(dfinland))
- print(length(dailydeaths))
dfout1 <- cbind(dfout1, data.frame(dailycases))
dfout1 <- cbind(dfout1, data.frame(dailydeaths))
- head(dfout1)
dfout2<-within(dfout1, rm(Country))
names(dfout2) <- c('Date','Confirmed','Recovered','Deaths', 'DailyConfirmed','DailyDeaths')
- head(dfout2)
write.csv2(dfout2, "/Users/himot/akor1/finland_data1.csv");
daate1<-dfout2$Date
dailydeaths1<-dfout2$DailyDeaths
dailycases1<-dailycases
- daate1
- daate2<-gsub("2020-", "", daate1)
daate2<-daate1
leenu<-length(daate2)
- alkupvm<-50
alkupvm<-1
daate3<-daate2[alkupvm:leenu]
dailydeaths3<-dailydeaths1[alkupvm:leenu]
dailycases3<-dailycases1[alkupvm:leenu]
- daate3
- dailydeaths3
# barplot(dailydeaths3, main="Koronaviruskuolemat päivittäin vuonna 2020",
# names.arg=daate3)
dataf1 <- data.frame("Date" = daate3, "Paivitt_kuolemat"=dailydeaths3)
- str(dataf1)
dataf2 <- data.frame("Date" = daate3, "Paivitt_tapaukset"=dailycases3)
- str(dataf2)
write.csv(dataf1, "/Users/himot/akor1/dailydeaths1.csv", row.names=T)
write.csv(dataf2, "/Users/himot/akor1/dailycases1.csv", row.names=T)
indf1 <- read.csv(file = '/Users/himot/akor1/dailycases1.csv')
#head(indf1)
cases1<-indf1$Paivitt_tapaukset
dates1<-indf1$Date
len1=length(cases1)
dates2<-as.Date(dates1)
paivat<-1:len1
xy<-data.frame(daate3, dailycases3)
}
if(load_data_from==1)
{
xy<-load_data_from_finnish_wiki()
}
if(load_data_from==2)
{
xy<-load_data_from_aggregated()
}
names(xy)<-c("Dates","Cases")
print(xy)
#stop(-1)
select_datelimit_begin=as.Date(beginday1,format="%d/%m/%Y")
select_datelimit_end=as.Date(today1)
xy2<-xy[xy$Dates >= select_datelimit_begin,]
#print(xy2)
- stop(-1)
cases1<-xy2$Cases
dates1<-xy2$Dates
xy3<-data.frame( as.Date(dates1),as.integer(cases1) )
names(xy3)<-c("Dates", "Cases")
len1=length(cases1)
dates2<-as.Date(dates1)
paivat<-1:len1
num1<-cases1
dates1<-dates1
names1=dates1
len1=length(num1)
- sure negative values to zero
num1[num1<0]<-0
- r0 from last week!
lensub1=105
lensub1=7*17+2
lensub3=7*24+2
start_lok<-len1-lensub1
- start_lok<-len1-7
end_lok<-len1
print (names1[start_lok])
num<-num1[start_lok:end_lok]
names<-names1[start_lok:end_lok]
lena=length(num)
print (lena)
df1 <- setNames(num, names)
str(df1)
- generation time distribution
mGT = generation.time ("gamma", c(3, 1.5))
- r0, exponential method, last week:
est1<-est.R0.EG (df1, mGT, begin=1, end=77)
mGT = generation.time("gamma", c(2.45, 1.38))
- r0, second method
est2<-est.R0.ML (df1, mGT)
est1
est2
class(est1)
est1[1]
est2[1]
r0exp1<-est1[1]
r0exp1
estimaatti1<-r0exp1[1]
class(r0exp1)
class(estimaatti1)
str(estimaatti1)
vaalu1<-estimaatti1[1]$R
print ("vaalu1")
print (vaalu1[1])
- jono1<-toString(round(as.Numeric(r0exp1),4))
valju1<-round(vaalu1,2)
jono1<-toString(valju1)
jono11<-paste("R0_exp (kulunut viikko) ",jono1)
- barplot(dailycases3, main="Koronavirustapaukset päivittäin vuonna 2020",
- sub=jono11,
- names.arg=daate3)
mGT<-generation.time("gamma", c(3, 1.5))
TD <- est.R0.TD(df1, mGT, begin=1, end=lensub1, nsim=200)
TD.weekly <- smooth.Rt(TD, 7)
TD.weekly
TD.5D <- smooth.Rt(TD, 5)
paivat1<-TD.5D$epid$t
paivat2<-as.Date(paivat1)
r0t1<-TD.5D$R
conf1<-TD.5D$conf.int
class(TD.5D$conf.int)
if(plottaa==-1)
{
plot(paivat2, r0t1, pch=4, main="Arvioitu R0 Suomessa", xlab="Päivä", ylab="R0")
lines(paivat2,r0t1, col="black", lwd=4)
lines(paivat2,conf1$upper, col="red", lwd=1)
lines(paivat2,conf1$lower, col="blue")
}
if (plottaa==0)
{
plot(TD.5D, main="R0", xlab="Päivä", ylab="R0")
}
if(plottaa==1)
{
print("Plot 1 ,,,")
plotname1<-paste0(polku, plotname)
print(plotname1)
svg(filename=plotname1, width=9, height=5, pointsize=12)
plot(paivat2, r0t1, pch=20, main="Arvioitu R0 Suomessa", xlab="Kuukausi", ylab="R0", ylim=c(0.3,2.0), cex.lab=1.3, cex.axis=1.3, cex.main=1.3, cex.sub=1.3)
abline(h=1.0, col="green", lty=2, lwd=2)
lines(paivat2,r0t1, col="black", lwd=4)
lines(paivat2,conf1$upper, col="red", lwd=1)
lines(paivat2,conf1$lower, col="blue")
dev.off()
}
if(plottaa==2)
{
plotname1<-paste0(polku, plotname)
svg(filename=plotname1, width=6, height=3, pointsize=12)
plot(TD.5D, main="R0", xlab="Päivä", ylab="R0")
dev.off()
}
- plot(TD)
- plot(TD.weekly,type = "o", col = "red", xlab = "Viikko", ylab = "R0", main="Koronaviruksen R0 Suomessa")
- TD.weekly$R[1]
Licensing
[edit]- 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/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 08:23, 11 August 2020 | 865 × 361 (74 KB) | Merikanto (talk | contribs) | Format of date | |
08:04, 11 August 2020 | 914 × 287 (76 KB) | Merikanto (talk | contribs) | Muokkaus | ||
11:36, 28 July 2020 | 957 × 493 (74 KB) | Merikanto (talk | contribs) | Update | ||
11:50, 8 July 2020 | 1,127 × 411 (56 KB) | Merikanto (talk | contribs) | Update of image | ||
13:49, 17 June 2020 | 1,049 × 500 (58 KB) | Merikanto (talk | contribs) | 7 day moving average, data update | ||
07:43, 3 June 2020 | 1,006 × 517 (86 KB) | Merikanto (talk | contribs) | Update | ||
15:18, 24 May 2020 | 1,010 × 599 (52 KB) | Merikanto (talk | contribs) | Uploaded own work with UploadWizard |
You cannot overwrite this file.
File usage on Commons
The following page uses this file:
- File:Uudet covid tapaukset paivittain 1.svg (file redirect)
File usage on other wikis
The following other wikis use this file:
- Usage on fi.wikipedia.org
Metadata
This file contains additional information such as Exif metadata which may have been added by the digital camera, scanner, or software program used to create or digitize it. If the file has been modified from its original state, some details such as the timestamp may not fully reflect those of the original file. The timestamp is only as accurate as the clock in the camera, and it may be completely wrong.
Width | 244mm |
---|---|
Height | 102mm |