On January 31, 2020, the Council of Ministers declared a state of emergency, for a period of six months, as a result of the health risk associated with the Coronavirus infection. The Head of the Civil Protection Department, Angelo Borrelli, is entrusted with the coordination of the interventions necessary to face the emergency on the national territory. The main actions coordinated by the Head of the Department are aimed at rescuing and assisting the population possibly affected by the infection, at strengthening controls in the airport and port areas, in continuity with the urgent measures already adopted by the Ministry of Health, upon their return to Italy. of citizens who are in countries at risk and the repatriation of foreign citizens to countries of origin exposed to risk.

To inform citizens and make the collected data available, useful for communication and information purposes only, the Department of Civil Protection has developed an interactive geographical dashboard that can be reached at the addresses http://arcg.is/C1unv (desktop version) and http : //arcg.is/081a51 (mobile version) and makes available, under license CC-BY-4.0, the following information updated daily at 18:30 (after the press conference of the Head of Department): ## Covid-19 Italian cases updates

CV19_backup<- read.csv("https://raw.githubusercontent.com/pcm-dpc/COVID-19/master/dati-andamento-nazionale/dpc-covid19-ita-andamento-nazionale.csv")

names(CV19_backup)
##  [1] "data"                         "stato"                       
##  [3] "ricoverati_con_sintomi"       "terapia_intensiva"           
##  [5] "totale_ospedalizzati"         "isolamento_domiciliare"      
##  [7] "totale_positivi"              "variazione_totale_positivi"  
##  [9] "nuovi_positivi"               "dimessi_guariti"             
## [11] "deceduti"                     "casi_da_sospetto_diagnostico"
## [13] "casi_da_screening"            "totale_casi"                 
## [15] "tamponi"                      "casi_testati"                
## [17] "note"
Today<- Sys.time()
Today
## [1] "2020-08-20 20:09:44 UTC"
cases_today<-max(CV19_backup$totale_casi)

deceased_today<-max(CV19_backup$deceduti)

new_positives_today<- max(CV19_backup$nuovi_positivi)


as.table(c(Cases=cases_today,Deceased=deceased_today,Positives=new_positives_today))
##     Cases  Deceased Positives 
##    256118     35418      6557
cv19_cumulate<- CV19_backup%>%
  select(data,totale_casi,deceduti,totale_positivi)

head(cv19_cumulate,10)
##                   data totale_casi deceduti totale_positivi
## 1  2020-02-24T18:00:00         229        7             221
## 2  2020-02-25T18:00:00         322       10             311
## 3  2020-02-26T18:00:00         400       12             385
## 4  2020-02-27T18:00:00         650       17             588
## 5  2020-02-28T18:00:00         888       21             821
## 6  2020-02-29T18:00:00        1128       29            1049
## 7  2020-03-01T18:00:00        1694       34            1577
## 8  2020-03-02T18:00:00        2036       52            1835
## 9  2020-03-03T18:00:00        2502       79            2263
## 10 2020-03-04T18:00:00        3089      107            2706
totale_casi<- (cv19_cumulate$totale_casi)
deceduti<- cv19_cumulate$deceduti
totale_positivi<- cv19_cumulate$totale_positivi
par(3,2);
## [[1]]
## NULL
## 
## [[2]]
## NULL
hist(totale_casi)
plot(totale_casi,type="l")

hist(deceduti)
plot(deceduti,type="l")

hist(totale_positivi)
plot(totale_positivi,type="l")

cv19_daily<- CV19_backup%>%
  select(nuovi_positivi,variazione_totale_positivi)

nuovi_positivi<- cv19_daily$nuovi_positivi
variazione_totale_positivi<- cv19_daily$variazione_totale_positivi


par(mfrow = c(2,2));
hist(nuovi_positivi)
plot(nuovi_positivi,type="h",main="New positives")

hist(variazione_totale_positivi)
plot(variazione_totale_positivi,type="h",main="Variation")

##New Positives Average, St Deviation and Variance:

avg<- round(mean(nuovi_positivi))
st_dev<- round(sd(nuovi_positivi))
varian<-var(nuovi_positivi)

as.table(c(Avg=avg,StDev=st_dev,Variance=varian))
##      Avg    StDev Variance 
##     1431     1689  2852943
max(nuovi_positivi)
## [1] 6557
n_var_pos<-max(variazione_totale_positivi)



Ns<-seq(115,140,5)
B <- 1000
par(mfrow=c(2,3))
LIM <- c(-4.5,4.5)

for(n_var_pos in Ns){
    ts <- replicate(B, {
    X <- rnorm(variazione_totale_positivi)
    sqrt(n_var_pos)*mean(X)/sd(X)
    })
    ps <- seq(1/(B+1),1-1/(B+1),len=B)
    qqplot(qt(ps,df=n_var_pos-1),ts,main=n_var_pos,
           xlab="Theoretical",ylab="Observed",
           xlim=LIM, ylim=LIM)
    abline(0,1)
} 

#Different samples show little variations at tails levels #Selecting a sample of Variation of total positives of 135 we value its trend

var_norm<-rnorm(variazione_totale_positivi)
mean(var_norm);sd(var_norm)
## [1] 0.06493991
## [1] 0.9922507
hist(var_norm)

N<- 500
diff_avg<- mean(variazione_totale_positivi)-mean(var_norm)
variation<- sqrt(var(variazione_totale_positivi)^2+var(var_norm)^2)
se<- sqrt(1/N)*diff_avg/variation