diff --git a/.Rhistory b/.Rhistory
index a9e956b16303f654f65785e320a4df7caa95e126..4825a80cb38e6045c7888dd404773e822c8e0869 100644
--- a/.Rhistory
+++ b/.Rhistory
@@ -1,33 +1,3 @@
-for(j in 1:(L-2)){
-qj =1
-SEQ = as.array(seq(-j+1,L-j))
-qj =sum(apply(SEQ,1,delay_fun))
-S=0
-for(i in seq(j+1,L)){
-S=S+delay_fun(i-j)*Hospitalization[i]/(Din[i]+0.00001) # I added a small number after Din to avoid dividing by 0 (happens when there is a long sequence of 0 in the hospitalization data)
-}
-lambda1[j] = lambda0[j]/qj*S
-}
-lambda0=lambda1
-Ein = rep(0, L)# expected number of hospitalization to occur on day j
-for(i in 1:L){
-s=0
-for(j in 1:i){
-s=s+delay_fun(i-j)*lambda0[j]
-}
-Ein[i]=s
-}
-w=which(Ein>0)
-KHI  = 1/N0*sum((Ein[w]-Din[w])^2/Ein[w])
-}
-# lambda1[1]=0
-lambda1[L]=0
-}
-lambda1=lambda1[-seq(1,N1)]
-return(lambda1)
-}
-# Compute the number of infection for different age class and region ----
-number_infected <- function(dataframe,   age.cat,region, ph){
 if(!is.null(age.cat) & !is.null(region)  ){
 nb_filtered=  dataframe[which(dataframe$region == region & dataframe$age == age.cat ),]
 }
@@ -510,3 +480,33 @@ ylab('Proportion infected (%)')+xlab('')  +  scale_x_date(date_breaks  = "2 mont
 print(p)
 I1=rbind(I1,Infected.France)
 }
+##################################################################
+##                                                              ##
+##                                                              ##
+##    Monitoring the proportion of the population               ##
+##    infected by SARS-CoV-2 using age-stratified               ##
+##  hospitalisation and serological data: a modelling study     ##
+##                                                              ##
+##                                                              ##
+## Author: Nathanael Hoze                                       ##
+## Email: nathanael.hoze@pasteur.fr                             ##
+## Last update: 20/04/2021                                      ##
+##                                                              ##
+##                                                              ##
+##################################################################
+# load libraries
+library(lubridate)
+library(ggplot2)
+library(dplyr)
+library(gridExtra)
+library(RColorBrewer)
+library(reshape)
+library(pdftools)
+library(ggpubr)
+############################################################
+##                  Load Data and functions               ##
+############################################################
+source("load.R")
+getwd()
+source('C:/Users/natha/monitoring-infection/load.R')
+source('C:/Users/natha/monitoring-infection/main.R')
diff --git a/FrenchMap.R b/FrenchMap.R
index c3304f445fd799457d127722c38677df57189f29..546cdb22e1a2c296874c3031a5e703c1cd597354 100644
--- a/FrenchMap.R
+++ b/FrenchMap.R
@@ -1,16 +1,6 @@
 # French map, proportion infected by region
 
-########################################################
-# How to make maps with ggplot2 
-# Author : Juliette Paireau
-# Creation date : 15/12/2017
-########################################################
-
-library(maptools)
-library(ggplot2)
-library(rgeos)
-library(dplyr)
-library(scales)
+ 
 
 workdir <- "Samples"
 setwd(workdir)
diff --git a/load.R b/load.R
index cb4d194307214f7fcf3f6feb3d45f566fc790290..ffd54fb111c4b3d5be544922c27164eef1d05668 100644
--- a/load.R
+++ b/load.R
@@ -1,3 +1,5 @@
+# load a simulated dataset of hospitalisation in different regions of France
+# between March 1st 2020 to April 15th 2021
 
 daily.numbers.hosp  = read.csv(file = 'data/Simulated_SIVIC_dataset.csv', sep = ';')
 daily.numbers.hosp$date = as.Date(daily.numbers.hosp$date)
@@ -5,6 +7,7 @@ selected_dates = unique(daily.numbers.hosp$date)
 all.age.classes = unique(daily.numbers.hosp$age)
 Region.France.Metropolitaine = unique(daily.numbers.hosp$region)
 
+# load 1000 values of the infection hospitalisation ratio for the different age classes
 PH  =read.csv('data/IHR.csv', sep=';', header=FALSE, row.names =all.age.classes )
 
 
diff --git a/main.R b/main.R
index bf6ca2384a31fe606634e0ee65aca3b348a70c69..6ec3f5e4c83541e35845395bcf36ad164f014f30 100644
--- a/main.R
+++ b/main.R
@@ -21,7 +21,9 @@ library(RColorBrewer)
 library(reshape)
 library(pdftools)
 library(ggpubr)
-
+library(maptools)
+library(rgeos)
+library(scales)
 ############################################################
 ##                  Load Data and functions               ##
 ############################################################
@@ -36,4 +38,3 @@ source('Proportion Infected.R')
 
 # plot a map of France with the proportion infected in each region
 source('FrenchMap.R')
- 
\ No newline at end of file