11# nolint start
22
3- # Practical 4
4- # Activity 1
3+ # Activité pratique 4
4+ # Activité 1
55
6- # step: fill in your room number
7- room_number <- # <COMPLETE> replace with 1/2/3/4
8-
9- # Load packages ------ ----------------------------------------------------
6+ # étape: compléter le numéro du groupe
7+ room_number <- # <À COMPLÉTER> remplacer avec 1/2/3/4
8+
9+ # charger les packages ----------------------------------------------------
1010library(epidemics )
1111library(socialmixr )
1212library(tidyverse )
1313
1414
15- # (1) Contact matrix ------------------------------------------------------
15+ # (1) matrice des contacts ------------------------------------------------------
1616
17- # note: all input parameters come from
18- # the table of parameters of the practical document
17+ # remarque: tous les paramètres sont issus du tableau des paramètres
18+ # qui se trouve dans le fichier avec les activités pratiques
1919
20- # step: paste the survey link assigned to your room
21- # then run the function to download the social contact data
20+ # étape: coller le lien correspondant à l'enquête assignée à votre groupe
21+ # puis exécuter la fonction pour télécharger les données de contacts sociaux
2222socialsurvey <- socialmixr :: get_survey(
23- # <COMPLETE >
23+ # <À COMPLÉTER >
2424)
2525
2626socialsurvey
2727
28- # step: generate the contact matrix by defining
29- # - the survey class object just downloaded ,
30- # - the country name ,
31- # - the age limits, as in the table of parameters, and
32- # - TRUE or FALSE to create a symmetric matrix .
28+ # étape: créer la matrice de contacts en définissant:
29+ # - l'objet de classe < survey> que vous venez de créer ,
30+ # - le nom du pays ,
31+ # - les limites d'âge, comme mentionnés dans le tableau des paramètres, et
32+ # - TRUE ou FALSE pour créer une matrice symétrique .
3333contact_data <- socialmixr :: contact_matrix(
34- # <COMPLETE >
34+ # <À COMPLÉTER >
3535)
3636
3737contact_data
3838
39- # run: confirm the symmetry of the matrix
40- # Matrix are symmetric for the total number of contacts.
41- # The total number of contacts from one group to another is the same in both directions.
42- # Check this by multiplying the mean contacts by the population size for each group.
39+ # exécuter la commande suivante pour confirmer la symmétrie de la matrice
40+ # La matrice du nombre total de contact est une matrice symétrique.
41+ # Le nombre total de contacts des individus d'un groupe à un autre est le même
42+ # dans toutes les directions.
43+ # Vérifier la symmétrie en multipliant le nombre moyen de contacts la taille de
44+ # la population de chaque groupe.
4345contact_data $ matrix * contact_data $ demography $ proportion
4446
45- # run: Prepare contact matrix
47+ # Exécuter la commande ci-dessous pour préparer la matrice de contacts
4648#
47- # - {socialmixr} provides a matrix from-to: from -participants -> to -contacts
48- # In surveys, participants report their contacts.
49+ # - {socialmixr} fournit une matrice du type de-à: de -participants -> à -contacts
50+ # les participants à une enquête révèle leurs contacts.
4951#
50- # - {epidemics} expects a matrix to-from: to-contacts <- from-participants
51- # Models assume that each susceptible (contact) is exposed to infection based on
52- # how often they are contacted (by participants) and how infectious (participatns) are.
52+ # - {epidemics} prend en entrée une matrice du type à-de: à-contacts <- de-participants
53+ # Les modèles supposent que chaque personne susceptible (contact) est exposée
54+ # à l'infection en fonction de la fréquence à laquelle elle est contactée
55+ # (par les participants) et du degré d'infectiosité (des participants).
5356#
5457socialcontact_matrix <- t(contact_data $ matrix )
5558
5659socialcontact_matrix
5760
58- # (2) Initial conditions --------------------------------------------------
59-
60- # # Infectious population ---------
61+ # (2) Les conditions initiales --------------------------------------------------
6162
62- # step: add the proportion of infectious
63- # as given in table of parameter
64- initial_i <- # <COMPLETE>
63+ # # Population indectieuse ---------
6564
66- # run: create an infectious vector
65+ # étape: compléter la proportion d'individus infectieux
66+ # selon le tableau des paramètres
67+ initial_i <- # <À COMPLÉTER>
68+
69+ # Exécuter la commande ci-dessous pour créer le vecteur de conditions initiales
6770initial_conditions_inf <- c(
6871 S = 1 - initial_i ,
6972 E = 0 ,
@@ -74,9 +77,10 @@ initial_conditions_inf <- c(
7477
7578initial_conditions_inf
7679
77- # # Free of infection population ---------
80+ # # Une population exempt d'infections ---------
7881
79- # run: create an infection-free vector
82+ # Exécuter la commande ci-dessous pour créer le vecteur de conditions initiales
83+ # dans une population exempt d'infections
8084initial_conditions_free <- c(
8185 S = 1 ,
8286 E = 0 ,
@@ -87,70 +91,71 @@ initial_conditions_free <- c(
8791
8892initial_conditions_free
8993
90- # # Combine initial conditions ------------
94+ # # Combiner les conditions initiales ------------
9195
92- # note: not all the population needs to be infectious.
93- # The epidemic can start with infecitous in a specific age range.
96+ # Remarque: toute la population n’a pas besoin d’être contagieuse.
97+ # L’épidémie peut débuter par une infection au sein d’une tranche d’âge
98+ # spécifique.
9499
95- # step: Combine the initial conditions
96- # Add initial_conditions_inf or initial_conditions_free
97- # to the each age group as detailed in table of parameter
100+ # étape: Combiner les conditions initiales
101+ # Associer ' initial_conditions_inf' or ' initial_conditions_free' à chaque
102+ # groupe selon le tableau des paramètres
98103initial_conditions <- base :: rbind(
99- # <COMPLETE >, # age group 1
100- # <COMPLETE >, # age group 2
101- # <COMPLETE > # age group 3
104+ # <À COMPLÉTER >, # groupe d'âge 1
105+ # <À COMPLÉTER >, # groupe d'âge 2
106+ # <À COMPLÉTER > # groupe d'âge 3
102107)
103108
104- # run: Use contact matrix to assign age group names
109+ # Exécuter la commande ci-dessous pour renommer les groupes d'âge en utilisant
110+ # les noms de lignes de la matrice de contact
105111rownames(initial_conditions ) <- rownames(socialcontact_matrix )
106112
107113initial_conditions
108114
109- # (3) Population structure ------------------------------------------------
115+ # (3) La structure de la population ------------------------------------------------
110116
111- # run: Prepare the demography vector
117+ # Exécuter la commande ci-dessous pour préparer le vecteur de demographie
112118demography_vector <- contact_data $ demography $ population
113119names(demography_vector ) <- rownames(socialcontact_matrix )
114120
115- # step: Prepare the population to model as affected by the epidemic adding
116- # - the name of the country ,
117- # - the symmetric and transposed contact matrix ,
118- # - the vector with the population size of each age group
119- # - the binded matrix with initial conditions for each age group
121+ # étape: Préparer la population à modéliser en spécifiant:
122+ # - le nom du pays ,
123+ # - la matrice de contact symmétrique et transposée ,
124+ # - le vecteur avec la taille de la population de chaque groupe d'âge
125+ # - la matrice des conditions initiales pour chaque groupe d'âge
120126population_object <- epidemics :: population(
121- # <COMPLETE >
127+ # <À COMPLÉTER >
122128)
123129
124130population_object
125131
126- # (4) Model parameters ----------------------------------------------------
127-
128- # step: define the disease-specific parameters: the rates
129- # add the values as given in table of parameter
130- infectiousness_rate <- 1 / # <COMPLETE > # 1/pre-infectious period
131- recovery_rate <- 1 / # <COMPLETE > # 1/infectious period
132- transmission_rate <- recovery_rate * # <COMPLETE > # recovery rate * R0
133-
134-
135- # (5) Run the model --------------------------------------------------------
136-
137- # step: in each function argument add
138- # - the population object
139- # - each of the previously defined disease-specific rates
140- # - the total simulation time as given in table of parameter
132+ # (4) Les paramètres du modèle ----------------------------------------------------
133+
134+ # étape: définir les paramètres spécifiques à la maladie: les taux
135+ # compléter les valeurs correspondantes selon le tableau des paramètres
136+ infectiousness_rate <- 1 / # <À COMPLÉTER > # 1/pre-infectious period
137+ recovery_rate <- 1 / # <À COMPLÉTER > # 1/infectious period
138+ transmission_rate <- recovery_rate * # <À COMPLÉTER > # recovery rate * R0
139+
140+
141+ # (5) Exécuter le modèle --------------------------------------------------------
142+
143+ # étape: donner les valeurs des arguments de la fonction
144+ # - l'objet de classe <population>
145+ # - chacun des taux spécifiques à la maladie définis précédemment
146+ # - le temps de simulation fournit dans le tableau des paramètres
141147simulate_baseline <- epidemics :: model_default(
142- # <COMPLETE >
148+ # <À COMPLÉTER >
143149)
144150
145151simulate_baseline
146152
147153
148- # (6) Plot all compartments ------------------------------------------------
154+ # (6) Tracer la courbe de tous les compartiments ------------------------------------------------
149155
150- # run: paste plot in report
156+ # Exécuter la commande ci-dessous et coller la courbe dans votre rapport
151157
152- # plot with total number of individual per compartment
153- # at different points in time
158+ # courbe du nombre total d'individus par compartiment au cours du temps
154159simulate_baseline %> %
155160 ggplot(aes(
156161 x = time ,
@@ -164,23 +169,22 @@ simulate_baseline %>%
164169 labels = scales :: comma
165170 )
166171
167- # (7) Peak of infectious -------------------------------------------------
172+ # (7) Pic d'infectiosité -------------------------------------------------
168173
169- # run: paste table output in report
174+ # Exécuter la commande ci-dessous et coller le tableau obtenu dans le rapport
170175
171- # table of epidemic peak size and time
172- # per demographic group
176+ # Tableau de l'ampleur et de la durée du pic épidémique par groupe démographique
173177epidemics :: epidemic_peak(data = simulate_baseline )
174178
175179
176- # (8) Plot new infections -------------------------------------------------
180+ # (8) Tracer la courbe des nouvelles infections -------------------------------------------------
177181
178- # run: paste plot output in report
182+ # Exécuter la commande ci-dessous et coller le résultat obtenu dans le rapport
179183
180- # New infections per demographic group in time
184+ # Nouvelles infections par groupe démographique dans le temps
181185newinfections_bygroup <- epidemics :: new_infections(data = simulate_baseline )
182186
183- # Visualize the spread of the epidemic in terms of new infections
187+ # Visualisez la propagation de l'épidémie en termes de nouvelles infections
184188newinfections_bygroup %> %
185189 ggplot(aes(time , new_infections , colour = demography_group )) +
186190 geom_line() +
@@ -189,4 +193,4 @@ newinfections_bygroup %>%
189193 labels = scales :: comma
190194 )
191195
192- # nolint end
196+ # nolint end
0 commit comments