library(readxl)
covid19_in_R <- read_excel("covid19 in R.xlsx", sheet = "modello R")
dC<- covid19_in_R$`nuovi casi`
dD<- covid19_in_R$`nuovi deceduti`
par(mfrow=c(2,2))
hist(dC)
hist(dD)
plot(dC, type="l", main="New cases trend")
plot(dD, type="l", main="New deceased trend")

Average<- c(mean(dC),mean(dD))
Standard_Deviation<- c(sd(dC),sd(dD))
head(rnorm(dC),6)
## [1] 0.7512952 1.9337950 -2.0299773 -1.5560114 -0.5435943 1.2845024
hist(rnorm(dC))

Ns<-seq(10000,100000,30000)
B <- 1000
par(mfrow=c(2,2))
LIM <- c(-4.5,4.5)
for(dC in Ns){
ts <- replicate(B, {
X <- rnorm(dC)
sqrt(dC)*mean(X)/sd(X)
})
ps <- seq(1/(B+1),1-1/(B+1),len=B)
qqplot(qt(ps,df=dC-1),ts,main=dC,
xlab="Theoretical",ylab="Observed",
xlim=LIM, ylim=LIM)
abline(0,1)
}
