An Evaluation of a Dynamic Web-Based Visualization of Community Immunity
Phase: NA
Conditions: Vaccine-Preventable Diseases
Sponsor: Laval University

S1: Study protocol

S2: Study questionnaire

1  # Project: herdimm
2  # Description: code for analysing the results of Hina Hakim's final PhD study
3 
4  # Script developed by: Hina Hakim Jul 2019 - Dec 2020 with the collaboration of 
Anne-Sophie Julien 
5  # (statistician) and Holly Witteman (PhD advisor). Reviewed externally by a statistician 
6  # unaffiliated with the project in October 2020; report received 2020-10-30.
7 
8  # Last run: 2021-09-20 with real data from 2021-07-05
9 
10  #### RESEARCH QUESTIONS ####
11 
12  # This project uses the herdimm intervention to convey the concept of community 
immunity or herd
13  # immunity. The herdimm intervention is described in detail here: DOI: 10.2196/20113
14 
15  # Research question 1 (primary): Across 4 vaccine-preventable diseases, does the herdimm 
16  # intervention influence risk perception compared to a control?
17 
18  # Research question 2 (secondary): Across 4 vaccine-preventable diseases, does the 
herdimm 
19  # intervention influence other outcomes (5C scale, emotions, trust, knowledge, 
behavioural 
20  # intentions) compared to a control?
21 
22  # Research question 3 (secondary): For any of the 4 diseases, do existing interventions 
already 
23  # available online outperform the herdimm intervention?
24 
25  # Research question 4 (add-on, may be reported separately from Hina Hakim's thesis): 
Are the effects
26  # of the herdimm intervention different when the narration uses a female or male voice?
27 
28 
29  #### LOAD LIBRARIES ####
30 
31  # Libraries are required to run different packages for running the code below.
32  library(psych) # describeBy
33  library(emmeans) # emmeans
34  library(moments) # kurtosis, skewness
35  library(car) # Anova
36  library(MASS) # Box-Cox
37  library(olsrr) # testing collinearity
38  library(readr) # read files
39  library(tidyverse)
40  library(dplyr)
41  library(ggplot2) # for plots
42  library(BlandAltmanLeh) # for Bland Altman test
43  library(ltm) # to determine Cronbach alpha
44  library(mice) # for multiple imputations
45  library(naniar)
46  library(R2HTML) #CHANGELOG ASJ: to output results 2021-08-06.
47  library(mitml) #CHANGELOG ASJ: add global test after multiple imputation 21-09-20.
48 
49  sessionInfo() # for citing packages in paper
50 
51  #### IMPORT DATA ####
52 
53  # Import CSV file of raw data, removing Qualtrics artifacts in rows 1-2 (unneeded 
variable headers) 
54  # and columns 1-16 (unneeded data automatically collected by default by Qualtrics.)
55 
56  datRaw = (
57 
read.csv(
58 
"./contag_phase3b_July 5, 2021_08.19.csv",
59 
header = T,
60 
sep = ","
61 
)[-c(1, 2)]
62  ) #CHANGELOG Changed to new file name 2021-07-05
S3: Study statistal analysis plan

63   # View(datRaw)
64   
65   # Subset the data we need: people who started (Consent==1) and finished (Finished==1) 
the study.
66   #CHANGELOG ASJ: Replace subset by gc = 1 equivalent to Consent + Finished + Quality, 
21-08-06
67   dat<-subset(datRaw,gc==1)
68   # View(dat)
69   
70   #CHANGELOG ASJ: save and print results 2021-09-03.
71   HTMLStart(outdir=".\\",
72   
file = "Herdimm Descriptive210903",extension = "html",echo=TRUE, HTMLframe =
TRUE)
73   
74   
75   #### CLEAN DATA ####
76   
77   #### + Risk Perception ####
78   
79   # First change the columns (variables) from character to numeric form so that we can 
work with them.
80   
81   dat$riskpercep1_1 <- as.numeric(as.character(dat$riskpercep1_1))
82   dat$riskpercep2 <- as.numeric(as.character(dat$riskpercep2))
83   dat$riskpercep3 <- as.numeric(as.character(dat$riskpercep3))
84   dat$riskpercep4 <- as.numeric(as.character(dat$riskpercep4))
85   dat$riskpercep5 <- as.numeric(as.character(dat$riskpercep5))
86   dat$riskpercep6 <- as.numeric(as.character(dat$riskpercep6))
87   
88   # Then recode reverse-coded items riskpercep2, riskpercep4, riskpercep5.
89   
90   dat$riskpercep2rev <- 8-dat$riskpercep2
91   dat$riskpercep4rev <- 8-dat$riskpercep4
92   dat$riskpercep5rev <- 8-dat$riskpercep5
93   
94   # To check if risk percep_1 measures the same construct as riskpercep_2-6, we rescale 
riskpercep_1 
95   # so that it is measured on the same scale as the other items.
96   
97   dat$score_riskpercep1_1 <- dat$riskpercep1_1*6/100+1
98   summary(dat$score_riskpercep1_1)
99   
100   # To calculate the mean of the six other risk perception items (that is: riskpercep_2, 
riskpercep_3,
101   # riskpercep_4, riskpercep_5, riskpercep_6), first, we create a subset of the items we 
need.
102   
103   dat_riskpercep2_6 <-
104   
subset(
105   
dat,
106   
select = c(
107   
riskpercep2rev,
108   
riskpercep3,
109   
riskpercep4rev,
110   
riskpercep5rev,
111   
riskpercep6
112   
)
113   
)
114   
115   # Sum all items (riskpercept_2 to riskpercep_6) for each participant.
116   
117   risk_sumrows <-rowSums(dat_riskpercep2_6,na.rm=T)
118   
119   # Count the number of missing items (no response in items riskpercept_2 to 
riskpercep_6) for each 
120   # participant.
121   
122   risk_summissing <-
123   
is.na(dat_riskpercep2_6$riskpercep2rev) +

124   
is.na(dat_riskpercep2_6$riskpercep3) +
125   
is.na(dat_riskpercep2_6$riskpercep4rev) +
126   
is.na(dat_riskpercep2_6$riskpercep5rev) +
127   
is.na(dat_riskpercep2_6$riskpercep6)
128   
129   table(risk_summissing)
130   prop.table(table(risk_summissing))*100
131   
132   # Calculate the mean value (mean risk perception) from riskpercept_2 to riskpercep_6 of 
all answered
133   # items.
134   
135   dat$mean_riskperception2_6<-risk_sumrows/(5-risk_summissing)
136   summary(dat$mean_riskperception2_6)
137   
138   # To see if the item risk percep_1 and risk percept_2 to 6 are all measuring the same 
thing, we need
139   # a Bland Altman plot. To create a Bland Altman plot, we need the difference between _1 
and the mean
140   # of _2 to _6. So, for that purpose, we will create 2 new variables then create the plot.
141   
142   dat$diff_riskp1_6 <-dat$score_riskpercep1_1-dat$mean_riskperception2_6
143   summary(dat$diff_riskp1_6)
144   
145   dat$mean_riskp1_6<- (dat$score_riskpercep1_1+dat$mean_riskperception2_6)/2
146   summary(dat$mean_riskp1_6)
147   
148   plot(dat$score_riskpercep1_1,dat$mean_riskperception2_6)
149   
150   # We are using two = 1.96 (two standard deviations) rather than two = 2.0. If there are 
data points
151   # outside these limits, this raises concerns that these two measures may not, in fact, 
measure the
152   # same construct.
153   
154   bland.altman.plot(
155   
dat$mean_riskperception2_6,
156   
dat$score_riskpercep1_1,
157   
two = 1.96,
158   
mode = 1,
159   
graph.sys = "base",
160   
conf.int = 0,
161   
silent = TRUE,
162   
sunflower = FALSE,
163   
geom_count = FALSE
164   )
165   
166   # Then we formally test the hypothesis. If this test is statistically significant, it 
means the
167   # difference between the two new variables is not zero, which implies a lack of 
similarity between
168   # the two original measurement methods (i.e., riskpercep_1 and riskpercep_2 to _6.)
169   
170   summary(lm(dat$mean_riskp1_6 ~ dat$diff_riskp1_6))
171   
172   # If riskpercep_1 and riskpercep_2 to _6 are similar, we will combine them into a 
single measure if
173   # their combined Cronbach alpha is >=0.8 and will consider doing so if their combined 
Cronbach alpha
174   # can be raised to >=0.8 by removing inconsistent items. We will explore removing items 
because this
175   # measure is an ad hoc measure created specifically for this study.
176   
177   # Create a subset for riskpercep_2 to_6 to determine Cronbach alpha more easily
178   
179   dat_riskpercep2_6_alpha <-
180   
subset(
181   
dat, 
182   
select = c(

183   
riskpercep2rev,
184   
riskpercep3,
185   
riskpercep4rev,
186   
riskpercep5rev,
187   
riskpercep6
188   
)
189   
)
190   
191   # Cronbach alpha value for riskpercep_2-6
192   
193   cronbach.alpha(
194   
dat_riskpercep2_6_alpha,
195   
standardized = FALSE,
196   
CI = FALSE,
197   
probs = c(0.025, 0.975),
198   
B = 1000,
199   
na.rm = TRUE
200   ) # CHANGELOG Change na.rm = FALSE to TRUE 2021-07-14
201   
202   # Create  a subset for riskpercep_1 to_6 to determine Cronbach alpha more easily
203   
204   dat_riskpercep1_6_alpha <-
205   
subset(
206   
dat,
207   
select = c(
208   
score_riskpercep1_1,
209   
riskpercep2rev,
210   
riskpercep3,
211   
riskpercep4rev,
212   
riskpercep5rev,
213   
riskpercep6
214   
)
215   
)
216   
217   # Cronbach alpha value for riskpercep_1-6
218   
219   cronbach.alpha(
220   
dat_riskpercep1_6_alpha,
221   
standardized = FALSE,
222   
CI = FALSE,
223   
probs = c(0.025, 0.975),
224   
B = 1000,
225   
na.rm = TRUE
226   ) # CHANGELOG Change na.rm = FALSE to TRUE 2021-07-14
227   
228   # 1. If we can combine the measures (based on Bland Altman & Cronbach alpha) then we 
create a single
229   # measure using the same series of steps as above (subset, sum of all items, number of 
missing
230   # items, calculate mean). This is our preferred approach, so we are prioritizing this 
option in the
231   # pre-registered code.
232   
233   # subset
234   dat_riskpercep <-
235   
subset(
236   
dat,
237   
select = c(
238   
score_riskpercep1_1,
239   
riskpercep2rev,
240   
riskpercep3,
241   
riskpercep4rev,
242   
riskpercep5rev,
243   
riskpercep6
244   
)
245   
)
246   
247   # sum of all items for each person
248   risk_sumrows <-rowSums(dat_riskpercep,na.rm=T)

249   
250   # count of missing values
251   risk_summissing <-
252   
is.na(dat_riskpercep$score_riskpercep1_1) +
253   
is.na(dat_riskpercep$riskpercep2rev) +
254   
is.na(dat_riskpercep$riskpercep3) +
255   
is.na(dat_riskpercep$riskpercep4rev) +
256   
is.na(dat_riskpercep$riskpercep5rev) +
257   
is.na(dat_riskpercep$riskpercep6)
258   
259   # mean
260   dat$mean_riskperception<-risk_sumrows/(6-risk_summissing)
261   
262   # 2. If we cannot combine the measures, we will run the rest of the script once with 
risk perception
263   # being the first item only, and then re-run the rest of the script with risk 
perception being items
264   # 2 to 6. In that case, we will add a comment for which condition we are running the 
ANOVA each 
265   # time. For now, we have commented these out, as we hope not to have to use them.
266   
267   # dat$mean_riskperception<-(dat$score_riskpercep1_1) 
268   
269   dat$mean_riskperception<-(dat$mean_riskperception2_6)
270   
271   # CHANGELOG: As mentioned above that if risk perception item 1 and 2 to 6 are measuring 
differently, we will use in our analysis ANOVA model separately
272   # CHANGELOG ASJ: Since riskperception 1 is asymetric, no ANOVA will be run on it, so 
the mean can be directly equal to 2-6, 2021-08-03
273   
274   #### + Betsch et al 5C measure ####
275   
276   # Variables are coming in as data type character. Force them to be numeric so we can 
work with them.
277   
278   cols.num <- c(
279   
"confidence1",
280   
"confidence2",
281   
"confidence3",
282   
"complacency1",
283   
"complacency2",
284   
"complacency3",
285   
"constraints1",
286   
"constraints2",
287   
"constraints3",
288   
"calculation1",
289   
"calculation2",
290   
"calculation3",
291   
"collectiverespon1",
292   
"collectiverespon2",
293   
"collectiverespon3"
294   )
295   
296   dat[cols.num] <- sapply(dat[cols.num],as.numeric)
297   
298   # Recode reverse-coded item collectiverespon1
299   
300   dat$collectiverespon1rev <- 8-dat$collectiverespon1
301   
302   # Calculate mean (subset, sum of all items, number of missing items, calculate mean).
303   
304   dat_5c <-
305   
subset(
306   
dat,
307   
select = c(
308   
confidence1,
309   
confidence2,
310   
confidence3,
311   
complacency1,

312   
complacency2,
313   
complacency3,
314   
constraints1,
315   
constraints2,
316   
constraints3,
317   
calculation1,
318   
calculation2,
319   
calculation3,
320   
collectiverespon1rev,
321   
collectiverespon2,
322   
collectiverespon3
323   
)
324   
)
325   
326   C5_sumrows <- rowSums(dat_5c, na.rm = T)
327   
328   C5_summissing <-
329   
is.na(dat_5c$confidence1) +
330   
is.na(dat_5c$confidence2) +
331   
is.na(dat_5c$confidence3) +
332   
is.na(dat_5c$complacency1) +
333   
is.na(dat_5c$complacency2) +
334   
is.na(dat_5c$complacency3) +
335   
is.na(dat_5c$constraints1) +
336   
is.na(dat_5c$constraints2) +
337   
is.na(dat_5c$constraints3) +
338   
is.na(dat_5c$calculation1) +
339   
is.na(dat_5c$calculation2) +
340   
is.na(dat_5c$calculation3) +
341   
is.na(dat_5c$collectiverespon1rev) +
342   
is.na(dat_5c$collectiverespon2) +
343   
is.na(dat_5c$collectiverespon3)
344   
345   dat$mean_C5 <- C5_sumrows / (15 - C5_summissing)
346   
347   # Determine Cronbach alpha of overall 5C scale.
348   #CHANGELOG ASJ: Overall consistency is low, while it's high for subscales. Analysis of 
subscales instead of total score, 2021-08-06
349   cronbach.alpha(dat_5c, standardized = FALSE, CI = FALSE, 
350   
probs = c(0.025, 0.975), B = 1000, na.rm = TRUE)# CHANGELOG Change na.rm 
= FALSE to TRUE 2021-07-14
351   
352   
353   # Create subsets for each subscale .
354   
355   dat_5c_confidence <-subset(dat,select=c(confidence1,confidence2,confidence3))
356   dat_5c_complacency<-subset(dat,select=c(complacency1,complacency2,complacency3))
357   dat_5c_constraints<-subset(dat,select=c(constraints1,constraints2,constraints3))
358   dat_5c_calculation<-subset(dat,select=c(calculation1,calculation2,calculation3))
359   dat_5c_collectiverespon<-subset(dat,select=c(collectiverespon1rev,collectiverespon2,colle
ctiverespon3))
360   
361   # Determine Cronbach alpha values for each of 5C subscales.
362   
363   # Confidence
364   cronbach.alpha(
365   
dat_5c_confidence,
366   
standardized = FALSE,
367   
CI = FALSE,
368   
probs = c(0.025, 0.975),
369   
B = 1000,
370   
na.rm = TRUE
371   ) # CHANGELOG Change na.rm = FALSE to TRUE 2021-07-14
372   
373   # Complacency
374   cronbach.alpha(
375   
dat_5c_complacency,
376   
standardized = FALSE,
377   
CI = FALSE,

378   
probs = c(0.025, 0.975),
379   
B = 1000,
380   
na.rm = TRUE
381   ) # CHANGELOG Change na.rm = FALSE to TRUE 2021-07-14
382   
383   # Constraints
384   cronbach.alpha(
385   
dat_5c_constraints,
386   
standardized = FALSE,
387   
CI = FALSE,
388   
probs = c(0.025, 0.975),
389   
B = 1000,
390   
na.rm = TRUE
391   ) # CHANGELOG Change na.rm = FALSE to TRUE 2021-07-14
392   
393   # Calculation
394   cronbach.alpha(
395   
dat_5c_calculation,
396   
standardized = FALSE,
397   
CI = FALSE,
398   
probs = c(0.025, 0.975),
399   
B = 1000,
400   
na.rm = TRUE
401   ) # CHANGELOG Change na.rm = FALSE to TRUE 2021-07-14
402   
403   # Collective responsibility
404   cronbach.alpha(
405   
dat_5c_collectiverespon,
406   
standardized = FALSE,
407   
CI = FALSE,
408   
probs = c(0.025, 0.975),
409   
B = 1000,
410   
na.rm = TRUE
411   ) # CHANGELOG Change na.rm = FALSE to TRUE 2021-07-14
412   
413   #CHANGELOG ASJ: Calculate mean for each subscale because of low overall consistency, 
2021-08-06.
414   C5conf_sumrows <- rowSums(dat_5c_confidence, na.rm = T)
415   C5comp_sumrows <- rowSums(dat_5c_complacency, na.rm = T)
416   C5cons_sumrows <- rowSums(dat_5c_constraints, na.rm = T)
417   C5calc_sumrows <- rowSums(dat_5c_calculation, na.rm = T)
418   C5coll_sumrows <- rowSums(dat_5c_collectiverespon, na.rm = T)
419   
420   
421   C5conf_summissing <-
is.na(dat_5c$confidence1) +
is.na(dat_5c$confidence2) +
is.na(dat_5c$confidence3)
422   C5comp_summissing <-
is.na(dat_5c$complacency1) +
is.na(dat_5c$complacency2) +
is.na(dat_5c$complacency3)
423   C5cons_summissing <-
is.na(dat_5c$constraints1) +
is.na(dat_5c$constraints2) +
is.na(dat_5c$constraints3)
424   C5calc_summissing <-
is.na(dat_5c$calculation1) +
is.na(dat_5c$calculation2) +
is.na(dat_5c$calculation3)
425   C5coll_summissing <-
is.na(dat_5c$collectiverespon1rev) +
is.na(dat_5c$collectiverespon2) +
is.na(dat_5c$collectiverespon3)
426   
427   dat$mean_C5_conf <- C5conf_sumrows / (3 - C5conf_summissing)
428   dat$mean_C5_comp <- C5comp_sumrows / (3 - C5comp_summissing)
429   dat$mean_C5_cons <- C5cons_sumrows / (3 - C5cons_summissing)
430   dat$mean_C5_calc <- C5calc_sumrows / (3 - C5calc_summissing)
431   dat$mean_C5_coll <- C5coll_sumrows / (3 - C5coll_summissing)
432   
433   #CHANGELOG ASJ: Dichotomize the five subscales because they are highly asymetric, 
21-09-03
434   hist(dat$mean_C5_conf)
435   hist(dat$mean_C5_comp)
436   hist(dat$mean_C5_cons)
437   hist(dat$mean_C5_calc)
438   hist(dat$mean_C5_coll)
439   

440   summary(dat$mean_C5_conf) #6
441   summary(dat$mean_C5_comp) #2.33
442   summary(dat$mean_C5_cons) #2
443   summary(dat$mean_C5_calc) #5.33
444   summary(dat$mean_C5_coll) #6.33
445   
446   dat$mean_C5_conf2<-ifelse(dat$mean_C5_conf>=6,1,0)
447   dat$mean_C5_comp2<-ifelse(dat$mean_C5_comp<=2.34,1,0)
448   dat$mean_C5_cons2<-ifelse(dat$mean_C5_cons<=2,1,0)
449   dat$mean_C5_calc2<-ifelse(dat$mean_C5_calc>=5.33,1,0)
450   dat$mean_C5_coll2<-ifelse(dat$mean_C5_coll>=6.33,1,0)
451   
452   table(dat$mean_C5_conf2,dat$mean_C5_conf)
453   table(dat$mean_C5_comp2,dat$mean_C5_comp)
454   table(dat$mean_C5_cons2,dat$mean_C5_cons)
455   table(dat$mean_C5_calc2,dat$mean_C5_calc)
456   table(dat$mean_C5_coll2,dat$mean_C5_coll)
457   
458   table(dat$mean_C5_conf2)
459   table(dat$mean_C5_comp2)
460   table(dat$mean_C5_cons2)
461   table(dat$mean_C5_calc2)
462   table(dat$mean_C5_coll2)
463   
464   
465   #### + Emotions ####
466   
467   # Variables are coming in as data type character. Force them to be numeric so we can 
work with them.
468   
469   cols.num <- c("emotion1", "emotion2", "emotion3", "emotion4", "emotion5")
470   dat[cols.num] <- sapply(dat[cols.num],as.numeric)
471   
472   # Calculate mean (subset, sum of all items, number of missing items, calculate mean).
473   
474   dat_emotion <-
475   
subset(dat, select = c(emotion1, emotion2, emotion3, emotion4, emotion5))
476   
477   emotion_sumrows <- rowSums(dat_emotion, na.rm = T)
478   
479   emotion_summissing <-
480   
is.na(dat_emotion$emotion1) +
481   
is.na(dat_emotion$emotion2) +
482   
is.na(dat_emotion$emotion3) +
483   
is.na(dat_emotion$emotion4) +
484   
is.na(dat_emotion$emotion5)
485   
486   dat$mean_emotion <- emotion_sumrows / (5 - emotion_summissing)
487   
488   # Calculate Cronbach alpha for emotions questions.
489   
490   cronbach.alpha(
491   
dat_emotion,
492   
standardized = FALSE,
493   
CI = FALSE,
494   
probs = c(0.025, 0.975),
495   
B = 1000,
496   
na.rm = TRUE
497   ) # CHANGELOG Change na.rm = FALSE to TRUE 2021-07-14
498   
499   #### + Knowledge ####
500   
501   # Variables are coming in as data type character. Force them to be numeric so we can 
work with them.
502   # The original knowledge scale included slightly repetitive items know06 and know09 
that were
503   # removed to shorten the overall survey.
504   
505   cols.num <-

506   
c(
507   
"know01",
508   
"know02_1",
509   
"know02_2",
510   
"know02_3",
511   
"know02_4",
512   
"know02_5",
513   
"know03",
514   
"know04",
515   
"know05",
516   
"know07",
517   
"know08",
518   
"know10",
519   
"know11",
520   
"know12",
521   
"know13",
522   
"know14",
523   
"know15",
524   
"know16",
525   
"know17"
526   
)
527   
528   dat[cols.num] <- lapply(dat[cols.num],as.numeric)
529   
530   # Calculate the knowledge score. If the participant selected the correct response, they 
get 1 point
531   # for that item. Otherwise they get 0 for that item. know01 and know02 are multiple 
choice.
532   # know03-17 are true/false. For know01, we required a single correct choice. For 
know02, we require
533   # all correct options selected. For know03-17, we require the correct choice (true or 
false.)
534   
535   dat$know01_score <- ifelse(dat$know01 == 4, 1, 0)
536   dat$know02_score <- ifelse(dat$know02_1 == 1 &
537   
dat$know02_2 == 1 &
538   
dat$know02_3 == 0 &
539   
dat$know02_4 == 1 &
540   
dat$know02_5 == 0,1,0)
541   dat$know03_score <- ifelse(dat$know03 == 1, 1, 0)
542   dat$know04_score <- ifelse(dat$know04 == 1, 1, 0)
543   dat$know05_score <- ifelse(dat$know05 == 1, 1, 0)
544   dat$know07_score <- ifelse(dat$know07 == 0, 1, 0)
545   dat$know08_score <- ifelse(dat$know08 == 1, 1, 0)
546   dat$know10_score <- ifelse(dat$know10 == 0, 1, 0)
547   dat$know11_score <- ifelse(dat$know11 == 1, 1, 0)
548   dat$know12_score <- ifelse(dat$know12 == 1, 1, 0)
549   dat$know13_score <- ifelse(dat$know13 == 0, 1, 0)
550   dat$know14_score <- ifelse(dat$know14 == 1, 1, 0)
551   dat$know15_score <- ifelse(dat$know15 == 0, 1, 0)
552   dat$know16_score <- ifelse(dat$know16 == 1, 1, 0)
553   dat$know17_score <- ifelse(dat$know17 == 0, 1, 0)
554   
555   # Subset the items so we can easily calculate total score.
556   
557   dat_know <-
558   
subset(
559   
dat,
560   
select = c(
561   
know01_score,
562   
know02_score,
563   
know03_score,
564   
know04_score,
565   
know05_score,
566   
know07_score,
567   
know08_score,
568   
know10_score,
569   
know11_score,
570   
know12_score,

571   
know13_score,
572   
know14_score,
573   
know15_score,
574   
know16_score,
575   
know17_score
576   
)
577   
)
578   
579   # Calculate sum of correct answers out of 15 total.
580   
581   dat$sum_knowledge <- rowSums(dat_know,na.rm=T)
582   
583   # If we want to know the number of NA's in the data we can run the line below. This 
would allow us
584   # to distinguish between people who selected the wrong answer and people who indicated 
they didn't
585   # know. We will do this if knowledge scores are very low across all conditions (e.g., 
mean scores
586   # less than about 5.) It is commented out for the preregistered code because we hope 
not to need it.
587   
588   #CHANGELOG ASJ: the mean of sum_knowledge is 8.9, so no need for it, 2021-08-03
589   # dat$sum_knowledge <-rowSums(dat_know,na.rm=F)
590   
591   #### + Trust ####
592   
593   # Variable is coming in as data type character. Force it to be numeric so we can work 
with it.
594   
595   dat$trustinfo <- as.numeric(dat$trustinfo)
596   
597   #### + Behavourial Intentions ####
598   
599   # Variables are coming in as data type character. Force them to be numeric so we can 
work with them.
600   
601   cols.num <-
602   
c(
603   
"immune",
604   
"vaxintention_1",
605   
"c19vax",
606   
"c19vaxintention_1"
607   
)
608   
609   dat[cols.num] <- sapply(dat[cols.num], as.numeric)
610   
611   #### + Individualism and Collectivism Scale ####
612   
613   # Variables are coming in as data type character. Force them to be numeric so we can 
work with them.
614   
615   cols.num <-
616   
c(
617   
"ih1",
618   
"ih2",
619   
"ih3",
620   
"ih4",
621   
"iv1",
622   
"iv2",
623   
"iv3",
624   
"iv4",
625   
"ch1",
626   
"ch2",
627   
"ch3",
628   
"ch4",
629   
"cv1",
630   
"cv2",
631   
"cv3",
632   
"cv4"

633   
)
634   
635   dat[cols.num] <- sapply(dat[cols.num],as.numeric)
636   
637   # This scale may have up to 4 dimensions, so we need to check for collinearity. To do 
this, we
638   # calculate mean scores for each participant for each of the 4 subscales, using the 
same method as
639   # above (subset, sum, count missing, calculate mean scores.) Then we enter these in a 
linear model
640   # on our primary outcome and check VIF for indications of multicollinearity. If all the 
VIF are
641   # below 10, it means there is no multicollinearity. If some of the VIF values are more 
than 10, it
642   # means that variables are correlated. If there is collinearity then we can not use the 4
643   # dimensions in the model. In that case, we can use either 2 dimensions or just one or 
3 dimensions.
644   # If there is no collinearity then we can use the 4 dimensions.
645   
646   dat_indivhorz <-subset(dat,select=c(ih1,ih2,ih3,ih4))
647   dat_indivvertical <-subset(dat,select=c(iv1,iv2,iv3,iv4))
648   dat_collhorz <-subset(dat,select=c(ch1,ch2,ch3,ch4))
649   dat_collvertical <-subset(dat,select=c(cv1,cv2,cv3,cv4))
650   dat_indiv_coll <-
subset(dat,select=c(ih1,ih2,ih3,ih4,iv1,iv2,iv3,iv4,ch1,ch2,ch3,ch4,cv1,cv2,cv3,cv4))
651   
652   # Cronbach alpha for subscales (each dimension) of the scale.
653   # CHANGELOG Change below na.rm = FALSE to TRUE 2021-07-14
654   
655   cronbach.alpha(dat_indivhorz, standardized = FALSE, CI = FALSE, 
656   
probs = c(0.025, 0.975), B = 1000, na.rm = TRUE)
657   cronbach.alpha(dat_indivvertical, standardized = FALSE, CI = FALSE, 
658   
probs = c(0.025, 0.975), B = 1000, na.rm = TRUE)
659   cronbach.alpha(dat_collhorz, standardized = FALSE, CI = FALSE, 
660   
probs = c(0.025, 0.975), B = 1000, na.rm = TRUE)
661   cronbach.alpha(dat_collvertical, standardized = FALSE, CI = FALSE, 
662   
probs = c(0.025, 0.975), B = 1000, na.rm = TRUE)
663   cronbach.alpha(dat_indiv_coll, standardized = FALSE, CI = FALSE, 
664   
probs = c(0.025, 0.975), B = 1000, na.rm = TRUE)
665   
666   # Sum all items
667   
668   indivhorz_sumrows <- rowSums(dat_indivhorz,na.rm=T)
669   indivvertical_sumrows <- rowSums(dat_indivvertical,na.rm=T)
670   collhorz_sumrows <- rowSums(dat_collhorz,na.rm=T)
671   collvertical_sumrows <- rowSums(dat_collvertical,na.rm=T)
672   
673   # Count missing items
674   
675   indivhorz_summissing <-
676   
is.na(dat_indivhorz$ih1) + is.na(dat_indivhorz$ih2) + is.na(dat_indivhorz$ih3) +
677   
is.na(dat_indivhorz$ih4)
678   
679   indivvertical_summissing <-
680   
is.na(dat_indivvertical$iv1) + is.na(dat_indivvertical$iv2) +
is.na(dat_indivvertical$iv3) +
681   
is.na(dat_indivvertical$iv4)
682   
683   collhorz_summissing <-
684   
is.na(dat_collhorz$ch1) + is.na(dat_collhorz$ch2) + is.na(dat_collhorz$ch3) +
685   
is.na(dat_collhorz$ch4)
686   
687   collvertical_summissing <-
688   
is.na(dat_collvertical$cv1) + is.na(dat_collvertical$cv2) +
is.na(dat_collvertical$cv3) +
689   
is.na(dat_collvertical$cv4)
690   
691   # Calculate mean scores
692   

693   dat$mean_indivhorz <- indivhorz_sumrows/(4- indivhorz_summissing)
694   dat$mean_indivvertical <- indivvertical_sumrows/(4 -indivvertical_summissing)
695   dat$mean_collhorz <- collhorz_sumrows/(4 - collhorz_summissing)
696   dat$mean_collvertical <- collvertical_sumrows/(4 - collvertical_summissing)
697   
698   # Test for collinearity
699   #CHANGELOG ASJ: no collineary, the 4 variables will be kept for analysis as covariates, 
2021-08-03
700   
701   model <-
702   
lm(
703   
mean_riskperception
~ mean_indivhorz + mean_indivvertical + mean_collhorz +
mean_collvertical ,
704   
data = dat
705   
)
706   vif(model)
707   ols_coll_diag(model)
708   
709   #### + Other data cleaning for demographics ####
710   
711   # Force year of birth as numeric and calculate age accordingly.
712   
713   dat$yearofbirth <- as.numeric(dat$yearofbirth)
714   dat$yearofbirth[dat$yearofbirth==888] <- NA
715   #CHANGELOG ASJ: year of the survey was postponed to 2021 instead of 2020, 2021-08-03
716   dat$age <- 2021 - dat$yearofbirth
717   
718   
719   dat$agecat <- as.numeric(dat$agecat)
720   
721   # Recode multiple answers for language and ethnicity so that people are appropriately 
counted in
722   # each group. These questions are set up so that people "check all that apply." Each of 
the
723   # questions also includes a single option to indicate "I prefer not to answer." For 
each language
724   # and ethnicity, we want to count the number of participants who affirmatively checked it
725   # (indicating 'yes' for that option), those who did not check it but did check other 
options in the
726   # list (indicating 'no' for that option), and those who checked that they prefer not to 
answer
727   # (indicating 'prefer not to answer' for each option in the list). To do this, we use a 
2-step
728   # process in which we first recode the true 'no' values for each option as 0, meaning 
that all 'yes'
729   # answers are 1 and all 'no' answers are 0. Then we assign any 'prefer not to answer' 
to be 'NA'.
730   
731   # Force variables to be numeric.
732   
733   cols.num <-
734   
c(
735   
"bornincanada",
736   
"language_1",
737   
"language_2",
738   
"language_3",
739   
"language_888",
740   
"ethnicity_1",
741   
"ethnicity_2",
742   
"ethnicity_3",
743   
"ethnicity_4",
744   
"ethnicity_5",
745   
"ethnicity_6",
746   
"ethnicity_7",
747   
"ethnicity_8",
748   
"ethnicity_9",
749   
"ethnicity_10",
750   
"ethnicity_11",
751   
"ethnicity_12",

752 
"ethnicity_13",
753 
"ethnicity_14",
754 
"ethnicity_15",
755 
"ethnicity_16",
756 
"ethnicity_17",
757 
"ethnicity_888",
758 
"disability",
759 
"techdisability",
760 
"sexatbirth",
761 
"genderidentity",
762 
"supportedbyincome",
763 
"educationlevel",
764 
"studyarm",
765 
"viz",
766 
"disease",
767 
"immune",
768 
"c19vax"
769 
)
770 
771  dat[cols.num] <- lapply(dat[cols.num],as.numeric)
772 
773  # NB. language_1=English, language_2=French, language_3=Other
774 
775  dat$language_1[is.na(dat$language_1)] <- 0
776  dat$language_2[is.na(dat$language_2)] <- 0
777  dat$language_3[is.na(dat$language_3)] <- 0
778 
779  dat$language_1[dat$language_888==1&dat$language_1==0&dat$language_2==0&dat$language_3==0]
<- NA
780  dat$language_2[dat$language_888==1&dat$language_1==0&dat$language_2==0&dat$language_3==0]
<- NA
781  dat$language_3[dat$language_888==1&dat$language_1==0&dat$language_2==0&dat$language_3==0]
<- NA
782 
783  # ethnicity_1=Asian - East (e.g., Chinese, Japanese, Korean)
784  dat$ethnicity_1[is.na(dat$ethnicity_1)] <- 0
785  # ethnicity_2=Asian - Central (e.g., Kazakhstani, Uzbekistani)
786  dat$ethnicity_2[is.na(dat$ethnicity_2)] <- 0
787  # ethnicity_3=Asian - South (e.g., Indian, Pakistani, Sri Lankan)
788  dat$ethnicity_3[is.na(dat$ethnicity_3)] <- 0
789  # ethnicity_4=Asian - South-East (e.g., Malaysian, Filipino, Vietnamese)
790  dat$ethnicity_4[is.na(dat$ethnicity_4)] <- 0
791  # ethnicity_5=Indigenous or aboriginal person from outside of North America (e.g., 
Maori, Quechua)
792  dat$ethnicity_5[is.na(dat$ethnicity_5)] <- 0
793  # ethnicity_6=White / European (e.g., English, Italian, Portuguese, Russian)
794  dat$ethnicity_6[is.na(dat$ethnicity_6)] <- 0
795  # ethnicity_7=White / North American (e.g., Canadian, American)
796  dat$ethnicity_7[is.na(dat$ethnicity_7)] <- 0
797  # ethnicity_8=Inuit
798  dat$ethnicity_8[is.na(dat$ethnicity_8)] <- 0
799  # ethnicity_9=Latin American (e.g., Chilean, Mexican, Salvadorian)
800  dat$ethnicity_9[is.na(dat$ethnicity_9)] <- 0
801  # ethnicity_10=Metis (Metis Nation in Canada)
802  dat$ethnicity_10[is.na(dat$ethnicity_10)] <- 0
803  # ethnicity_11=North African (e.g., Moroccan, Tunisian)
804  dat$ethnicity_11[is.na(dat$ethnicity_11)] <- 0
805  # ethnicity_12=Middle Eastern (e.g., Egyptian, Iranian, Lebanese)
806  dat$ethnicity_12[is.na(dat$ethnicity_12)] <- 0
807  # ethnicity_13=Black - African (e.g., Ghanaian, Kenyan, Somali)
808  dat$ethnicity_13[is.na(dat$ethnicity_13)] <- 0
809  # ethnicity_14=Black - Caribbean (e.g., Barbadian, Jamaican)
810  dat$ethnicity_14[is.na(dat$ethnicity_14)] <- 0
811  # ethnicity_15=Black - North American (e.g., Canadian, American)
812  dat$ethnicity_15[is.na(dat$ethnicity_15)] <- 0
813  # ethnicity_16=First Nations
814  dat$ethnicity_16[is.na(dat$ethnicity_16)] <- 0
815  # ethnicity_17= Other
816  dat$ethnicity_17[is.na(dat$ethnicity_17)] <- 0

817   
818   # Subset ethnicity values
819   
820   dat_ethnicity <-
821   
subset(
822   
dat,
823   
select = c(
824   
ethnicity_1,
825   
ethnicity_2,
826   
ethnicity_3,
827   
ethnicity_4,
828   
ethnicity_5,
829   
ethnicity_6,
830   
ethnicity_7,
831   
ethnicity_8,
832   
ethnicity_9,
833   
ethnicity_10,
834   
ethnicity_11,
835   
ethnicity_12,
836   
ethnicity_13,
837   
ethnicity_14,
838   
ethnicity_15,
839   
ethnicity_16,
840   
ethnicity_17
841   
)
842   
)
843   
844   # Sum of the 17 ethnicity catogories checked
845   
846   dat$sum_ethnicity <-rowSums(dat_ethnicity,na.rm=T)
847   
848   # Assign NA when the participant selected prefer not to answer (_888) and no other 
option.
849   
850   dat$ethnicity_1[dat$ethnicity_888==1&dat$sum_ethnicity==0] <- NA
851   dat$ethnicity_2[dat$ethnicity_888==1&dat$sum_ethnicity==0] <- NA
852   dat$ethnicity_3[dat$ethnicity_888==1&dat$sum_ethnicity==0] <- NA
853   dat$ethnicity_4[dat$ethnicity_888==1&dat$sum_ethnicity==0] <- NA
854   dat$ethnicity_5[dat$ethnicity_888==1&dat$sum_ethnicity==0] <- NA
855   dat$ethnicity_6[dat$ethnicity_888==1&dat$sum_ethnicity==0] <- NA
856   dat$ethnicity_7[dat$ethnicity_888==1&dat$sum_ethnicity==0] <- NA
857   dat$ethnicity_8[dat$ethnicity_888==1&dat$sum_ethnicity==0] <- NA
858   dat$ethnicity_9[dat$ethnicity_888==1&dat$sum_ethnicity==0] <- NA
859   dat$ethnicity_10[dat$ethnicity_888==1&dat$sum_ethnicity==0] <- NA
860   dat$ethnicity_11[dat$ethnicity_888==1&dat$sum_ethnicity==0] <- NA
861   dat$ethnicity_12[dat$ethnicity_888==1&dat$sum_ethnicity==0] <- NA
862   dat$ethnicity_13[dat$ethnicity_888==1&dat$sum_ethnicity==0] <- NA
863   dat$ethnicity_14[dat$ethnicity_888==1&dat$sum_ethnicity==0] <- NA
864   dat$ethnicity_15[dat$ethnicity_888==1&dat$sum_ethnicity==0] <- NA
865   dat$ethnicity_16[dat$ethnicity_888==1&dat$sum_ethnicity==0] <- NA
866   dat$ethnicity_17[dat$ethnicity_888==1&dat$sum_ethnicity==0] <- NA
867   
868   # Regrouping ethnicities for later covariate analyses. E.g., if participant checked one 
or more of
869   # Asian options, they get a 1 for Asian_group. If they checked no Asian options, they 
get a 0 for
870   # Asian_group.
871   
872   dat$Asian_group <-
873   
ifelse(
874   
dat$ethnicity_1 == 1 |
875   
dat$ethnicity_2 == 1 |
876   
dat$ethnicity_3 == 1 |
877   
dat$ethnicity_4 == 1,
878   
1,
879   
0
880   
)
881   
882   dat$Black_group <-

883   
ifelse(
884   
dat$ethnicity_13 == 1 |
885   
dat$ethnicity_14 == 1 |
886   
dat$ethnicity_15 == 1,
887   
1,
888   
0
889   
)
890   
891   dat$Indigenous_group <-
892   
ifelse(
893   
dat$ethnicity_16 == 1 |
894   
dat$ethnicity_5 == 1 |
895   
dat$ethnicity_8 == 1 |
896   
dat$ethnicity_10 == 1,
897   
1,
898   
0
899   
)
900   
901   dat$MaghrebMiddleEast_group <-
902   
ifelse(
903   
dat$ethnicity_11 == 1 |
904   
dat$ethnicity_12 == 1,
905   
1,
906   
0
907   
)
908   
909   dat$White_group <-
910   
ifelse(
911   
dat$ethnicity_6 == 1 |
912   
dat$ethnicity_7 == 1,
913   
1,
914   
0
915   
)
916   
917   # CHANGELOG: We are creating a new variable for high and low edcation to be later used 
in 2 way and one way ANOVA analysis 2021-07-28
918   #CHANGELOG ASJ: We need to exclude the do not know and prefer not to answer from the 
falses, 2021-08-03
919   dat$edhi <- ifelse(dat$educationlevel == 4 |
920   
dat$educationlevel == 5|
921   
dat$educationlevel == 6|
922   
dat$educationlevel == 7, TRUE, 
923   
ifelse(dat$educationlevel == 8 | dat$educationlevel == 888, NA,FALSE))
924   table(dat$educationlevel,dat$edhi)
925   
926   # Now we assign NA for 'prefer not to answer' responses for the rest of the 
socidemographic items.
927   # We will report the count of 'prefer not to answer' responses in the paper, but for 
our statistical
928   # analyses, we group these with the other responses indicating a lack of affirmative 
response.
929   
930   dat$bornincanada[dat$bornincanada==888] <- NA
931   dat$disability[dat$disability==888] <- NA
932   dat$techdisability[dat$techdisability==888] <- NA
933   dat$sexatbirth[dat$sexatbirth==888] <- NA
934   dat$genderidentity[dat$genderidentity==888] <- NA
935   dat$income[dat$income==888] <- NA
936   dat$income[dat$income==5] <- NA
937   dat$supportedbyincome[dat$supportedbyincome==888] <- NA
938   dat$educationlevel[dat$educationlevel==888] <- NA
939   dat$educationlevel[dat$educationlevel==8] <- NA
940   
941   #CHANGELOG ASJ: i prefer not to answer also put to NA, 2021-08-03
942   dat$agecat[dat$agecat==888 | dat$agecat==1] <- NA
943   
944   # Now we force all categorical variables as factors and add labels for ease of 
interpretation later.
945   

946   dat$bornincanada <-
947   
factor(dat$bornincanada,
948   
levels = c(1, 0),
949   
labels = c("Yes", "No"))
950   
951   dat$language_1 <-
952   
factor(dat$language_1,
953   
levels = c(1, 0),
954   
labels = c("Yes", "No"))
955   
956   dat$language_2 <-
957   
factor(dat$language_2,
958   
levels = c(1, 0),
959   
labels = c("Yes", "No"))
960   
961   dat$language_3 <-
962   
factor(dat$language_3,
963   
levels = c(1, 0),
964   
labels = c("Yes", "No"))
965   
966   dat$ethnicity_1 <-
967   
factor(dat$ethnicity_1,
968   
levels = c(1, 0),
969   
labels = c("Yes", "No"))
970   
971   dat$ethnicity_2 <-
972   
factor(dat$ethnicity_2,
973   
levels = c(1, 0),
974   
labels = c("Yes", "No"))
975   
976   dat$ethnicity_3 <-
977   
factor(dat$ethnicity_3,
978   
levels = c(1, 0),
979   
labels = c("Yes", "No"))
980   
981   dat$ethnicity_4 <-
982   
factor(dat$ethnicity_4,
983   
levels = c(1, 0),
984   
labels = c("Yes", "No"))
985   
986   dat$ethnicity_5 <-
987   
factor(dat$ethnicity_5,
988   
levels = c(1, 0),
989   
labels = c("Yes", "No"))
990   
991   dat$ethnicity_6 <-
992   
factor(dat$ethnicity_6,
993   
levels = c(1, 0),
994   
labels = c("Yes", "No"))
995   
996   dat$ethnicity_7 <-
997   
factor(dat$ethnicity_7,
998   
levels = c(1, 0),
999   
labels = c("Yes", "No"))
1000   
1001   dat$ethnicity_8 <-
1002   
factor(dat$ethnicity_8,
1003   
levels = c(1, 0),
1004   
labels = c("Yes", "No"))
1005   
1006   dat$ethnicity_9 <-
1007   
factor(dat$ethnicity_9,
1008   
levels = c(1, 0),
1009   
labels = c("Yes", "No"))
1010   
1011   dat$ethnicity_10 <-
1012   
factor(dat$ethnicity_10,
1013   
levels = c(1, 0),
1014   
labels = c("Yes", "No"))

1015   
1016   dat$ethnicity_11 <-
1017   
factor(dat$ethnicity_11,
1018   
levels = c(1, 0),
1019   
labels = c("Yes", "No"))
1020   
1021   dat$ethnicity_12 <-
1022   
factor(dat$ethnicity_12,
1023   
levels = c(1, 0),
1024   
labels = c("Yes", "No"))
1025   
1026   dat$ethnicity_13 <-
1027   
factor(dat$ethnicity_13,
1028   
levels = c(1, 0),
1029   
labels = c("Yes", "No"))
1030   
1031   dat$ethnicity_14 <-
1032   
factor(dat$ethnicity_14,
1033   
levels = c(1, 0),
1034   
labels = c("Yes", "No"))
1035   
1036   dat$ethnicity_15 <-
1037   
factor(dat$ethnicity_15,
1038   
levels = c(1, 0),
1039   
labels = c("Yes", "No"))
1040   
1041   dat$ethnicity_16 <-
1042   
factor(dat$ethnicity_16,
1043   
levels = c(1, 0),
1044   
labels = c("Yes", "No"))
1045   
1046   dat$ethnicity_17 <-
1047   
factor(dat$ethnicity_17,
1048   
levels = c(1, 0),
1049   
labels = c("Yes", "No"))
1050   
1051   dat$Asian_group <-
1052   
factor(dat$Asian_group,
1053   
levels = c(1, 0),
1054   
labels = c("Yes", "No"))
1055   
1056   dat$MaghrebMiddleEast_group <-
1057   
factor(dat$MaghrebMiddleEast_group,
1058   
levels = c(1, 0),
1059   
labels = c("Yes", "No"))
1060   
1061   dat$Black_group <-
1062   
factor(dat$Black_group,
1063   
levels = c(1, 0),
1064   
labels = c("Yes", "No"))
1065   
1066   dat$White_group <-
1067   
factor(dat$White_group,
1068   
levels = c(1, 0),
1069   
labels = c("Yes", "No"))
1070   
1071   dat$Indigenous_group <-
1072   
factor(dat$Indigenous_group,
1073   
levels = c(1, 0),
1074   
labels = c("Yes", "No"))
1075   
1076   dat$disability <-
1077   
factor(
1078   
dat$disability,
1079   
levels = c(0, 1),
1080   
labels = c("No disability", "yes,at least one")
1081   
)
1082   
1083   dat$techdisability <-

1084   
factor(dat$techdisability,
1085   
levels = c(0, 1),
1086   
labels = c("No", "Yes"))
1087   
1088   dat$sexatbirth <-
1089   
factor(dat$sexatbirth,
1090   
levels = c(1, 2),
1091   
labels = c("Female", "Male"))
1092   
1093   dat$genderidentity <- factor(
1094   
dat$genderidentity,
1095   
levels = c(1, 2, 3, 4),
1096   
labels = c(
1097   
"Female",
1098   
"Male",
1099   
"Indigenous or other cultural gender minority identity",
1100   
"Something else"
1101   
)
1102   )
1103   
1104   dat$income <-
1105   
factor(
1106   
dat$income,
1107   
levels = c(1, 2, 3, 4),
1108   
labels = c("24 999 or less", "25 000 to 49 999",
1109   
"50 000 to 99 999", "100 000 or more")
1110   
)
1111   
1112   dat$educationlevel <- factor(
1113   
dat$educationlevel,
1114   
levels = c(1, 2, 3, 4, 5, 6, 7),
1115   
labels = c(
1116   
"Some Elementary School",
1117   
"High School Diploma",
1118   
"Apprenticeship or trade certificate or diploma",
1119   
"College or polytechnical school certificate or diploma",
1120   
"University degree bachelor level or below",
1121   
"University graduate degree Master level",
1122   
"University graduate degree Doctorate level"
1123   
)
1124   )
1125   
1126   dat$agecat<-
1127   
factor(
1128   
dat$agecat,
1129   
levels = c(2, 3, 4),
1130   
labels = c("18-34 years", "35-49 years", "50 years and more")
1131   
)
1132   
1133   dat$UserLanguage <- as.factor(dat$UserLanguage)
1134   
1135   dat$studyarm <-
1136   
factor (
1137   
dat$studyarm,
1138   
levels = c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13),
1139   
labels = c(
1140   
"controlgeneric",
1141   
"controlmeasles",
1142   
"controlpertussis",
1143   
"controlflu",
1144   
"herdimmgeneric",
1145   
"herdimmmeasles",
1146   
"herdimmpertussis",
1147   
"herdimmflu",
1148   
"robertkochgeneric",
1149   
"sbsnewsgeneric",
1150   
"guardianmeasles",
1151   
"theotheredmundmeasles",
1152   
"publichealthagencycanadaflu"

1153   
)
1154   
)
1155   
1156   dat$viz <- factor (
1157   
dat$viz,
1158   
levels = c(0, 1, 2, 3, 5, 6, 7),
1159   
labels = c(
1160   
"no visualization",
1161   
"herdimm",
1162   
"robertkoch",
1163   
"sbsnews",
1164   
"guardian",
1165   
"theotheredmund",
1166   
"publichealthagencycanada"
1167   
)
1168   )
1169   
1170   dat$disease <-
1171   
factor (
1172   
dat$disease,
1173   
levels = c(0, 1, 2, 3),
1174   
labels = c("Generic", "Measles", "Pertussis", "Flu")
1175   
)
1176   
1177   
1178   #Keep I don't know categories as is, not as NA, to distinguish them, for these special 
variables (COVID-19)
1179   dat$immune <-
1180   
factor(
1181   
dat$immune,
1182   
levels = c(1, 0, 77),
1183   
labels = c("Yes", "No", "I don't know")
1184   
)
1185   
1186   dat$c19vax <-
1187   
factor(
1188   
dat$c19vax,
1189   
levels = c(1, 0, 77),
1190   
labels = c("Yes", "No", "I don't know")
1191   
)
1192   
1193   #CHANGELOG ASJ: All variables related to children were removed from the final survey 
and are deleted in the rest of the code (children, childimmune, childfluvax), 2021-08-06.
1194   
1195   
1196   #Make restrictions on the dataset for analysis of patients kept for analysis vs not 
kept for analysis
1197   #CHANGELOG ASJ: Variables were different than planned, subset done differently because 
of gc, 2021-08-06.
1198   datConsent<- subset(datRaw,Consent==1)
1199   datConsent$used<-ifelse(datConsent$gc==1 & datConsent$Finished ==1, 1,0) #used in our 
analysis (n = 5516 vs others with consent (not finished, no quality))
1200   table(datConsent$used)
1201   
1202   
1203   # Note re: possibly recoding low-frequency data after collecting data
1204   
1205   # If we observe low frequencies (below 5%) among socio demographic variables, we will 
recode these 
1206   # groups. This is because small subgroups are unlikely to work well in our planned 
statistical
1207   # models.
1208   
1209   # Descriptive statistics of all original variables will be examined. The following 
steps will be 
1210   # used if a category has frequency smaller than 5% of the total sample. We anticipate 
this may be
1211   # necessary for gender identity and education level.
1212   

1213   # For gender identity, we will remove smaller categories from inclusion in analytical 
models since
1214   # they cannot be combined with other category. We still still report these statistics 
in the
1215   # sociodemographic statistics of the same and will otherwise use these participants' 
data as usual.
1216   # This means that if categories 3 and 4 have frequencies smaller than 5 % than we will 
use this
1217   # code:
1218   
1219   #CHANGELOG ASJ: the variable is a factor, need to exclude with text instead of numbers, 
2021-08-03
1220   #CHANGELOG ASJ: this is removed from comments since <5% answered the two last categories
1221   dat$genderidentity[dat$genderidentity == "Something else" |
1222   
dat$genderidentity == "Indigenous or other cultural gender 
minority identity"] <- NA
1223   dat$genderidentity <- droplevels(dat$genderidentity)
1224   
1225   # For education level, we will regroup smaller categories with the closest bigger 
categories with 
1226   # which it makes sense to group them. If, for example, there are small frequencies for 
'some
1227   # elementary school' we will regroup it with high school diploma. Potential code would 
be:
1228   
1229   # dat$educationlevel[dat$educationlevel== 1] <- 2; dat$educationlevel <-
1230   # factor(dat$educationlevel,levels = c(2,3,4,5,6,7), labels = c("Some Elementary School 
or High
1231   # School Diploma", "Apprenticeship or trade certificate or diploma College or 
polytechnical school
1232   # certificate or diploma", "University degree bachelor level or below","University 
graduate degree
1233   # Master level", "University graduate degree Doctorate level", "Do not know"))
1234   
1235   #CHANGELOG ASJ: Education was recoded as high vs low in edhi variable above, instead of 
using this code, 2021-08-03.
1236   
1237   # The rest won't change unless we need to. If we observe another category with 
frequency below 5%,
1238   # we will follow similar procedures.
1239   
1240   #CHANGELOG ASJ: Several covariates have categories with <5% (language_3, 
MaghrebMiddleEast_group, Black_group, Indigenous_group, ethnicity_9, techdisability). 
However, they are dichotomous variable, so it is not possible to combine categories. 
They will simply be dropped from the models.
1241   #CHANGELOG ASJ: However, for techdisability, it will be combined with disability, we 
don't want to loose that information. 2021-08-03.
1242   dat$disability_any <-ifelse(dat$disability =="yes,at least one" | dat$techdisability ==
"Yes", 1, 0)
1243   dat$disability_any <-
1244   
factor(
1245   
dat$disability_any,
1246   
levels = c(1, 0),
1247   
labels = c("Yes", "No")
1248   
)
1249   
1250   #CHANGELOG ASJ: As mentioned later on in the preregistered code, we are recoding here 
trust info because it is asymetric, 2021-08-03
1251   dat$Htrustinfo <- ifelse(dat$trustinfo >= 5, 1, 0)
1252   dat$Htrustinfo <-
1253   
factor(
1254   
dat$Htrustinfo,
1255   
levels = c(1, 0),
1256   
labels = c("Yes", "No")
1257   
)
1258   
1259   #CHANGELOG ASJ: Because 1st variable of risk perception does not have enough variance 
and is asymetric, recode as dichotomic variable, 2021-08-03
1260   #CHANGELOG ASJ: Cutpoint = 80, keep people who correctly identified a high risk, 

2021-08-06.
1261   hist(dat$riskpercep1_1)
1262   dat$RP1_dicho <- ifelse(dat$riskpercep1_1 >= 80, 1, 0)
1263   dat$RP1_dicho <-
1264   
factor(
1265   
dat$RP1_dicho,
1266   
levels = c(1, 0),
1267   
labels = c("High", "Low")
1268   
)
1269   table(dat$RP1_dicho)
1270   
1271   #CHANGELOG ASJ: Because vaxintention does not have enough variance and is asymetric, 
recode as dichotomic variable, 2021-08-06.
1272   #CHANGELOG ASJ: Cutpoint = 91, at or above median.
1273   hist(dat$vaxintention_1)
1274   summary(dat$vaxintention_1)
1275   dat$vaxintent<-ifelse(dat$vaxintention_1>=91,1,0)
1276   
1277   dat$vaxintent <-
1278   
factor(
1279   
dat$vaxintent,
1280   
levels = c(1, 0),
1281   
labels = c("High", "Low")
1282   
)
1283   
1284   table(dat$vaxintent)
1285   
1286   #CHANGELOG ASJ: Because c19vaxintention does not have enough variance and is asymetric, 
recode as dichotomic variable, 2021-08-06.
1287   #CHANGELOG ASJ: Cutpoint = 90, at or above median.
1288   hist(dat$c19vaxintention_1)
1289   summary(dat$c19vaxintention_1)
1290   dat$c19vaxintent<-ifelse(dat$c19vaxintention_1>=90,1,0)
1291   
1292   dat$c19vaxintent <-
1293   
factor(
1294   
dat$c19vaxintent,
1295   
levels = c(1, 0),
1296   
labels = c("High", "Low")
1297   
)
1298   
1299   table(dat$c19vaxintent)
1300   
1301   #### + Subsets for primary and secondary analyses ####
1302   
1303   # We create new subsets for primary and secondary analyses. The first subset (datMain) 
is for our
1304   # primary research question. The other subsets are for the secondary question.
1305   
1306   datMain <-
1307   
subset(
1308   
dat,
1309   
dat$studyarm == "controlgeneric" |
1310   
dat$studyarm == "controlmeasles" |
1311   
dat$studyarm == "controlpertussis" |
1312   
dat$studyarm == "controlflu" |
1313   
dat$studyarm == "herdimmgeneric" |
1314   
dat$studyarm == "herdimmmeasles" |
1315   
dat$studyarm == "herdimmpertussis" |
1316   
dat$studyarm == "herdimmflu"
1317   
)
1318   
1319   don<-subset(datMain,select=c(studyarm,mean_riskperception, viz, disease,mean_indivhorz,
1320   
mean_indivvertical ,
1321   
mean_collhorz ,
1322   
mean_collvertical ,
1323   
bornincanada ,
1324   
language_1 ,
1325   
language_2 ,

1326   
Asian_group ,
1327   
White_group,
1328   
disability_any ,
1329   
genderidentity ,
1330   
income ,
1331   
edhi,
1332   
age,
1333   
mean_riskperception2_6,RP1_dicho,vaxintent,mean_emotion,sum_k
nowledge,Htrustinfo,
1334   
mean_C5_conf2,mean_C5_comp2,mean_C5_cons2,mean_C5_calc2,mean_
C5_coll2)) # CHANGELOG ASJ updated restrictions
1335   
#Added the code to determine the missing data 
1336   
# for variables later used in ANOVA analysis, only 
those with >5%, 2021-08-03
1337   
#remove c19vaxintent, too many missing values
1338   
1339   
1340   
1341   datGeneric <-
1342   
subset(
1343   
dat,
1344   
(
1345   
dat$studyarm == "controlgeneric" |
1346   
dat$studyarm == "herdimmgeneric" |
1347   
dat$studyarm == "robertkochgeneric" |
1348   
dat$studyarm == "sbsnewsgeneric"
1349   
) &
1350   
UserLanguage == "EN"
1351   
)
1352   
1353   datMeasles <-
1354   
subset(
1355   
dat,
1356   
dat$studyarm == "controlmeasles" |
1357   
dat$studyarm == "herdimmmeasles" |
1358   
dat$studyarm == "guardianmeasles" |
1359   
dat$studyarm == "theotheredmundmeasles"
1360   
)
1361   
1362   datFlu <-
1363   
subset(
1364   
dat,
1365   
dat$studyarm == "controlflu"
|
1366   
dat$studyarm == "herdimmflu" |
1367   
dat$studyarm == "publichealthagencycanadaflu"
1368   
)
1369   
1370   datMain$studyarm <- droplevels(datMain$studyarm)
1371   datGeneric$studyarm <- droplevels(datGeneric$studyarm)
1372   datMeasles$studyarm <- droplevels(datMeasles$studyarm)
1373   datFlu$studyarm <- droplevels(datFlu$studyarm)
1374   
1375   #CHANGELOG ASJ, save r dataset for analysis, 2021-09-03
1376   write.csv(dat,file="./datMain.csv",row.names=T)
1377   write.csv(dat,file="./datGeneric.csv",row.names=T)
1378   write.csv(dat,file="./datMeasles.csv",row.names=T)
1379   write.csv(dat,file="./datFlu.csv",row.names=T)
1380   
1381   save(dat,file="dat.RData")
1382   save(datMain,file="datMain.RData")
1383   save(datGeneric,file="datGeneric.RData")
1384   save(datMeasles,file="datMeasles.RData")
1385   save(datFlu,file="datFlu.RData")
1386   save(datConsent,file="datConsent.RData")
1387   
1388   #### DESCRIPTIVE STATISTICS ####
1389   

1390   # For each variable separately
1391   
1392   ### Nominal variables - independent variables to which people were randomized
1393   
1394   # frequencies - study arm
1395   table(dat$studyarm)
1396   # proportion of each study arm that is
1397   # 0 = controlgeneric
1398   # 1 = controlmeasles
1399   # 2 = controlpertussis
1400   # 3 = controlflu
1401   # 4 = herdimmgeneric
1402   # 5 = herdimmmeasles
1403   # 6 = herdimmpertussis
1404   # 7 = herdimmflu
1405   # 8 = robertkochgeneric
1406   # 9 = sbsnewsgeneric
1407   # 10 = nhsgeneric (no longer included because has been taken down)
1408   # 11 = guardianmeasles
1409   # 12 = theotheredmundmeasles
1410   # 13 = publichealthagencycanadaflu
1411   prop.table(table(dat$studyarm)) * 100
1412   
1413   # frequencies - Visualization
1414   table(dat$viz, exclude = NULL)
1415   # proportion of each visualization that is
1416   # 0 = no visualization
1417   # 1 = herdimm
1418   # 2 = robertkoch
1419   # 3 = sbsnews
1420   # 4 = nhs (no longer included because has been taken down)
1421   # 5 = guardian
1422   # 6 = theotheredmund
1423   # 7 = publichealthagencycanada
1424   prop.table(table(dat$viz, exclude = NULL)) * 100
1425   
1426   # frequencies - Disease
1427   table(dat$disease, exclude = NULL)
1428   # proportion of each disease that is
1429   # 0 = Generic
1430   # 1 = Measles
1431   # 2 = Pertussis
1432   # 3 = Flu
1433   prop.table(table(dat$disease, exclude = NULL)) * 100
1434   
1435   ### Nominal variables - in what language did the person complete the survey
1436   
1437   # frequencies - User-language for survey
1438   table(dat$UserLanguage, exclude = NULL)
1439   # proportion of language that is
1440   # English (EN)
1441   # French (FR-CA)
1442   prop.table(table(dat$UserLanguage, exclude = NULL)) * 100
1443   
1444   ### Nominal variables - Demographics # proportion of each demographic variable
1445   # CHANGELOG exclude = NULL added in code below to detemine NA's in the variable 
2021-05-10
1446   
1447   # frequencies - place of birth (Canada or outside Canada)
1448   table(dat$bornincanada, exclude = NULL)
1449   prop.table(table(dat$bornincanada, exclude = NULL)) * 100
1450   
1451   # frequencies - Language_English
1452   table(dat$language_1, exclude = NULL)
1453   prop.table(table(dat$language_1, exclude = NULL)) * 100
1454   
1455   # frequencies - Language_French
1456   table(dat$language_2,exclude = NULL)
1457   prop.table(table(dat$language_2,exclude = NULL)) * 100

1458   
1459   # frequencies - Language_Other
1460   table(dat$language_3,exclude = NULL)
1461   prop.table(table(dat$language_3,exclude = NULL)) * 100
1462   
1463   # frequencies - Ethnicity_Asian - East (e.g., Chinese, Japanese, Korean)
1464   table(dat$ethnicity_1, exclude = NULL)
1465   prop.table(table(dat$ethnicity_1, exclude = NULL)) * 100
1466   
1467   # frequencies - Ethnicity_Asian - Central (e.g., Kazakhstani, Uzbekistani)
1468   table(dat$ethnicity_2, exclude = NULL)
1469   prop.table(table(dat$ethnicity_2,exclude = NULL)) * 100
1470   
1471   # frequencies - Ethnicity_Asian - South (e.g., Indian, Pakistani, Sri Lankan)
1472   table(dat$ethnicity_3,exclude = NULL)
1473   prop.table(table(dat$ethnicity_3, exclude = NULL)) * 100
1474   
1475   # frequencies - Ethnicity_Asian - South-East (e.g., Malaysian, Filipino, Vietnamese)
1476   table(dat$ethnicity_4, exclude = NULL)
1477   prop.table(table(dat$ethnicity_4, exclude = NULL)) * 100
1478   
1479   # frequencies - Ethnicity_Indigenous or aboriginal person from outside of North America 
(e.g.,
1480   # Maori, Quechua)
1481   table(dat$ethnicity_5, exclude = NULL)
1482   prop.table(table(dat$ethnicity_5, exclude = NULL)) * 100
1483   
1484   # frequencies - Ethnicity_White / European (e.g., English, Italian, Portuguese, Russian)
1485   table(dat$ethnicity_6, exclude = NULL)
1486   prop.table(table(dat$ethnicity_6, exclude = NULL)) * 100
1487   
1488   # frequencies - Ethnicity_White / North American (e.g., Canadian, American)
1489   table(dat$ethnicity_7, exclude = NULL)
1490   prop.table(table(dat$ethnicity_7, exclude = NULL)) * 100
1491   
1492   # frequencies - Ethnicity_Inuit
1493   table(dat$ethnicity_8,exclude = NULL)
1494   prop.table(table(dat$ethnicity_8,exclude = NULL)) * 100
1495   
1496   # frequencies - Ethnicity_Latin American (e.g., Chilean, Mexican, Salvadorian)
1497   table(dat$ethnicity_9,exclude = NULL)
1498   prop.table(table(dat$ethnicity_9,exclude = NULL)) * 100
1499   
1500   # frequencies - Ethnicity_Metis (Metis Nation in Canada)
1501   table(dat$ethnicity_10,exclude = NULL)
1502   prop.table(table(dat$ethnicity_10,exclude = NULL)) * 100
1503   
1504   # frequencies - Ethnicity_North African (e.g., Moroccan, Tunisian)
1505   table(dat$ethnicity_11,exclude = NULL)
1506   prop.table(table(dat$ethnicity_11,exclude = NULL)) * 100
1507   
1508   # frequencies - Ethnicity_Middle Eastern (e.g., Egyptian, Iranian, Lebanese)
1509   table(dat$ethnicity_12,exclude = NULL)
1510   prop.table(table(dat$ethnicity_12,exclude = NULL)) * 100
1511   
1512   # frequencies - Ethnicity_Black - African (e.g., Ghanaian, Kenyan, Somali)
1513   table(dat$ethnicity_13,exclude = NULL)
1514   prop.table(table(dat$ethnicity_13,exclude = NULL)) * 100
1515   
1516   # frequencies - Ethnicity_Black - Caribbean (e.g., Barbadian, Jamaican)
1517   table(dat$ethnicity_14,exclude = NULL)
1518   prop.table(table(dat$ethnicity_14,exclude = NULL)) * 100
1519   
1520   # frequencies - Ethnicity_Black - North American (e.g., Canadian, American)
1521   table(dat$ethnicity_15,exclude = NULL)
1522   prop.table(table(dat$ethnicity_15,exclude = NULL)) * 100
1523   
1524   # frequencies - Ethnicity_First Nations
1525   table(dat$ethnicity_16,exclude = NULL)

1526   prop.table(table(dat$ethnicity_16,exclude = NULL)) * 100
1527   
1528   # frequencies - Ethnicity_Other
1529   table(dat$ethnicity_17,exclude = NULL)
1530   prop.table(table(dat$ethnicity_17,exclude = NULL)) * 100
1531   
1532   # frequencies - Asian_group
1533   table(dat$Asian_group,exclude = NULL)
1534   prop.table(table(dat$Asian_group,exclude = NULL)) * 100
1535   
1536   # frequencies - Black_group
1537   table(dat$Black_group, exclude = NULL)
1538   prop.table(table(dat$Black_group, exclude = NULL)) * 100
1539   
1540   # frequencies - Indigenous_group
1541   table(dat$Indigenous_group,exclude = NULL)
1542   prop.table(table(dat$Indigenous_group, exclude = NULL)) * 100
1543   
1544   # frequencies - MaghrebMiddleEast_group
1545   table(dat$MaghrebMiddleEast_group, exclude = NULL)
1546   prop.table(table(dat$MaghrebMiddleEast_group, exclude = NULL)) * 100
1547   
1548   # frequencies - White_group
1549   table(dat$White_group, exclude = NULL)
1550   prop.table(table(dat$White_group, exclude = NULL)) * 100
1551   
1552   # frequencies - disability
1553   table(dat$disability, exclude = NULL)
1554   prop.table(table(dat$disability,exclude = NULL )) * 100
1555   
1556   # frequencies - tech disability
1557   table(dat$techdisability, exclude = NULL)
1558   prop.table(table(dat$techdisability, exclude = NULL)) * 100
1559   
1560   #CHANGELOG ASJ: frequencies - any disability, 2021-08-03
1561   table(dat$disability_any, exclude = NULL)
1562   prop.table(table(dat$disability_any, exclude = NULL)) * 100
1563   
1564   # frequencies - sex at birth
1565   table(dat$sexatbirth, exclude = NULL)
1566   prop.table(table(dat$sexatbirth, exclude = NULL)) * 100
1567   
1568   # frequencies - gender identity
1569   table(dat$genderidentity, exclude = NULL)
1570   prop.table(table(dat$genderidentity, exclude = NULL)) * 100
1571   
1572   # frequencies - income
1573   table(dat$income, exclude = NULL)
1574   prop.table(table(dat$income, exclude = NULL)) * 100
1575   
1576   # frequencies - supportedbyincome
1577   table(dat$supportedbyincome, exclude = NULL)
1578   prop.table(table(dat$supportedbyincome, exclude = NULL)) * 100
1579   
1580   # frequencies - education level
1581   table(dat$educationlevel, exclude = NULL)
1582   prop.table(table(dat$educationlevel, exclude = NULL)) * 100
1583   
1584   #CHANGELOG ASJ: frequencies - education level high vs low, 2021-08-03
1585   table(dat$edhi, exclude = NULL)
1586   prop.table(table(dat$edhi, exclude = NULL)) * 100
1587   
1588   # frequencies - age category
1589   table(dat$agecat,exclude = NULL)
1590   prop.table(table(dat$agecat, exclude = NULL)) * 100
1591   
1592   # frequencies - already immune
1593   table(dat$immune, exclude = NULL)
1594   prop.table(table(dat$immune, exclude = NULL)) * 100

1595   
1596   # frequencies - COVID-19 vax
1597   table(dat$c19vax, exclude = NULL)
1598   prop.table(table(dat$c19vax, exclude = NULL)) * 100
1599   
1600   
1601   ### Nominal variables - Other variables
1602   #CHANGELOG ASJ: Section added for new variables created, 2021-08-03
1603   table(dat$Htrustinfo)
1604   prop.table(table(dat$Htrustinfo)) * 100
1605   
1606   table(dat$RP1_dicho)
1607   prop.table(table(dat$RP1_dicho)) * 100
1608   
1609   table(dat$c19vaxintent)
1610   prop.table(table(dat$c19vaxintent)) * 100
1611   
1612   table(dat$vaxintent)
1613   prop.table(table(dat$vaxintent)) * 100
1614   
1615   #CHANGELOG ASJ: Add new variables 21-09-03
1616   table(dat$mean_C5_conf2)
1617   prop.table(table(dat$mean_C5_conf2)) * 100
1618   
1619   table(dat$mean_C5_comp2)
1620   prop.table(table(dat$mean_C5_comp2)) * 100
1621   
1622   table(dat$mean_C5_cons2)
1623   prop.table(table(dat$mean_C5_cons2)) * 100
1624   
1625   table(dat$mean_C5_calc2)
1626   prop.table(table(dat$mean_C5_calc2)) * 100
1627   
1628   table(dat$mean_C5_coll2)
1629   prop.table(table(dat$mean_C5_coll2)) * 100
1630   
1631   ### Continuous variables - Demographics, scales, etc.
1632   
1633   # Summary statistics for each continuous variable for all participants
1634   summary(dat$mean_riskperception) #CHANGELOG ASJ: this is equivalent to 
riskperception2_6 2021-08-03
1635   summary(dat$score_riskpercep1_1) # CHANGELOG Added separate analysis for risk 
perception item 1 2021-07-08
1636   summary(dat$mean_riskperception2_6) # CHANGELOG Added separate analysis for risk 
perception item 2 to 6 2021-07-08
1637   summary(dat$mean_C5) #CHANGELOG Added separate analysis for 5 subscales, 2021-08-06
1638   summary(dat$mean_C5_conf)
1639   summary(dat$mean_C5_comp)
1640   summary(dat$mean_C5_cons)
1641   summary(dat$mean_C5_calc)
1642   summary(dat$mean_C5_coll)
1643   summary(dat$mean_emotion)
1644   summary(dat$sum_knowledge)
1645   summary(dat$trustinfo)
1646   summary(dat$vaxintention_1)
1647   summary(dat$age)
1648   summary(dat$c19vaxintention_1)
1649   summary(dat$mean_indivhorz)
1650   summary(dat$mean_indivvertical)
1651   summary(dat$mean_collhorz)
1652   summary(dat$mean_collvertical)
1653   
1654   #### + Descriptive statistics per study arm #### 
1655   
1656   ### Continuous variables
1657   
1658   # The describeBy function in the psych package returns the number of observations, 
mean, median, 
1659   # trimmed means, minimum, maximum, range, skew, kurtosis, and standard error of the 

mean for grouped
1660   # data.
1661   
1662   describeBy(dat$mean_riskperception,dat$studyarm) #CHANGELOG ASJ: this is equivalent to 
riskperception2_6 2021-08-03
1663   describeBy(dat$riskpercep1_1,dat$studyarm) # CHANGELOG Added separate analysis for risk 
perception item 1 2021-07-08
1664   describeBy(dat$mean_riskperception2_6,dat$studyarm) # CHANGELOG Added separate analysis 
for risk perception item 2 to 6 2021-07-08
1665   describeBy(dat$mean_C5,dat$studyarm) #CHANGELOG Added separate analysis for 5 
subscales, 2021-08-06
1666   describeBy(dat$mean_C5_conf,dat$studyarm)
1667   describeBy(dat$mean_C5_comp,dat$studyarm)
1668   describeBy(dat$mean_C5_cons,dat$studyarm)
1669   describeBy(dat$mean_C5_calc,dat$studyarm)
1670   describeBy(dat$mean_C5_coll,dat$studyarm)
1671   describeBy(dat$mean_emotion,dat$studyarm)
1672   describeBy(dat$sum_knowledge,dat$studyarm)
1673   describeBy(dat$age,dat$studyarm)
1674   describeBy(dat$trustinfo,dat$studyarm)
1675   describeBy(dat$vaxintention_1,dat$studyarm)
1676   describeBy(dat$c19vaxintention_1,dat$studyarm)
1677   describeBy(dat$mean_indivhorz, dat$studyarm)
1678   describeBy(dat$mean_indivvertical, dat$studyarm)
1679   describeBy(dat$mean_collhorz, dat$studyarm)
1680   describeBy(dat$mean_collvertical, dat$studyarm)
1681   
1682   ### Nominal variables - frequencies and proportion per arm
1683   
1684   t1<-data.frame(dat$bornincanada,dat$studyarm)
1685   table(t1)
1686   prop.table(table(t1), 2) * 100
1687   
1688   # Language_English
1689   t1<-data.frame(dat$language_1,dat$studyarm)
1690   table(t1)
1691   prop.table(table(t1), 2) * 100
1692   
1693   # Language_French
1694   t1<-data.frame(dat$language_2,dat$studyarm)
1695   table(t1)
1696   prop.table(table(t1), 2) * 100
1697   
1698   # Language_Other
1699   t1<-data.frame(dat$language_3,dat$studyarm)
1700   table(t1)
1701   prop.table(table(t1), 2) * 100
1702   
1703   # Asian - East (e.g., Chinese, Japanese, Korean)
1704   t1<-data.frame(dat$ethnicity_1,dat$studyarm)
1705   table(t1)
1706   prop.table(table(t1), 2) * 100
1707   
1708   # Asian - Central (e.g., Kazakhstani, Uzbekistani)
1709   t1<-data.frame(dat$ethnicity_2,dat$studyarm)
1710   table(t1)
1711   prop.table(table(t1), 2) * 100
1712   
1713   # Asian - South (e.g., Indian, Pakistani, Sri Lankan)
1714   t1<-data.frame(dat$ethnicity_3,dat$studyarm)
1715   table(t1)
1716   prop.table(table(t1), 2) * 100
1717   
1718   # Asian - South-East (e.g., Malaysian, Filipino, Vietnamese)
1719   t1<-data.frame(dat$ethnicity_4,dat$studyarm)
1720   table(t1)
1721   prop.table(table(t1), 2) * 100
1722   
1723   # Indigenous or aboriginal person from outside of North America (e.g., Maori, Quechua)

1724   t1<-data.frame(dat$ethnicity_5,dat$studyarm)
1725   table(t1)
1726   prop.table(table(t1), 2) * 100
1727   
1728   # White / European (e.g., English, Italian, Portuguese, Russian)
1729   t1<-data.frame(dat$ethnicity_6,dat$studyarm)
1730   table(t1)
1731   prop.table(table(t1), 2) * 100
1732   
1733   # White / North American (e.g., Canadian, American)
1734   t1<-data.frame(dat$ethnicity_7,dat$studyarm)
1735   table(t1)
1736   prop.table(table(t1), 2) * 100
1737   
1738   # Inuit
1739   t1<-data.frame(dat$ethnicity_8,dat$studyarm)
1740   table(t1)
1741   prop.table(table(t1), 2) * 100
1742   
1743   # Latin American (e.g., Chilean, Mexican, Salvadorian)
1744   t1<-data.frame(dat$ethnicity_9,dat$studyarm)
1745   table(t1)
1746   prop.table(table(t1), 2) * 100
1747   
1748   # Metis (Metis Nation in Canada)
1749   t1<-data.frame(dat$ethnicity_10,dat$studyarm)
1750   table(t1)
1751   prop.table(table(t1), 2) * 100
1752   
1753   # North African (e.g., Moroccan, Tunisian)
1754   t1<-data.frame(dat$ethnicity_11,dat$studyarm)
1755   table(t1)
1756   prop.table(table(t1), 2) * 100
1757   
1758   # Middle Eastern (e.g., Egyptian, Iranian, Lebanese)
1759   t1<-data.frame(dat$ethnicity_12,dat$studyarm)
1760   table(t1)
1761   prop.table(table(t1), 2) * 100
1762   
1763   # Black - African (e.g., Ghanaian, Kenyan, Somali)
1764   t1<-data.frame(dat$ethnicity_13,dat$studyarm)
1765   table(t1)
1766   prop.table(table(t1), 2) * 100
1767   
1768   # Black - Caribbean (e.g., Barbadian, Jamaican)
1769   t1<-data.frame(dat$ethnicity_14,dat$studyarm)
1770   table(t1)
1771   prop.table(table(t1), 2) * 100
1772   
1773   # Black - North American (e.g., Canadian, American)
1774   t1<-data.frame(dat$ethnicity_15,dat$studyarm)
1775   table(t1)
1776   prop.table(table(t1), 2) * 100
1777   
1778   # First Nations
1779   t1<-data.frame(dat$ethnicity_16,dat$studyarm)
1780   table(t1)
1781   prop.table(table(t1), 2) * 100
1782   
1783   # Other
1784   t1<-data.frame(dat$ethnicity_17,dat$studyarm)
1785   table(t1)
1786   prop.table(table(t1), 2) * 100
1787   
1788   # Asian_group
1789   t1<-data.frame(dat$Asian_group,dat$studyarm)
1790   table(t1)
1791   prop.table(table(t1), 2) * 100
1792   

1793   # MaghrebMiddleEast_group
1794   t1<-data.frame(dat$MaghrebMiddleEast_group,dat$studyarm)
1795   table(t1)
1796   prop.table(table(t1), 2) * 100
1797   
1798   # Black_group
1799   t1<-data.frame(dat$Black_group,dat$studyarm)
1800   table(t1)
1801   prop.table(table(t1), 2) * 100
1802   
1803   # White_group
1804   t1<-data.frame(dat$White_group,dat$studyarm)
1805   table(t1)
1806   prop.table(table(t1), 2) * 100
1807   
1808   # Indigenous_group
1809   t1<-data.frame(dat$Indigenous_group,dat$studyarm)
1810   table(t1)
1811   prop.table(table(t1), 2) * 100
1812   
1813   # disability
1814   t1<-data.frame(dat$disability,dat$studyarm)
1815   table(t1)
1816   prop.table(table(t1), 2) * 100
1817   
1818   # tech disability
1819   t1<-data.frame(dat$techdisability,dat$studyarm)
1820   table(t1)
1821   prop.table(table(t1), 2) * 100
1822   
1823   #CHANGELOG ASJ: add any disability, 2021-08-03
1824   t1<-data.frame(dat$disability_any,dat$studyarm)
1825   table(t1)
1826   prop.table(table(t1), 2) * 100
1827   
1828   # sex at birth
1829   t1<-data.frame(dat$sexatbirth,dat$studyarm)
1830   table(t1)
1831   prop.table(table(t1), 2) * 100
1832   
1833   # gender identity
1834   t1<-data.frame(dat$genderidentity,dat$studyarm)
1835   table(t1)
1836   prop.table(table(t1), 2) * 100
1837   
1838   # income
1839   t1<-data.frame(dat$income,dat$studyarm)
1840   table(t1)
1841   prop.table(table(t1), 2) * 100
1842   
1843   # education level
1844   t1<-data.frame(dat$educationlevel,dat$studyarm)
1845   table(t1)
1846   prop.table(table(t1), 2) * 100
1847   
1848   #CHANGELOG ASJ: add education level high/low, 2021-08-03
1849   t1<-data.frame(dat$edhi,dat$studyarm)
1850   table(t1)
1851   prop.table(table(t1), 2) * 100
1852   
1853   # immune
1854   t1<-data.frame(dat$immune,dat$studyarm)
1855   table(t1)
1856   prop.table(table(t1), 2) * 100
1857   
1858   # COVID-19 vax
1859   t1<-data.frame(dat$c19vax,dat$studyarm)
1860   table(t1)
1861   prop.table(table(t1), 2) * 100

1862   
1863   
1864   #CHANGELOG ASJ: add 4 new variables, 2021-08-06
1865   #Trust Info
1866   t1<-data.frame(dat$Htrustinfo,dat$studyarm)
1867   table(t1)
1868   prop.table(table(t1), 2) * 100
1869   
1870   #Risk Perception 1
1871   t1<-data.frame(dat$RP1_dicho,dat$studyarm)
1872   table(t1)
1873   prop.table(table(t1), 2) * 100
1874   
1875   #VaxIntention
1876   t1<-data.frame(dat$vaxintent,dat$studyarm)
1877   table(t1)
1878   prop.table(table(t1), 2) * 100
1879   
1880   #Covid19 VaxIntention
1881   t1<-data.frame(dat$c19vaxintent,dat$studyarm)
1882   table(t1)
1883   prop.table(table(t1), 2) * 100
1884   
1885   #### + Graphics per arm ####
1886   
1887   # Boxplots (NB. find nicer colours for publication/thesis)
1888   
1889   par(mar=c(12,5,1,1)) #CHANGELOG ASJ: change margins to see the labels properly, 
2021-08-03
1890   
1891   # Risk perception
1892   # RECALL: Risk perception item 1 and item 2 to 6 are not measuring the same thing (item 
1 will be analysed as dichotomous variable)
1893   # Box plot of risk perception item 2 to 6 for overall data 
1894   boxplot(
1895   
dat$mean_riskperception2_6 ~ dat$studyarm,las=2,
1896   
xlab = "",
1897   
ylab = "Risk Perception2_6",
1898   
main = "Boxplot",
1899   
col = c(
1900   
"white",
1901   
"darksalmon",
1902   
"darkolivegreen1",
1903   
"lightcyan",
1904   
"bisque3",
1905   
"indianred4",
1906   
"green4",
1907   
"darkslateblue",
1908   
"khaki",
1909   
"gray75",
1910   
"gray85",
1911   
"firebrick3",
1912   
"dodgerblue"
1913   
)
1914   ) # CHANGELOG Added seperate analysis for risk perception item 2 to 6 2021-07-08
1915   
1916   
1917   
1918   # Box plot of risk perception item 2 to 6 for subset Main data
1919   boxplot(
1920   
datMain$mean_riskperception2_6 ~ datMain$studyarm,las=2,
1921   
xlab = "",
1922   
ylab = "Risk Perception2_6",
1923   
main = "Boxplot",
1924   
col = c(
1925   
"white",
1926   
"darksalmon",
1927   
"darkolivegreen1",
1928   
"lightcyan",

1929   
"bisque3",
1930   
"indianred4",
1931   
"green4",
1932   
"darkslateblue"
1933   
)
1934   )
1935   
1936   # Box plot of risk perception item 2 to 6 for subset Generic data
1937   boxplot(
1938   
datGeneric$mean_riskperception2_6 ~ datGeneric$studyarm,las=2,
1939   
xlab = "",
1940   
ylab = "Risk Perception2_6",
1941   
main = "Boxplot",
1942   
col = c("white", "bisque3", "khaki", "gray75", "gray85")
1943   ) # CHANGELOG Added seperate analysis for risk perception item 2 to 6 2021-07-08
1944   
1945   
1946   par(mar=c(12,5,1,1)) #CHANGELOG ASJ: change margins to see the labels properly, 
2021-08-03
1947   
1948   
1949   # Box plot of risk perceptiom item 2 to 6 for subset Measles data 
1950   boxplot(
1951   
datMeasles$mean_riskperception2_6 ~ datMeasles$studyarm,las=2,
1952   
xlab = "",
1953   
ylab = "Risk Perception2_6",
1954   
main = "Boxplot",
1955   
col = c("darksalmon", "indianred4", "firebrick3", "firebrick1")
1956   ) # CHANGELOG Added seperate analysis for risk perception item 2 to 6 2021-07-08
1957   
1958   
1959   # Box plot of risk perception item 2 to 6 for subset Flu data 
1960   boxplot(
1961   
datFlu$mean_riskperception2_6 ~ datFlu$studyarm,las=2,
1962   
xlab = "",
1963   
ylab = "Risk Perception2_6",
1964   
main = "Boxplot",
1965   
col = c("lightcyan", "darkslateblue", "dodgerblue")
1966   ) # CHANGELOG Added seperate analysis for risk perception item 2 to 6 2021-07-08
1967   
1968   # Betsch et al C5
1969   #CHANGELOG ASJ: add boxplot for each subscales, 2021-08-06.
1970   
1971   
1972   boxplot(
1973   
datMain$mean_C5_conf ~ datMain$studyarm,las=2,
1974   
xlab = "",
1975   
ylab = "C5 Confidence",
1976   
main = "Boxplot",
1977   
col = c(
1978   
"white",
1979   
"darksalmon",
1980   
"darkolivegreen1",
1981   
"lightcyan",
1982   
"bisque3",
1983   
"indianred4",
1984   
"green4",
1985   
"darkslateblue"
1986   
)
1987   )
1988   
1989   boxplot(
1990   
datMain$mean_C5_comp ~ datMain$studyarm,las=2,
1991   
xlab = "",
1992   
ylab = "C5 complacency",
1993   
main = "Boxplot",
1994   
col = c(
1995   
"white",
1996   
"darksalmon",

1997   
"darkolivegreen1",
1998   
"lightcyan",
1999   
"bisque3",
2000   
"indianred4",
2001   
"green4",
2002   
"darkslateblue"
2003   
)
2004   )
2005   
2006   boxplot(
2007   
datMain$mean_C5_cons ~ datMain$studyarm,las=2,
2008   
xlab = "",
2009   
ylab = "C5 constraints",
2010   
main = "Boxplot",
2011   
col = c(
2012   
"white",
2013   
"darksalmon",
2014   
"darkolivegreen1",
2015   
"lightcyan",
2016   
"bisque3",
2017   
"indianred4",
2018   
"green4",
2019   
"darkslateblue"
2020   
)
2021   )
2022   
2023   boxplot(
2024   
datMain$mean_C5_calc ~ datMain$studyarm,las=2,
2025   
xlab = "",
2026   
ylab = "C5 calculation",
2027   
main = "Boxplot",
2028   
col = c(
2029   
"white",
2030   
"darksalmon",
2031   
"darkolivegreen1",
2032   
"lightcyan",
2033   
"bisque3",
2034   
"indianred4",
2035   
"green4",
2036   
"darkslateblue"
2037   
)
2038   )
2039   
2040   boxplot(
2041   
datMain$mean_C5_coll ~ datMain$studyarm,las=2,
2042   
xlab = "",
2043   
ylab = "C5 Collective Respons.",
2044   
main = "Boxplot",
2045   
col = c(
2046   
"white",
2047   
"darksalmon",
2048   
"darkolivegreen1",
2049   
"lightcyan",
2050   
"bisque3",
2051   
"indianred4",
2052   
"green4",
2053   
"darkslateblue"
2054   
)
2055   )
2056   
2057   
2058   boxplot(
2059   
datGeneric$mean_C5_conf ~ datGeneric$studyarm,las=2,
2060   
xlab = "",
2061   
ylab = "C5 confidence",
2062   
main = "Boxplot",
2063   
col = c("white", "bisque3", "khaki", "gray75", "gray85")
2064   )
2065   

2066   boxplot(
2067   
datGeneric$mean_C5_comp ~ datGeneric$studyarm,las=2,
2068   
xlab = "",
2069   
ylab = "C5 complacency",
2070   
main = "Boxplot",
2071   
col = c("white", "bisque3", "khaki", "gray75", "gray85")
2072   )
2073   
2074   boxplot(
2075   
datGeneric$mean_C5_cons ~ datGeneric$studyarm,las=2,
2076   
xlab = "",
2077   
ylab = "C5 constraints",
2078   
main = "Boxplot",
2079   
col = c("white", "bisque3", "khaki", "gray75", "gray85")
2080   )
2081   
2082   boxplot(
2083   
datGeneric$mean_C5_calc ~ datGeneric$studyarm,las=2,
2084   
xlab = "",
2085   
ylab = "C5 calculation",
2086   
main = "Boxplot",
2087   
col = c("white", "bisque3", "khaki", "gray75", "gray85")
2088   )
2089   
2090   boxplot(
2091   
datGeneric$mean_C5_coll ~ datGeneric$studyarm,las=2,
2092   
xlab = "",
2093   
ylab = "C5 collective respons.",
2094   
main = "Boxplot",
2095   
col = c("white", "bisque3", "khaki", "gray75", "gray85")
2096   )
2097   
2098   
2099   
2100   boxplot(
2101   
datMeasles$mean_C5_conf ~ datMeasles$studyarm,las=2,
2102   
xlab = "",
2103   
ylab = "C5 confidence",
2104   
main = "Boxplot",
2105   
col = c("darksalmon", "indianred4", "firebrick3", "firebrick1")
2106   )
2107   
2108   boxplot(
2109   
datMeasles$mean_C5_comp ~ datMeasles$studyarm,las=2,
2110   
xlab = "",
2111   
ylab = "C5 complacency",
2112   
main = "Boxplot",
2113   
col = c("darksalmon", "indianred4", "firebrick3", "firebrick1")
2114   )
2115   
2116   boxplot(
2117   
datMeasles$mean_C5_cons ~ datMeasles$studyarm,las=2,
2118   
xlab = "",
2119   
ylab = "C5 contraints",
2120   
main = "Boxplot",
2121   
col = c("darksalmon", "indianred4", "firebrick3", "firebrick1")
2122   )
2123   
2124   boxplot(
2125   
datMeasles$mean_C5_calc ~ datMeasles$studyarm,las=2,
2126   
xlab = "",
2127   
ylab = "C5 calculation",
2128   
main = "Boxplot",
2129   
col = c("darksalmon", "indianred4", "firebrick3", "firebrick1")
2130   )
2131   
2132   boxplot(
2133   
datMeasles$mean_C5_coll ~ datMeasles$studyarm,las=2,
2134   
xlab = "",

2135   
ylab = "C5 collective respons.",
2136   
main = "Boxplot",
2137   
col = c("darksalmon", "indianred4", "firebrick3", "firebrick1")
2138   )
2139   
2140   
2141   boxplot(
2142   
datFlu$mean_C5_conf ~ datFlu$studyarm,las=2,
2143   
xlab = "",
2144   
ylab = "C5 confidence",
2145   
main = "Boxplot",
2146   
col = c("lightcyan", "darkslateblue", "dodgerblue")
2147   )
2148   
2149   boxplot(
2150   
datFlu$mean_C5_comp ~ datFlu$studyarm,las=2,
2151   
xlab = "",
2152   
ylab = "C5 complacency",
2153   
main = "Boxplot",
2154   
col = c("lightcyan", "darkslateblue", "dodgerblue")
2155   )
2156   
2157   boxplot(
2158   
datFlu$mean_C5_cons ~ datFlu$studyarm,las=2,
2159   
xlab = "",
2160   
ylab = "C5 constraints",
2161   
main = "Boxplot",
2162   
col = c("lightcyan", "darkslateblue", "dodgerblue")
2163   )
2164   
2165   boxplot(
2166   
datFlu$mean_C5_calc ~ datFlu$studyarm,las=2,
2167   
xlab = "",
2168   
ylab = "C5 calculation",
2169   
main = "Boxplot",
2170   
col = c("lightcyan", "darkslateblue", "dodgerblue")
2171   )
2172   
2173   boxplot(
2174   
datFlu$mean_C5_coll ~ datFlu$studyarm,las=2,
2175   
xlab = "",
2176   
ylab = "C5 collective respons.",
2177   
main = "Boxplot",
2178   
col = c("lightcyan", "darkslateblue", "dodgerblue")
2179   )
2180   
2181   # Emotion
2182   
2183   boxplot(
2184   
dat$mean_emotion ~ dat$studyarm,las=2,
2185   
xlab = "",
2186   
ylab = "emotion",
2187   
main = "Boxplot",
2188   
col = c(
2189   
"white",
2190   
"darksalmon",
2191   
"darkolivegreen1",
2192   
"lightcyan",
2193   
"bisque3",
2194   
"indianred4",
2195   
"green4",
2196   
"darkslateblue",
2197   
"khaki",
2198   
"gray75",
2199   
"gray85",
2200   
"firebrick3",
2201   
"firebrick1",
2202   
"dodgerblue"
2203   
)

2204   )
2205   
2206   boxplot(
2207   
datMain$mean_emotion ~ datMain$studyarm,las=2,
2208   
xlab = "",
2209   
ylab = "emotion",
2210   
main = "Boxplot",
2211   
col = c(
2212   
"white",
2213   
"darksalmon",
2214   
"darkolivegreen1",
2215   
"lightcyan",
2216   
"bisque3",
2217   
"indianred4",
2218   
"green4",
2219   
"darkslateblue"
2220   
)
2221   )
2222   
2223   boxplot(
2224   
datGeneric$mean_emotion ~ datGeneric$studyarm,las=2,
2225   
xlab = "",
2226   
ylab = "emotion",
2227   
main = "Boxplot",
2228   
col = c("white", "bisque3", "khaki", "gray75", "gray85")
2229   )
2230   
2231   boxplot(
2232   
datMeasles$mean_emotion ~ datMeasles$studyarm,las=2,
2233   
xlab = "",
2234   
ylab = "emotion",
2235   
main = "Boxplot",
2236   
col = c("darksalmon", "indianred4", "firebrick3", "firebrick1")
2237   )
2238   
2239   boxplot(
2240   
datFlu$mean_emotion ~ datFlu$studyarm,las=2,
2241   
xlab = "",
2242   
ylab = "emotion",
2243   
main = "Boxplot",
2244   
col = c("lightcyan", "darkslateblue", "dodgerblue")
2245   )
2246   
2247   # Knowledge
2248   
2249   boxplot(
2250   
dat$sum_knowledge ~ dat$studyarm,las=2,
2251   
xlab = "",
2252   
ylab = "knowledge",
2253   
main = "Boxplot",
2254   
col = c(
2255   
"white",
2256   
"darksalmon",
2257   
"darkolivegreen1",
2258   
"lightcyan",
2259   
"bisque3",
2260   
"indianred4",
2261   
"green4",
2262   
"darkslateblue",
2263   
"khaki",
2264   
"gray75",
2265   
"gray85",
2266   
"firebrick3",
2267   
"firebrick1",
2268   
"dodgerblue"
2269   
)
2270   )
2271   
2272   boxplot(

2273   
datMain$sum_knowledge ~ datMain$studyarm,las=2,
2274   
xlab = "",
2275   
ylab = "knowledge",
2276   
main = "Boxplot",
2277   
col = c(
2278   
"white",
2279   
"darksalmon",
2280   
"darkolivegreen1",
2281   
"lightcyan",
2282   
"bisque3",
2283   
"indianred4",
2284   
"green4",
2285   
"darkslateblue"
2286   
)
2287   )
2288   
2289   boxplot(
2290   
datGeneric$sum_knowledge ~ datGeneric$studyarm,las=2,
2291   
xlab = "",
2292   
ylab = "knowledge",
2293   
main = "Boxplot",
2294   
col = c("white", "bisque3", "khaki", "gray75", "gray85")
2295   )
2296   
2297   boxplot(
2298   
datMeasles$sum_knowledge ~ datMeasles$studyarm,las=2,
2299   
xlab = "",
2300   
ylab = "knowledge",
2301   
main = "Boxplot",
2302   
col = c("darksalmon", "indianred4", "firebrick3", "firebrick1")
2303   )
2304   
2305   boxplot(
2306   
datFlu$sum_knowledge ~ datFlu$studyarm,las=2,
2307   
xlab = "",
2308   
ylab = "knowledge",
2309   
main = "Boxplot",
2310   
col = c("lightcyan", "darkslateblue", "dodgerblue")
2311   )
2312   
2313   
2314   #CHANGELOG ASJ: Boxplot removed for variables that will be analysed as dichotomous 
variables (trust info & vax intention), 2021-08-06
2315   
2316   #### MISSING DATA EXPLORATION ####
2317   
2318   # CHANGELOG The code added to determine percentage of the missing data 2021-07-08
2319   
2320   don %>%
2321   
naniar::vis_miss(.,
2322   
sort_miss = TRUE,
2323   
cluster = TRUE)
2324   
2325   don %>%
2326   
naniar::gg_miss_upset(., nsets = 6) # CHANGELOG Descriptive data of missing 2021-07-08
2327   
2328   don %>%
2329   
summarise(n_complete = sum(stats::complete.cases(.)),
2330   
pct_complete = 100 * naniar::prop_complete_case(.),
2331   
n_missing = sum(!stats::complete.cases(.)),
2332   
pct_missing = 100 * naniar::prop_miss_case(.))
2333   don %>%
2334   
naniar::miss_case_table() # CHANGELOG Missing numbers
2335   
2336   don %>%
2337   
naniar::miss_var_summary() %>%
2338   
dplyr::filter(n_miss > 0) # CHANGELOG nvar missing
2339   
2340   don %>%

2341   
naniar::miss_prop_summary() # CHANGELOG percentage of missing overall, % de var avec 
missing, % obs avec missingdon %>% #résumé des missing stat + plot avec VIM
2342   
2343   
2344   HTMLStop() #CHANGELOG ASJ: Stop output html 2021-08-06.
2345   
2346   
2347   #CHANGELOG ASJ Add descriptive statistic per visualization, 21-09-20.
2348   HTMLStart(outdir=".\\",
2349   
file = "Herdimm Descriptive+ 210921",extension = "html",echo=TRUE, HTMLframe
= TRUE)
2350   
2351   
2352   describeBy(dat$mean_riskperception2_6,dat$viz)
2353   describeBy(dat$mean_emotion,dat$viz)
2354   describeBy(dat$sum_knowledge,dat$viz)
2355   describeBy(dat$mean_C5_calc,dat$viz)
2356   describeBy(dat$mean_C5_conf,dat$viz)
2357   describeBy(dat$mean_C5_cons,dat$viz)
2358   describeBy(dat$mean_C5_comp,dat$viz)
2359   describeBy(dat$mean_C5_coll,dat$viz)
2360   describeBy(dat$trustinfo,dat$viz)
2361   describeBy(dat$vaxintention_1,dat$viz)
2362   describeBy(dat$c19vaxintention_1,dat$viz)
2363   describeBy(dat$riskpercep1_1,dat$viz)
2364   
2365   
2366   t1<-data.frame(dat$RP1_dicho,dat$viz)
2367   table(t1)
2368   prop.table(table(t1), 2) * 100
2369   
2370   t1<-data.frame(dat$Htrustinfo,dat$viz)
2371   table(t1)
2372   prop.table(table(t1), 2) * 100
2373   
2374   t1<-data.frame(dat$vaxintent,dat$viz)
2375   table(t1)
2376   prop.table(table(t1), 2) * 100
2377   
2378   t1<-data.frame(dat$c19vaxintent,dat$viz)
2379   table(t1)
2380   prop.table(table(t1), 2) * 100
2381   
2382   t1<-data.frame(dat$mean_C5_calc2,dat$viz)
2383   table(t1)
2384   prop.table(table(t1), 2) * 100
2385   
2386   t1<-data.frame(dat$mean_C5_conf2,dat$viz)
2387   table(t1)
2388   prop.table(table(t1), 2) * 100
2389   
2390   t1<-data.frame(dat$mean_C5_comp2,dat$viz)
2391   table(t1)
2392   prop.table(table(t1), 2) * 100
2393   
2394   t1<-data.frame(dat$mean_C5_cons2,dat$viz)
2395   table(t1)
2396   prop.table(table(t1), 2) * 100
2397   
2398   t1<-data.frame(dat$mean_C5_coll2,dat$viz)
2399   table(t1)
2400   prop.table(table(t1), 2) * 100
2401   HTMLStop()
2402   
2403   #### MULTIPLE IMPUTATION ####
2404   
2405   # Create new data sets for imputed values to make analyses easier
2406   
2407   #CHANGELOG ASJ: change list of variables for imputation according to above recoding, 

2021-08-06
2408   datMain4Imputation <-
2409   
subset(
2410   
dat,
2411   
dat$studyarm == "controlgeneric" |
2412   
dat$studyarm == "controlmeasles" |
2413   
dat$studyarm == "controlpertussis" |
2414   
dat$studyarm == "controlflu"|
2415   
dat$studyarm == "herdimmgeneric" |
2416   
dat$studyarm == "herdimmmeasles" |
2417   
dat$studyarm == "herdimmpertussis" |
2418   
dat$studyarm == "herdimmflu",
2419   
select = c(
2420   
viz,
2421   
disease,
2422   
mean_riskperception2_6,
2423   
mean_C5_conf,
2424   
mean_C5_comp,
2425   
mean_C5_cons,
2426   
mean_C5_calc,
2427   
mean_C5_coll,
2428   
mean_emotion,
2429   
sum_knowledge,
2430   
mean_indivhorz,
2431   
mean_indivvertical,
2432   
mean_collhorz,
2433   
mean_collvertical,
2434   
bornincanada,
2435   
language_1,
2436   
language_2,
2437   
Asian_group,
2438   
White_group,
2439   
disability_any,
2440   
genderidentity,
2441   
income,
2442   
edhi,
2443   
age,
2444   
Htrustinfo,
2445   
RP1_dicho,
2446   
vaxintent
2447   
)
2448   
)
2449   
2450   
2451   datGeneric4Imputation <-
2452   
subset(
2453   
dat,
2454   
dat$studyarm == "controlgeneric" |
2455   
dat$studyarm == "herdimmgeneric" |
2456   
dat$studyarm == "robertkochgeneric" |
2457   
dat$studyarm == "sbsnewsgeneric" & UserLanguage == "EN",
2458   
select = c(
2459   
studyarm,
2460   
UserLanguage,
2461   
mean_riskperception2_6,
2462   
mean_C5_conf,
2463   
mean_C5_comp,
2464   
mean_C5_cons,
2465   
mean_C5_calc,
2466   
mean_C5_coll,
2467   
mean_emotion,
2468   
sum_knowledge,
2469   
mean_indivhorz,
2470   
mean_indivvertical,
2471   
mean_collhorz,
2472   
mean_collvertical,
2473   
bornincanada,
2474   
language_1,
2475   
language_2,

2476   
Asian_group,
2477   
White_group,
2478   
disability_any,
2479   
genderidentity,
2480   
income,
2481   
edhi,
2482   
age,
2483   
Htrustinfo,
2484   
RP1_dicho,
2485   
vaxintent
2486   
)
2487   
)
2488   
2489   datMeasles4Imputation <-
2490   
subset(
2491   
dat,
2492   
dat$studyarm == "controlmeasles" |
2493   
dat$studyarm == "herdimmmeasles" |
2494   
dat$studyarm == "guardianmeasles" |
2495   
dat$studyarm == "theotheredmundmeasles",
2496   
select = c(
2497   
studyarm,
2498   
UserLanguage,
2499   
mean_riskperception2_6,
2500   
mean_C5_conf,
2501   
mean_C5_comp,
2502   
mean_C5_cons,
2503   
mean_C5_calc,
2504   
mean_C5_coll,
2505   
mean_emotion,
2506   
sum_knowledge,
2507   
mean_indivhorz,
2508   
mean_indivvertical,
2509   
mean_collhorz,
2510   
mean_collvertical,
2511   
bornincanada,
2512   
language_1,
2513   
language_2,
2514   
Asian_group,
2515   
White_group,
2516   
disability_any,
2517   
genderidentity,
2518   
income,
2519   
edhi,
2520   
age,
2521   
Htrustinfo,
2522   
RP1_dicho,
2523   
vaxintent
2524   
)
2525   
)
2526   
2527   datFlu4Imputation <-
2528   
subset(
2529   
dat,
2530   
dat$studyarm == "controlflu" |
2531   
dat$studyarm == "herdimmflu" |
2532   
dat$studyarm == "publichealthagencycanadaflu",
2533   
select = c(
2534   
studyarm,
2535   
UserLanguage,
2536   
mean_riskperception2_6,
2537   
mean_C5_conf,
2538   
mean_C5_comp,
2539   
mean_C5_cons,
2540   
mean_C5_calc,
2541   
mean_C5_coll,
2542   
mean_emotion,
2543   
sum_knowledge,
2544   
mean_indivhorz,

2545   
mean_indivvertical,
2546   
mean_collhorz,
2547   
mean_collvertical,
2548   
bornincanada,
2549   
language_1,
2550   
language_2,
2551   
Asian_group,
2552   
White_group,
2553   
disability_any,
2554   
genderidentity,
2555   
income,
2556   
edhi,
2557   
age,
2558   
Htrustinfo,
2559   
RP1_dicho,
2560   
vaxintent
2561   
)
2562   
)
2563   
2564   # Drop any unused levels to clean up the dataset
2565   
2566   datMain4Imputation$viz <- droplevels(datMain4Imputation$viz)
2567   
2568   datGeneric4Imputation$studyarm <- droplevels(datGeneric4Imputation$studyarm)
2569   
2570   datMeasles4Imputation$studyarm <- droplevels(datMeasles4Imputation$studyarm)
2571   
2572   datFlu4Imputation$studyarm <- droplevels(datFlu4Imputation$studyarm)
2573   
2574   # Impute the missing values, using parameters:
2575   # m: Refers to 15 imputed data sets
2576   # maxit: Refers to number of iterations taken to impute missing values: 15
2577   #CHANGELOG ASJ: method removed from mice, use pmm, logreg or polyreg according to 
datatype, 21-09-20.
2578   
2579   #CHANGELOG ASJ:  Set the seed for reproducibility 2021-08-03
2580   seed_for_imp <- 20210920
2581   
2582   datMainImputed <-
2583   
mice(
2584   
datMain4Imputation,
2585   
m = 15,
2586   
maxit = 15, 
2587   
2588   
seed = seed_for_imp,
2589   
)
2590   summary(datMainImputed)
2591   
2592   #CHANGELOG ASJ: added to validate imputation. 2021-09-20.
2593   plot(datMainImputed,c("bornincanada","language_1","Asian_group","White_group","disability
_any",
2594   
"genderidentity","income","edhi","age","Htrustinfo","RP1_dicho","
vaxintent"))
2595   stripplot(datMainImputed,age)
2596   bwplot(datMainImputed,age)
2597   densityplot(datMainImputed,~age)
2598   densityplot(datMainImputed,~bornincanada)
2599   densityplot(datMainImputed,~language_1)
2600   densityplot(datMainImputed,~Asian_group)
2601   densityplot(datMainImputed,~White_group)
2602   densityplot(datMainImputed,~disability_any)
2603   densityplot(datMainImputed,~genderidentity)
2604   densityplot(datMainImputed,~income)
2605   densityplot(datMainImputed,~edhi)
2606   densityplot(datMainImputed,~Htrustinfo) #only one missing obs
2607   densityplot(datMainImputed,~RP1_dicho)
2608   densityplot(datMainImputed,~vaxintent)
2609   save(datMainImputed,file="datMainImputed.RData")

2610   
2611   
2612   datGenericImputed <-
2613   
mice(
2614   
datGeneric4Imputation,
2615   
m = 15,
2616   
maxit = 15,
2617   
seed = seed_for_imp
2618   
)
2619   summary(datGenericImputed)
2620   
2621   #CHANGELOG ASJ: added to validate imputation. 2021-09-20.
2622   plot(datGenericImputed,c("bornincanada","language_1","Asian_group","White_group","disabil
ity_any",
2623   
"genderidentity","income","edhi","age","Htrustinfo","RP1_dicho","va
xintent"))
2624   stripplot(datGenericImputed,age)
2625   bwplot(datGenericImputed,age)
2626   densityplot(datGenericImputed,~age)
2627   densityplot(datGenericImputed,~bornincanada)
2628   densityplot(datGenericImputed,~language_1)
2629   densityplot(datGenericImputed,~Asian_group)
2630   densityplot(datGenericImputed,~White_group)
2631   densityplot(datGenericImputed,~disability_any)
2632   densityplot(datGenericImputed,~genderidentity)
2633   densityplot(datGenericImputed,~income)
2634   densityplot(datGenericImputed,~edhi)
2635   densityplot(datGenericImputed,~Htrustinfo) #only one missing obs
2636   densityplot(datGenericImputed,~RP1_dicho)
2637   densityplot(datGenericImputed,~vaxintent)
2638   save(datGenericImputed,file="datGenericImputed.RData")
2639   
2640   
2641   
2642   datMeaslesImputed <-
2643   
mice(
2644   
datMeasles4Imputation,
2645   
m = 15,
2646   
maxit = 15,
2647   
seed = seed_for_imp
2648   
)
2649   summary(datMeaslesImputed)
2650   
2651   #CHANGELOG ASJ: added to validate imputation. 2021-09-20.
2652   plot(datMeaslesImputed,c("bornincanada","language_1","Asian_group","White_group","disabil
ity_any",
2653   
"genderidentity","income","edhi","age","RP1_dicho","vaxintent"))
2654   stripplot(datMeaslesImputed,age)
2655   bwplot(datMeaslesImputed,age)
2656   densityplot(datMeaslesImputed,~age)
2657   densityplot(datMeaslesImputed,~bornincanada)
2658   densityplot(datMeaslesImputed,~language_1) #only 1 missing
2659   densityplot(datMeaslesImputed,~Asian_group)
2660   densityplot(datMeaslesImputed,~White_group)
2661   densityplot(datMeaslesImputed,~disability_any)
2662   densityplot(datMeaslesImputed,~genderidentity)
2663   densityplot(datMeaslesImputed,~income)
2664   densityplot(datMeaslesImputed,~edhi)
2665   densityplot(datMeaslesImputed,~RP1_dicho)
2666   densityplot(datMeaslesImputed,~vaxintent)
2667   save(datMeaslesImputed,file="datMeaslesImputed.RData")
2668   
2669   datFluImputed <-
2670   
mice(
2671   
datFlu4Imputation,
2672   
m = 15,
2673   
maxit = 15,
2674   
seed = seed_for_imp

2675 
)
2676  summary(datFluImputed)
2677 
2678  #CHANGELOG ASJ: added to validate imputation. 2021-09-20.
2679  plot(datFluImputed,c("bornincanada","language_1","Asian_group","White_group","disability_
any",
2680 
"genderidentity","income","edhi","age","RP1_dicho","vaxintent"))
2681  stripplot(datFluImputed,age)
2682  bwplot(datFluImputed,age)
2683  densityplot(datFluImputed,~age)
2684  densityplot(datFluImputed,~bornincanada)
2685  densityplot(datFluImputed,~language_1) #only 1 missing
2686  densityplot(datFluImputed,~Asian_group)
2687  densityplot(datFluImputed,~White_group)
2688  densityplot(datFluImputed,~disability_any)
2689  densityplot(datFluImputed,~genderidentity)
2690  densityplot(datFluImputed,~income)
2691  densityplot(datFluImputed,~edhi)
2692  densityplot(datFluImputed,~RP1_dicho)
2693  densityplot(datFluImputed,~vaxintent)
2694  save(datFluImputed,file="datFluImputed.RData")
2695 
2696 
2697  #### ANALYSES ####
2698 
2699  #### RESEARCH QUESTION 1 (PRIMARY): EFFECT OF HERDIMM ON RISK PERCEPTION ####
2700 
2701  # + 2-way ANOVA (adjusted for covariates and with moderators) ####
2702 
2703  # Recall: Research question 1 (primary): Across 4 vaccine-preventable diseases, does 
the herdimm 
2704  # intervention influence risk perception compared to a control?
2705 
2706  #### + Model 1: Check for direct effects of factors without any covariates (Risk 
perception1_1) ####
2707  # We have made a new variable with transformation. We want to know that when we look at 
model 1 to model 3
2708  # what we get the significant results e.g., do we get significant results from 
interaction for all, or between which diseases, or viz, 
2709  # if it doesn't change then we use risk perception 2-6 without any transformation, and 
we will be good with that 
2710  # because yes, transformation makes residual better but it doesnt change the conclusion.
2711  # Note: if we do not see changes in the model 1-3 for datMain, we do not use transform 
in imputation data, 
2712  # if there is change then we use transformation variable in the imputation data.
2713 
2714  #CHANGELOG. Analysis of RiskPerception2-6 only in anova model, 2021-08-04
2715  #CHANGELOG ASJ: After analysis of residuals, model also run with transformed variable
2716  #CHANGELOG ASJ: results are similar and residuals not that improved, keep original 
variable
2717  hist(datMain$mean_riskperception2_6)
2718  datMain$mean_riskperception2_6trans<-datMain$mean_riskperception2_6 ** 2
2719  hist(datMain$mean_riskperception2_6trans)
2720  datMain$mean_riskperception2_6transinv<-log(8-datMain$mean_riskperception2_6)
2721  hist(datMain$mean_riskperception2_6transinv)
2722 
2723  #### + Model 1: Check for direct effects of factors without any covariates (for risk 
perception 2 to 6) ####
2724 
2725  options(contrasts=c("contr.sum", "contr.poly")) # CHANGELOG: The statement below is 
added to calculate properly the type III sum of squares with lm 2021-07-27
2726 
2727  mRP1_2_6 <- lm(mean_riskperception2_6
~ viz * disease, data = datMain)
2728  Anova(mRP1_2_6,type="III")
2729  summary(mRP1_2_6)
2730 
2731  # Model 2: Check for direct effects of factors with adjustment for other covariates
2732  #CHANGELOG ASJ: change list of covariates after recoding and deletion for <5% 
categories, 2021-08-04

2733   
2734   mRP2_2_6 <-
2735   
lm(
2736   
mean_riskperception2_6
~ viz * disease +
2737   
mean_indivhorz +
2738   
mean_indivvertical +
2739   
mean_collhorz +
2740   
mean_collvertical +
2741   
bornincanada +
2742   
language_1 +
2743   
language_2 +
2744   
Asian_group +
2745   
White_group +
2746   
disability_any +
2747   
genderidentity +
2748   
income +
2749   
edhi +
2750   
age,
2751   
data = datMain
2752   
)
2753   Anova(mRP2_2_6, type = "III")
2754   summary(mRP2_2_6)
2755   
2756   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other
2757   # covariates
2758   
2759   mRP3_2_6 <-
2760   
lm(
2761   
mean_riskperception2_6
~
2762   
viz * disease * mean_indivhorz +
2763   
viz * disease * mean_indivvertical +
2764   
viz * disease * mean_collhorz +
2765   
viz * disease * mean_collvertical +
2766   
bornincanada +
2767   
language_1 +
2768   
language_2 +
2769   
Asian_group +
2770   
White_group +
2771   
disability_any +
2772   
genderidentity +
2773   
income +
2774   
edhi +
2775   
age,
2776   
data = datMain
2777   
)
2778   Anova(mRP3_2_6, type = "III")
2779   summary(mRP3_2_6)
2780   
2781   #### + Adding interaction for high and low education with herdimm vizsualization ####
2782   # CHANGELOG We have added 2 new models to check the interaction between
2783   # high and low education with herdimm vizualization 2021-07-22
2784   
2785   #### + Model 4: Check for interaction viz*edhi without any covariates (for risk 
perception 2 to 6) ####
2786   
2787   mRP4_2_6 <- lm(mean_riskperception2_6 ~ viz * disease + viz * edhi, data = datMain)
2788   Anova(mRP4_2_6,type="III")
2789   summary(mRP4_2_6)
2790   
2791   # Model 5: Check for interaction viz*edhi with covariates
2792   
2793   mRP5_2_6 <-
2794   
lm(
2795   
mean_riskperception2_6
~ viz * disease +
2796   
viz * edhi +
2797   
mean_indivhorz +
2798   
mean_indivvertical +
2799   
mean_collhorz +

2800   
mean_collvertical +
2801   
bornincanada +
2802   
language_1 +
2803   
language_2 +
2804   
Asian_group +
2805   
White_group +
2806   
disability_any +
2807   
genderidentity +
2808   
income +
2809   
age,
2810   
data = datMain
2811   
)
2812   Anova(mRP5_2_6, type = "III")
2813   summary(mRP5_2_6)
2814   
2815   
2816   #### + Validating assumptions ####
2817   
2818   # Check to see if the assumptions of the models are respected. If not, we will 
transform the
2819   # outcome.
2820   
2821   # First, create an assumption-checking function that we can run on each model for 
efficiency.
2822   
2823   checkassumptions <- function(modelname) {
2824   
boxcox(modelname, lambda = seq(-2, 2, 0.1), plotit = T)
2825   
# Extract the residuals from the model
2826   
res <- studres(modelname)
2827   
# Check their normality
2828   
print(kurtosis(res) - 3)
2829   
print(skewness(res))
2830   
hist(res)
2831   
qqnorm(res)
2832   
qqline(res)
2833   
print(ks.test(res, "pnorm", 0, 1))
2834   
print(shapiro.test(res))
2835   
# Homoscedasticity (homogeneity of variance)
2836   
fitted <- fitted(modelname)
2837   
plot(fitted, res)
2838   
abline(h = c(-3, 0, 3))
2839   }
2840   
2841   # Then run the function to check the assumptions for each model.
2842   
2843   checkassumptions(mRP1_2_6)
2844   checkassumptions(mRP2_2_6)
2845   checkassumptions(mRP3_2_6)
2846   checkassumptions(mRP4_2_6) # CHANGELOG We have added check assumptions function for 
Model 4, 5 and 6 2021-07-22
2847   checkassumptions(mRP5_2_6)
2848   
2849   
2850   #### + Interpretation (Risk perception 2 to 6) ####
2851   
2852   #CHANGELOG ASJ: only the appropriate section (with or without interaction) is kept for 
each model, 2021-08-09
2853   
2854   # Interpretation of model 1 in the case of an interaction
2855   
2856   mRP1_2_6_vd <- emmeans(mRP1_2_6,~viz|disease)
2857   mRP1_2_6_vd
2858   pairs(mRP1_2_6_vd) # Only do multiple comparisons if type 3 test is significant
2859   plot(mRP1_2_6_vd) # Explore options for less ugly plot for publication/thesis
2860   
2861   mRP1_2_6_dv <- emmeans(mRP1_2_6,~disease|viz)
2862   mRP1_2_6_dv
2863   pairs(mRP1_2_6_dv) # Only do multiple comparisons if type 3 test is significant
2864   plot(mRP1_2_6_dv)

2865   
2866   
2867   # Interpretation of model 2 in the case of an interaction
2868   
2869   mRP2_2_6_vd <- emmeans(mRP2_2_6,~viz|disease)
2870   mRP2_2_6_vd
2871   pairs(mRP2_2_6_vd) # Only do multiple comparisons if type 3 test is significant
2872   plot(mRP2_2_6_vd) # Explore options for less ugly plot for publication/thesis
2873   
2874   mRP2_2_6_dv <- emmeans(mRP2_2_6,~disease|viz)
2875   mRP2_2_6_dv
2876   pairs(mRP2_2_6_dv) # Only do multiple comparisons if type 3 test is significant
2877   plot(mRP2_2_6_dv)
2878   
2879   # Interpretation of model 3 moderating effects 
2880   #CHANGELOG ASJ: change the focus of the interpretation 2021-08-11.
2881   
2882   emmip(mRP3_2_6, disease ~ mean_indivhorz, cov.reduce = range)
2883   emmip(mRP3_2_6, viz ~ mean_indivvertical, cov.reduce = range)
2884   emmip(mRP3_2_6, viz ~ mean_collhorz, cov.reduce = range)
2885   
2886   emmeans(mRP3_2_6,  ~ viz, at=list(mean_indivvertical=(2.5)))
2887   pairs(emmeans(mRP3_2_6,  ~ viz, at=list(mean_indivvertical=(2.5))))
2888   emmeans(mRP3_2_6,  ~ viz, at=list(mean_indivvertical=(5.0)))
2889   pairs(emmeans(mRP3_2_6,  ~ viz, at=list(mean_indivvertical=(5.0))))
2890   emmeans(mRP3_2_6,  ~ viz, at=list(mean_indivvertical=(7.5)))
2891   pairs(emmeans(mRP3_2_6,  ~ viz, at=list(mean_indivvertical=(7.5))))
2892   
2893   # Interpretation of model 4 in the case of an interaction viz*edhi
2894   # CHANGELOG We have added interpretation of model 4 2021-07-22
2895   
2896   mRP4_2_6_ve <- emmeans(mRP4_2_6,~viz|edhi)
2897   mRP4_2_6_ve
2898   pairs(mRP4_2_6_ve) # Only do multiple comparisons if type 3 test is significant
2899   plot(mRP4_2_6_ve) # Explore options for less ugly plot for publication/thesis
2900   
2901   mRP4_2_6_ev <- emmeans(mRP4_2_6,~edhi|viz)
2902   mRP4_2_6_ev
2903   pairs(mRP4_2_6_ev) # Only do multiple comparisons if type 3 test is significant
2904   plot(mRP4_2_6_ev)
2905   
2906   
2907   # Interpretation of model 5 in the case of an interaction viz*edhi
2908   #No interaction
2909   
2910   
2911   #### + Analyses on imputed data ####
2912   
2913   #CHANGELOG ASJ: No missing data for mean_riskperception2_6, no model with imputation 
performed, 21-09-20.
2914   
2915   
2916   #### RESEARCH QUESTION 2: EFFECT OF HERDIMM ON OTHER OUTCOMES ####
2917   
2918   # Recall: Research question 2 (secondary): Across 4 vaccine-preventable diseases, does 
the herdimm 
2919   # intervention influence other outcomes (5C scale, emotions, trust, knowledge, 
behavioural 
2920   # intentions) compared to a control?
2921   
2922   # The same analysis as above will be done for the secondary outcomes: mean_C5, 
mean_emotions, 
2923   # sum_knowledge, and behavioural intentions. For trustinfo the same analysis will be 
done if the 
2924   # distribution has enough variance (2-way ANOVA). However, if it's not the case the 
variable will be
2925   # dichotomised into 1 to 4 (low trust) and 5 to 7 (high trust) and we will run a 
logistic 
2926   # regression.

2927   
2928   
2929   #### +++ Emotions ####
2930   
2931   options(contrasts=c("contr.sum", "contr.poly")) # CHANGELOG: The statement below is 
added to calculate properly the type III sum of squares with lm 2021-07-27
2932   
2933   #### + Model 1: Check for direct effects of factors without any covariates (Emotions) 
####
2934   mEmotions_1 <- lm(mean_emotion
~ viz * disease, data = datMain)
2935   Anova(mEmotions_1,type="III")
2936   summary(mEmotions_1)
2937   
2938   # Model 2: Check for direct effects of factors with adjustment for other covariates
2939   
2940   mEmotions_2 <-
2941   
lm(
2942   
mean_emotion
~ viz * disease +
2943   
mean_indivhorz +
2944   
mean_indivvertical +
2945   
mean_collhorz +
2946   
mean_collvertical +
2947   
bornincanada + #CHANGELOG ASJ: covariate list shortened 2021-08-04
2948   
language_1 +
2949   
language_2 +
2950   
Asian_group +
2951   
White_group +
2952   
disability_any +
2953   
genderidentity +
2954   
income +
2955   
edhi +
2956   
age,
2957   
data = datMain
2958   
)
2959   Anova(mEmotions_2, type = "III")
2960   summary(mEmotions_2)
2961   
2962   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other
2963   # covariates
2964   
2965   mEmotions_3 <-
2966   
lm(
2967   
mean_emotion
~
2968   
viz * disease * mean_indivhorz +
2969   
viz * disease * mean_indivvertical +
2970   
viz * disease * mean_collhorz +
2971   
viz * disease * mean_collvertical +
2972   
bornincanada + #CHANGELOG ASJ: covariate list shortened 2021-08-04
2973   
language_1 +
2974   
language_2 +
2975   
Asian_group +
2976   
White_group +
2977   
disability_any +
2978   
genderidentity +
2979   
income +
2980   
edhi +
2981   
age,
2982   
data = datMain
2983   
)
2984   Anova(mEmotions_3, type = "III")
2985   summary(mEmotions_3)
2986   
2987   # + Adding interaction for high and low education with herdimm vizsualization
2988   # CHANGELOG We have added 2 new models to check the interaction between
2989   # high and low education with herdimm vizualization 2021-07-26
2990   
2991   #### + Model 4: Check for interaction edhi*viz without any covariates (for Emotions) ####
2992   

2993   mEmotions_4 <- lm(mean_emotion
~ viz * disease + viz * edhi, data = datMain)
2994   Anova(mEmotions_4,type="III")
2995   summary(mEmotions_4)
2996   
2997   # Model 5: Check for interaction edhi*viz with covariates
2998   
2999   mEmotions_5 <-
3000   
lm(
3001   
mean_emotion
~ viz * disease +
3002   
viz * edhi +
3003   
mean_indivhorz +
3004   
mean_indivvertical +
3005   
mean_collhorz +
3006   
mean_collvertical +
3007   
bornincanada + #CHANGELOG ASJ: covariate list shortened 2021-08-04
3008   
language_1 +
3009   
language_2 +
3010   
Asian_group +
3011   
White_group +
3012   
disability_any +
3013   
genderidentity +
3014   
income +
3015   
age,
3016   
data = datMain
3017   
)
3018   Anova(mEmotions_5, type = "III")
3019   summary(mEmotions_5)
3020   
3021   
3022   #### + Validating assumptions ####
3023   
3024   # Check to see if the assumptions of the models are respected. If not, we will 
transform the
3025   # outcome.
3026   
3027   checkassumptions(mEmotions_1)
3028   checkassumptions(mEmotions_2)
3029   checkassumptions(mEmotions_3)
3030   checkassumptions(mEmotions_4)
3031   checkassumptions(mEmotions_5)
3032   
3033   
3034   #### + Interpretation (Emotions) ####
3035   
3036   # Interpretation of model 1 in the case of no interaction
3037   
3038   memory.size(max = TRUE)
3039   
3040   mEmotions_1_v <- emmeans(mEmotions_1,~viz)
3041   mEmotions_1_v
3042   plot(mEmotions_1_v)
3043   
3044   mEmotions_1_d <- emmeans(mEmotions_1,  ~ disease)
3045   mEmotions_1_d
3046   pairs(mEmotions_1_d) # Only do multiple comparisons if type 3 test is significant
3047   plot(mEmotions_1_d)
3048   
3049   
3050   # Interpretation of model 2 in the case of no interaction
3051   
3052   mEmotions_2_v <- emmeans(mEmotions_2,~viz)
3053   mEmotions_2_v
3054   plot(mEmotions_2_v)
3055   
3056   mEmotions_2_d <- emmeans(mEmotions_2,  ~ disease)
3057   mEmotions_2_d
3058   pairs(mEmotions_2_d) # Only do multiple comparisons if type 3 test is significant
3059   plot(mEmotions_2_d)
3060   

3061   
3062   
3063   # Interpretation of model 3 in the case of an interaction with moderator
3064   emmip(mEmotions_3, viz*disease ~ mean_collhorz, cov.reduce = range)
3065   
3066   # Interpretation of model 4 in the case of an interaction viz edhi
3067   # CHANGELOG We have added interpretation of model 4 2021-07-26
3068   
3069   mEmotions_4_ve <- emmeans(mEmotions_4,~viz|edhi)
3070   mEmotions_4_ve
3071   pairs(mEmotions_4_ve) # Only do multiple comparisons if type 3 test is significant
3072   plot(mEmotions_4_ve)
3073   
3074   mEmotions_4_ev <- emmeans(mEmotions_4,~edhi|viz)
3075   mEmotions_4_ev
3076   pairs(mEmotions_4_ev) # Only do multiple comparisons if type 3 test is significant
3077   plot(mEmotions_4_ev)
3078   
3079   # Interpretation of model 5 in the case of an interaction viz edhi
3080   # CHANGELOG We have added interpretation of model 5 2021-07-26
3081   
3082   mEmotions_5_ve <- emmeans(mEmotions_5,~viz|edhi)
3083   mEmotions_5_ve
3084   pairs(mEmotions_5_ve) # Only do multiple comparisons if type 3 test is significant
3085   plot(mEmotions_5_ve)
3086   
3087   mEmotions_5_ev <- emmeans(mEmotions_5,~edhi|viz)
3088   mEmotions_5_ev
3089   pairs(mEmotions_5_ev) # Only do multiple comparisons if type 3 test is significant
3090   plot(mEmotions_5_ev)
3091   
3092   
3093   # Now we run the models on imputed data. 
3094   
3095   #CHANGELOG ASJ: No missing data for mean_emotion, no model with imputation performed, 
21-09-20.
3096   
3097   
3098   #### +++ Knowledge ####
3099   #### + Model 1: Check for direct effects of factors without any covariates (Knowledge) 
####
3100   
3101   options(contrasts=c("contr.sum", "contr.poly")) # CHANGELOG: The statement below is 
added to calculate properly the type III sum of squares with lm 2021-07-27
3102   
3103   mKnowledge_1 <- lm(sum_knowledge
~ viz * disease, data = datMain)
3104   Anova(mKnowledge_1,type="III")
3105   summary(mKnowledge_1)
3106   
3107   # Model 2: Check for direct effects of factors with adjustment for other covariates
3108   
3109   mKnowledge_2 <-
3110   
lm(
3111   
sum_knowledge
~ viz * disease +
3112   
mean_indivhorz +
3113   
mean_indivvertical +
3114   
mean_collhorz +
3115   
mean_collvertical +
3116   
bornincanada + #CHANGELOG ASJ: covariate list shortened 2021-08-04
3117   
language_1 +
3118   
language_2 +
3119   
Asian_group +
3120   
White_group +
3121   
disability_any +
3122   
genderidentity +
3123   
income +
3124   
edhi +
3125   
age,
3126   
data = datMain

3127   
)
3128   Anova(mKnowledge_2, type = "III")
3129   summary(mKnowledge_2)
3130   
3131   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other
3132   # covariates
3133   
3134   mKnowledge_3 <-
3135   
lm(
3136   
sum_knowledge
~
3137   
viz * disease * mean_indivhorz +
3138   
viz * disease * mean_indivvertical +
3139   
viz * disease * mean_collhorz +
3140   
viz * disease * mean_collvertical +
3141   
bornincanada + #CHANGELOG ASJ: covariate list shortened 2021-08-04
3142   
language_1 +
3143   
language_2 +
3144   
Asian_group +
3145   
White_group +
3146   
disability_any +
3147   
genderidentity +
3148   
income +
3149   
edhi +
3150   
age,
3151   
data = datMain
3152   
)
3153   Anova(mKnowledge_3, type = "III")
3154   summary(mKnowledge_3)
3155   
3156   # + Adding interaction for high and low education with herdimm vizsualization
3157   # CHANGELOG We have added 2 new models to check the interaction between
3158   # high and low education with herdimm vizualization 2021-07-26
3159   
3160   #### + Model 4: Check for interaction viz*edhi without any covariates (for Knowledge) 
####
3161   
3162   mKnowledge_4 <- lm(sum_knowledge
~ viz * disease + viz * edhi, data = datMain)
3163   Anova(mKnowledge_4,type="III")
3164   summary(mKnowledge_4)
3165   
3166   # Model 5: Check for interaction disease*viz with covariates
3167   
3168   mKnowledge_5 <-
3169   
lm(
3170   
sum_knowledge
~ viz * disease +
3171   
viz * edhi +
3172   
mean_indivhorz +
3173   
mean_indivvertical +
3174   
mean_collhorz +
3175   
mean_collvertical +
3176   
bornincanada + #CHANGELOG ASJ: covariate list shortened 2021-08-04
3177   
language_1 +
3178   
language_2 +
3179   
Asian_group +
3180   
White_group +
3181   
disability_any +
3182   
genderidentity +
3183   
income +
3184   
age,
3185   
data = datMain
3186   
)
3187   Anova(mKnowledge_5, type = "III")
3188   summary(mKnowledge_5)
3189   
3190   
3191   #### + Validating assumptions ####
3192   
3193   # Check to see if the assumptions of the models are respected. If not, we will 

transform the
3194   # outcome.
3195   
3196   checkassumptions(mKnowledge_1)
3197   checkassumptions(mKnowledge_2)
3198   checkassumptions(mKnowledge_3)
3199   checkassumptions(mKnowledge_4)
3200   checkassumptions(mKnowledge_5)
3201   
3202   #### + Interpretation (Knowledge) ####
3203   
3204   # Interpretation of model 1 in the case of no interaction
3205   
3206   memory.size(max = TRUE)
3207   
3208   mKnowledge_1_v <- emmeans(mKnowledge_1,~viz)
3209   mKnowledge_1_v
3210   plot(mKnowledge_1_v)
3211   
3212   mKnowledge_1_d <- emmeans(mKnowledge_1,  ~ disease)
3213   mKnowledge_1_d
3214   pairs(mKnowledge_1_d) # Only do multiple comparisons if type 3 test is significant
3215   plot(mKnowledge_1_d)
3216   
3217   
3218   # Interpretation of model 2 in the case of an interaction
3219   
3220   mKnowledge_2_vd <- emmeans(mKnowledge_2,~viz|disease)
3221   mKnowledge_2_vd
3222   pairs(mKnowledge_2_vd) # Only do multiple comparisons if type 3 test is significant
3223   plot(mKnowledge_2_vd)
3224   
3225   mKnowledge_2_dv <- emmeans(mKnowledge_2,~disease|viz)
3226   mKnowledge_2_dv
3227   pairs(mKnowledge_2_dv) # Only do multiple comparisons if type 3 test is significant
3228   plot(mKnowledge_2_dv)
3229   
3230   mKnowledge_3_d
3231   pairs(mKnowledge_3_d) # Only do multiple comparisons if type 3 test is significant
3232   plot(mKnowledge_3_d)
3233   
3234   # Interpretation of model 3
3235   emmip(mKnowledge_3, viz ~ mean_indivvertical, cov.reduce = range)
3236   
3237   
3238   # Interpretation of model 4 in the case of an interaction viz edhi
3239   # CHANGELOG We have added interpretation of model 4 2021-07-26
3240   
3241   mKnowledge_4_ve <- emmeans(mKnowledge_4,~viz|edhi)
3242   mKnowledge_4_ve
3243   pairs(mKnowledge_4_ve) # Only do multiple comparisons if type 3 test is significant
3244   plot(mKnowledge_4_ve)
3245   
3246   mKnowledge_4_ev <- emmeans(mKnowledge_4,~edhi|viz)
3247   mKnowledge_4_ev
3248   pairs(mKnowledge_4_ev) # Only do multiple comparisons if type 3 test is significant
3249   plot(mKnowledge_4_ev)
3250   
3251   # Interpretation of model 5 in case of an interaction viz*edhi
3252   # CHANGELOG We have added interpretation of model 5 2021-07-26
3253   
3254   mKnowledge_5_ve <- emmeans(mKnowledge_5,~viz|edhi)
3255   mKnowledge_5_ve
3256   pairs(mKnowledge_5_ve) # Only do multiple comparisons if type 3 test is significant
3257   plot(mKnowledge_5_ve)
3258   
3259   mKnowledge_5_ev <- emmeans(mKnowledge_5,~edhi|viz)
3260   mKnowledge_5_ev
3261   pairs(mKnowledge_5_ev) # Only do multiple comparisons if type 3 test is significant

3262   plot(mKnowledge_5_ev)
3263   
3264   # Now we run the models on imputed data. 
3265   
3266   
3267   #CHANGELOG ASJ: No missing data for sum_knowledge, no model with imputation performed, 
21-09-20.
3268   
3269   
3270   #CHANGELOG ASJ: Add logistic regression models for dichotomous outcomes, 2021-08-05.
3271   
3272   
3273   
3274   #### +++ Logistic regression for RP1 ####
3275   
3276   #### + Model 1: Check for direct effects of factors without any covariates ####
3277   
3278   
3279   
3280   options(contrasts=c("contr.sum", "contr.poly"))
3281   rlog_RP1_1 <- glm(relevel(RP1_dicho,ref="Low")
~ viz * disease, data =
datMain,family=binomial("logit"))
3282   Anova(rlog_RP1_1,type="III")
3283   summary(rlog_RP1_1)
3284   
3285   # Interpretation of model 1
3286   mRP1_v <- emmeans(rlog_RP1_1,~viz,type = "response") #proportions
3287   mRP1_v
3288   plot(mRP1_v)
3289   confint(pairs(mRP1_v,reverse = TRUE)) #Odds ratios
3290   
3291   mRP1_d <- emmeans(rlog_RP1_1,  ~ disease, type = "response") #proportions
3292   mRP1_d
3293   plot(mRP1_d)
3294   confint(pairs(mRP1_d,reverse = TRUE)) #Odds ratios
3295   
3296   
3297   # Model 2: Check for direct effects of factors with adjustment for other covariates
3298   
3299   rlog_RP1_2 <-
3300   
glm(relevel(RP1_dicho,ref="Low")
~ viz * disease +
3301   
mean_indivhorz +
3302   
mean_indivvertical +
3303   
mean_collhorz +
3304   
mean_collvertical +
3305   
bornincanada +
3306   
language_1 +
3307   
language_2 +
3308   
Asian_group +
3309   
White_group +
3310   
disability_any +
3311   
genderidentity +
3312   
income +
3313   
edhi +
3314   
age,
3315   
data = datMain,family=binomial("logit")
3316   
)
3317   Anova(rlog_RP1_2, type = "III")
3318   summary(rlog_RP1_2)
3319   
3320   
3321   # Interpretation of model 2
3322   mRP1_2_v <- emmeans(rlog_RP1_2,~viz,type = "response")
3323   mRP1_2_v
3324   plot(mRP1_2_v)
3325   confint(pairs(mRP1_2_v,reverse = TRUE))
3326   
3327   mRP1_2_d <- emmeans(rlog_RP1_2,  ~ disease, type = "response")
3328   mRP1_2_d

3329   plot(mRP1_2_d)
3330   confint(pairs(mRP1_2_d,reverse = TRUE))
3331   
3332   
3333   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
3334   rlog_RP1_3 <-
3335   
glm(relevel(RP1_dicho,ref="Low")
~
3336   
viz * disease * mean_indivhorz +
3337   
viz * disease * mean_indivvertical +
3338   
viz * disease * mean_collhorz +
3339   
viz * disease * mean_collvertical +
3340   
bornincanada +
3341   
language_1 +
3342   
language_2 +
3343   
Asian_group +
3344   
White_group +
3345   
disability_any +
3346   
genderidentity +
3347   
income +
3348   
edhi +
3349   
age,
3350   
data = datMain,family=binomial("logit")
3351   
)
3352   Anova(rlog_RP1_3, type = "III")
3353   summary(rlog_RP1_3)
3354   
3355   ## Interpretation of model 3 : no interaction with moderator to interpret
3356   
3357   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
3358   
3359   rlog_RP1_4 <- glm(relevel(RP1_dicho,ref="Low")
~ viz * disease + viz * edhi, data =
datMain,family=binomial("logit"))
3360   Anova(rlog_RP1_4,type="III")
3361   summary(rlog_RP1_4)
3362   
3363   # Interpretation of model 4
3364   mRP1_4_v <- emmeans(rlog_RP1_4,~viz|edhi,type = "response")
3365   mRP1_4_v
3366   confint(pairs(mRP1_4_v,reverse = TRUE))
3367   pairs(mRP1_4_v,reverse = TRUE,type = "response")
3368   plot(mRP1_4_v)
3369   
3370   mRP1_4_e <- emmeans(rlog_RP1_4,  ~ edhi|viz, type = "response")
3371   mRP1_4_e
3372   confint(pairs(mRP1_4_e,reverse = TRUE))
3373   pairs(mRP1_4_e,reverse = TRUE, type = "reponse")
3374   plot(mRP1_4_e)
3375   
3376   
3377   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
3378   
3379   rlog_RP1_5 <-
3380   
glm(relevel(RP1_dicho,ref="Low")
~ viz * disease +
3381   
viz * edhi +
3382   
mean_indivhorz +
3383   
mean_indivvertical +
3384   
mean_collhorz +
3385   
mean_collvertical +
3386   
bornincanada +
3387   
language_1 +
3388   
language_2 +
3389   
Asian_group +
3390   
White_group +
3391   
disability_any +
3392   
genderidentity +
3393   
income +
3394   
age,
3395   
data = datMain,family=binomial("logit")

3396   
)
3397   Anova(rlog_RP1_5, type = "III")
3398   summary(rlog_RP1_5)
3399   
3400   # Interpretation of model 5
3401   mRP1_5_v <- emmeans(rlog_RP1_5,~viz|edhi,type = "response")
3402   mRP1_5_v
3403   confint(pairs(mRP1_5_v,reverse = TRUE))
3404   pairs(mRP1_5_v,reverse = TRUE,type = "response")
3405   plot(mRP1_5_v)
3406   
3407   mRP1_5_e <- emmeans(rlog_RP1_5,  ~ edhi|viz, type = "response")
3408   mRP1_5_e
3409   confint(pairs(mRP1_5_e,reverse = TRUE))
3410   pairs(mRP1_5_e,reverse = TRUE, type = "reponse")
3411   plot(mRP1_5_e)
3412   
3413   
3414   # Now we run the models on imputed data. 
3415   
3416   #### + Imputed Model 1: Check for direct effects of factors without any covariates ####
3417   
3418   imprlog_RP1_1 <-
3419   
with(data = datMainImputed,
3420   
exp = glm(relevel(RP1_dicho,ref="Low") ~ viz * disease,family =
binomial("logit")))
3421   combineimprlog_RP1_1 <- pool(imprlog_RP1_1)
3422   summary(combineimprlog_RP1_1)
3423   
3424   
3425   #### +++ Logistic regression for C19 vax intention ####
3426   
3427   #### + Model 1: Check for direct effects of factors without any covariates ####
3428   
3429   options(contrasts=c("contr.sum", "contr.poly"))
3430   rlog_c19vi_1 <- glm(relevel(c19vaxintent,ref="Low")
~ viz * disease, data =
datMain,family=binomial("logit"))
3431   Anova(rlog_c19vi_1,type="III")
3432   summary(rlog_c19vi_1)
3433   
3434   # Interpretation of model 1
3435   mc19vi_1_v <- emmeans(rlog_c19vi_1,~viz,type = "response") #proportions
3436   mc19vi_1_v
3437   plot(mc19vi_1_v)
3438   confint(pairs(mc19vi_1_v,reverse = TRUE)) #Odds ratios
3439   
3440   mc19vi_1_d <- emmeans(rlog_c19vi_1,  ~ disease, type = "response") #proportions
3441   mc19vi_1_d
3442   plot(mc19vi_1_d)
3443   confint(pairs(mc19vi_1_d,reverse = TRUE)) #Odds ratios
3444   
3445   # Model 2: Check for direct effects of factors with adjustment for other covariates
3446   
3447   rlog_c19vi_2 <-
3448   
glm(relevel(c19vaxintent,ref="Low")
~ viz * disease +
3449   
mean_indivhorz +
3450   
mean_indivvertical +
3451   
mean_collhorz +
3452   
mean_collvertical +
3453   
bornincanada +
3454   
language_1 +
3455   
language_2 +
3456   
Asian_group +
3457   
White_group +
3458   
disability_any +
3459   
genderidentity +
3460   
income +
3461   
edhi +
3462   
age,

3463   
data = datMain,family=binomial("logit")
3464   
)
3465   Anova(rlog_c19vi_2, type = "III")
3466   summary(rlog_c19vi_2)
3467   
3468   
3469   # Interpretation of model 2
3470   mc19vi_2_v <- emmeans(rlog_c19vi_2,~viz,type = "response")
3471   mc19vi_2_v
3472   plot(mc19vi_2_v)
3473   confint(pairs(mc19vi_2_v,reverse = TRUE))
3474   
3475   mc19vi_2_d <- emmeans(rlog_c19vi_2,  ~ disease, type = "response")
3476   mc19vi_2_d
3477   plot(mc19vi_2_d)
3478   confint(pairs(mc19vi_2_d,reverse = TRUE))
3479   
3480   
3481   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
3482   rlog_c19vi_3 <-
3483   
glm(relevel(c19vaxintent,ref="Low")
~
3484   
viz * disease * mean_indivhorz +
3485   
viz * disease * mean_indivvertical +
3486   
viz * disease * mean_collhorz +
3487   
viz * disease * mean_collvertical +
3488   
bornincanada +
3489   
language_1 +
3490   
language_2 +
3491   
Asian_group +
3492   
White_group +
3493   
disability_any +
3494   
genderidentity +
3495   
income +
3496   
edhi +
3497   
age,
3498   
data = datMain,family=binomial("logit")
3499   
)
3500   Anova(rlog_c19vi_3, type = "III")
3501   summary(rlog_c19vi_3)
3502   
3503   # Interpretation of model 3
3504   emmip(rlog_c19vi_3, viz ~ mean_collvertical, cov.reduce = range, type = "response")
3505   
3506   
3507   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
3508   
3509   rlog_c19vi_4 <- glm(relevel(c19vaxintent,ref="Low")
~ viz * disease + viz * edhi, 
data = datMain,family=binomial("logit"))
3510   Anova(rlog_c19vi_4,type="III")
3511   summary(rlog_c19vi_4)
3512   
3513   # Interpretation of model 4 (no significant interaction viz edhi)
3514   mc19vi_4_v <- emmeans(rlog_c19vi_4,~viz|edhi,type = "response")
3515   mc19vi_4_v
3516   confint(pairs(mc19vi_4_v,reverse = TRUE))
3517   plot(mc19vi_4_v)
3518   
3519   mc19vi_4_e <- emmeans(rlog_c19vi_4,  ~ edhi|viz, type = "response")
3520   mc19vi_4_e
3521   confint(pairs(mc19vi_4_e,reverse = TRUE))
3522   plot(mc19vi_4_e)
3523   
3524   
3525   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
3526   
3527   rlog_c19vi_5 <-
3528   
glm(relevel(c19vaxintent,ref="Low")
~ viz * disease +
3529   
viz * edhi +

3530   
mean_indivhorz +
3531   
mean_indivvertical +
3532   
mean_collhorz +
3533   
mean_collvertical +
3534   
bornincanada +
3535   
language_1 +
3536   
language_2 +
3537   
Asian_group +
3538   
White_group +
3539   
disability_any +
3540   
genderidentity +
3541   
income +
3542   
age,
3543   
data = datMain,family=binomial("logit")
3544   
)
3545   Anova(rlog_c19vi_5, type = "III")
3546   summary(rlog_c19vi_5)
3547   
3548   # Interpretation of model 5
3549   mc19vi_5_v <- emmeans(rlog_c19vi_5,~viz|edhi,type = "response")
3550   mc19vi_5_v
3551   confint(pairs(mc19vi_5_v,reverse = TRUE))
3552   plot(mc19vi_5_v)
3553   
3554   mc19vi_5_e <- emmeans(rlog_c19vi_5,  ~ edhi|viz, type = "response")
3555   mc19vi_5_e
3556   confint(pairs(mc19vi_5_e,reverse = TRUE))
3557   plot(mc19vi_5_e)
3558   
3559   
3560   # Now we run the models on imputed data. 
3561   
3562   #CHANGELOG ASJ: No imputation for c19vaxintention, since 51% missing values, 21-09-20.
3563   
3564   
3565   
3566   #### +++ Logistic regression for vax intention ####
3567   
3568   #In order for the pairs function to work properly, relevel function must be removed 
from the model.
3569   datMain$vaxintentRel<-relevel(datMain$vaxintent,ref="Low")
3570   
3571   #### + Model 1: Check for direct effects of factors without any covariates ####
3572   
3573   options(contrasts=c("contr.sum", "contr.poly"))
3574   rlog_vi_1 <- glm(vaxintentRel
~ viz * disease, data = datMain,family=binomial("logit"))
3575   Anova(rlog_vi_1,type="III")
3576   summary(rlog_vi_1)
3577   
3578   # Interpretation of model 1
3579   mvi_1_v <- emmeans(rlog_vi_1,~viz,type = "response") #proportions
3580   mvi_1_v
3581   plot(mvi_1_v)
3582   confint(pairs(mvi_1_v,reverse = TRUE)) #Odds ratios
3583   
3584   mvi_1_d <- emmeans(rlog_vi_1,  ~ disease, type = "response") #proportions
3585   mvi_1_d
3586   plot(mvi_1_d)
3587   pairs(mvi_1_d,reverse = TRUE,type = "response")
3588   confint(pairs(mvi_1_d,reverse = TRUE)) #Odds ratios
3589   
3590   # Model 2: Check for direct effects of factors with adjustment for other covariates
3591   
3592   rlog_vi_2 <-
3593   
glm(vaxintentRel
~ viz * disease +
3594   
mean_indivhorz +
3595   
mean_indivvertical +
3596   
mean_collhorz +
3597   
mean_collvertical +

3598   
bornincanada +
3599   
language_1 +
3600   
language_2 +
3601   
Asian_group +
3602   
White_group +
3603   
disability_any +
3604   
genderidentity +
3605   
income +
3606   
edhi +
3607   
age,
3608   
data = datMain,family=binomial("logit")
3609   
)
3610   Anova(rlog_vi_2, type = "III")
3611   summary(rlog_vi_2)
3612   
3613   
3614   # Interpretation of model 2
3615   mvi_2_v <- emmeans(rlog_vi_2,~viz,type = "response")
3616   mvi_2_v
3617   plot(mvi_2_v)
3618   confint(pairs(mvi_2_v,reverse = TRUE))
3619   
3620   mvi_2_d <- emmeans(rlog_vi_2,  ~ disease, type = "response")
3621   mvi_2_d
3622   plot(mvi_2_d)
3623   confint(pairs(mvi_2_d,reverse = TRUE))
3624   pairs(mvi_2_d,reverse=TRUE,type="response")
3625   
3626   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
3627   rlog_vi_3 <-
3628   
glm(vaxintentRel
~
3629   
viz * disease * mean_indivhorz +
3630   
viz * disease * mean_indivvertical +
3631   
viz * disease * mean_collhorz +
3632   
viz * disease * mean_collvertical +
3633   
bornincanada +
3634   
language_1 +
3635   
language_2 +
3636   
Asian_group +
3637   
White_group +
3638   
disability_any +
3639   
genderidentity +
3640   
income +
3641   
edhi +
3642   
age,
3643   
data = datMain,family=binomial("logit")
3644   
)
3645   Anova(rlog_vi_3, type = "III")
3646   summary(rlog_vi_3)
3647   
3648   # Interpretation of model 3
3649   emmip(rlog_vi_3, disease ~ mean_indivvertical, cov.reduce = range, type = "response")
3650   
3651   
3652   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
3653   
3654   rlog_vi_4 <- glm(vaxintentRel
~ viz * disease + viz * edhi, data =
datMain,family=binomial("logit"))
3655   Anova(rlog_vi_4,type="III")
3656   summary(rlog_vi_4)
3657   
3658   # Interpretation of model 4 (no significant interaction viz edhi)
3659   mvi_4_v <- emmeans(rlog_vi_4,~viz|edhi,type = "response")
3660   mvi_4_v
3661   confint(pairs(mvi_4_v,reverse = TRUE))
3662   plot(mvi_4_v)
3663   
3664   mvi_4_e <- emmeans(rlog_vi_4,  ~ edhi|viz, type = "response")

3665   mvi_4_e
3666   confint(pairs(mvi_4_e,reverse = TRUE))
3667   plot(mvi_4_e)
3668   
3669   
3670   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
3671   
3672   rlog_vi_5 <-
3673   
glm(vaxintentRel
~ viz * disease +
3674   
viz * edhi +
3675   
mean_indivhorz +
3676   
mean_indivvertical +
3677   
mean_collhorz +
3678   
mean_collvertical +
3679   
bornincanada +
3680   
language_1 +
3681   
language_2 +
3682   
Asian_group +
3683   
White_group +
3684   
disability_any +
3685   
genderidentity +
3686   
income +
3687   
age,
3688   
data = datMain,family=binomial("logit")
3689   
)
3690   Anova(rlog_vi_5, type = "III")
3691   summary(rlog_vi_5)
3692   
3693   # Interpretation of model 5 ( no significant interaction)
3694   mvi_5_v <- emmeans(rlog_vi_5,~viz|edhi,type = "response")
3695   mvi_5_v
3696   confint(pairs(mvi_5_v,reverse = TRUE))
3697   plot(mvi_5_v)
3698   
3699   mvi_5_e <- emmeans(rlog_vi_5,  ~ edhi|viz, type = "response")
3700   mvi_5_e
3701   confint(pairs(mvi_5_e,reverse = TRUE))
3702   plot(mvi_5_e)
3703   
3704   
3705   # Now we run the models on imputed data. 
3706   
3707   #### + Imputed Model 1: Check for direct effects of factors without any covariates ####
3708   
3709   imprlog_vi_1 <-
3710   
with(data = datMainImputed,
3711   
exp = glm(relevel(vaxintent,ref="Low") ~ viz * disease,family =
binomial("logit")))
3712   combineimprlog_vi_1 <- pool(imprlog_vi_1)
3713   summary(combineimprlog_vi_1)
3714   
3715   
3716   #### +++ Logistic regression for Trust info ####
3717   
3718   datMain$Htrustinfo<-relevel(datMain$Htrustinfo,ref="No")
3719   
3720   #### + Model 1: Check for direct effects of factors without any covariates ####
3721   
3722   options(contrasts=c("contr.sum", "contr.poly"))
3723   rlog_ti_1 <- glm(Htrustinfo
~ viz * disease, data = datMain,family=binomial("logit"))
3724   Anova(rlog_ti_1,type="III")
3725   summary(rlog_ti_1)
3726   
3727   # Interpretation of model 1
3728   mti_1_v <- emmeans(rlog_ti_1,~viz|disease,type = "response") #proportions
3729   mti_1_v
3730   plot(mti_1_v)
3731   confint(pairs(mti_1_v,reverse = TRUE)) #Odds ratios
3732   pairs(mti_1_v,reverse=TRUE, type = "response")

3733   
3734   mti_1_d <- emmeans(rlog_ti_1,  ~ disease|viz, type = "response") #proportions
3735   mti_1_d
3736   plot(mti_1_d)
3737   pairs(mti_1_d,reverse = TRUE,type = "response")
3738   confint(pairs(mti_1_d,reverse = TRUE)) #Odds ratios
3739   
3740   # Model 2: Check for direct effects of factors with adjustment for other covariates
3741   
3742   rlog_ti_2 <-
3743   
glm(Htrustinfo
~ viz * disease +
3744   
mean_indivhorz +
3745   
mean_indivvertical +
3746   
mean_collhorz +
3747   
mean_collvertical +
3748   
bornincanada +
3749   
language_1 +
3750   
language_2 +
3751   
Asian_group +
3752   
White_group +
3753   
disability_any +
3754   
genderidentity +
3755   
income +
3756   
edhi +
3757   
age,
3758   
data = datMain,family=binomial("logit")
3759   
)
3760   Anova(rlog_ti_2, type = "III")
3761   summary(rlog_ti_2)
3762   
3763   
3764   # Interpretation of model 2
3765   mti_2_v <- emmeans(rlog_ti_2,~viz|disease,type = "response")
3766   mti_2_v
3767   plot(mti_2_v)
3768   confint(pairs(mti_2_v,reverse = TRUE))
3769   pairs(mti_2_v,reverse=TRUE, type = "response")
3770   
3771   mti_2_d <- emmeans(rlog_ti_2,  ~ disease|viz, type = "response")
3772   mti_2_d
3773   plot(mti_2_d)
3774   confint(pairs(mti_2_d,reverse = TRUE))
3775   pairs(mti_2_d,reverse=TRUE,type="response")
3776   
3777   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
3778   rlog_ti_3 <-
3779   
glm(Htrustinfo
~
3780   
viz * disease * mean_indivhorz +
3781   
viz * disease * mean_indivvertical +
3782   
viz * disease * mean_collhorz +
3783   
viz * disease * mean_collvertical +
3784   
bornincanada +
3785   
language_1 +
3786   
language_2 +
3787   
Asian_group +
3788   
White_group +
3789   
disability_any +
3790   
genderidentity +
3791   
income +
3792   
edhi +
3793   
age,
3794   
data = datMain,family=binomial("logit")
3795   
)
3796   Anova(rlog_ti_3, type = "III")
3797   summary(rlog_ti_3)
3798   
3799   #No interaction with moderators
3800   

3801   
3802   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
3803   
3804   rlog_ti_4 <- glm(Htrustinfo
~ viz * disease + viz * edhi, data =
datMain,family=binomial("logit"))
3805   Anova(rlog_ti_4,type="III")
3806   summary(rlog_ti_4)
3807   
3808   # Interpretation of model 4 (no significant interaction viz edhi)
3809   mti_4_v <- emmeans(rlog_ti_4,~viz|edhi,type = "response")
3810   mti_4_v
3811   confint(pairs(mti_4_v,reverse = TRUE))
3812   plot(mti_4_v)
3813   
3814   mti_4_e <- emmeans(rlog_ti_4,  ~ edhi|viz, type = "response")
3815   confint(pairs(mti_4_e,reverse = TRUE))
3816   plot(mti_4_e)
3817   
3818   
3819   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
3820   
3821   rlog_ti_5 <-
3822   
glm(Htrustinfo
~ viz * disease +
3823   
viz * edhi +
3824   
mean_indivhorz +
3825   
mean_indivvertical +
3826   
mean_collhorz +
3827   
mean_collvertical +
3828   
bornincanada +
3829   
language_1 +
3830   
language_2 +
3831   
Asian_group +
3832   
White_group +
3833   
disability_any +
3834   
genderidentity +
3835   
income +
3836   
age,
3837   
data = datMain,family=binomial("logit")
3838   
)
3839   Anova(rlog_ti_5, type = "III")
3840   summary(rlog_ti_5)
3841   
3842   # Interpretation of model 5 ( no significant interaction)
3843   mti_5_v <- emmeans(rlog_ti_5,~viz|edhi,type = "response")
3844   mti_5_v
3845   confint(pairs(mti_5_v,reverse = TRUE))
3846   plot(mti_5_v)
3847   
3848   mti_5_e <- emmeans(rlog_ti_5,  ~ edhi|viz, type = "response")
3849   mti_5_e
3850   confint(pairs(mti_5_e,reverse = TRUE))
3851   plot(mti_5_e)
3852   
3853   
3854   # Now we run the models on imputed data. 
3855   
3856   #### + Imputed Model 1: Check for direct effects of factors without any covariates ####
3857   
3858   
3859   imprlog_ti_1 <-
3860   
with(data = datMainImputed,
3861   
exp = glm(relevel(Htrustinfo,ref="No") ~ viz * disease,family =
binomial("logit")))
3862   combineimprlog_ti_1 <- pool(imprlog_ti_1)
3863   summary(combineimprlog_ti_1)
3864   
3865   #### +++ Logistic regression for Mean C5 Confidence ####
3866   
3867   datMain$mean_C5_conf2<-relevel(as.factor(datMain$mean_C5_conf2),ref="0")

3868   
3869   #### + Model 1: Check for direct effects of factors without any covariates ####
3870   
3871   options(contrasts=c("contr.sum", "contr.poly"))
3872   rlog_c5conf_1 <- glm(mean_C5_conf2 ~ viz * disease, data =
datMain,family=binomial("logit"))
3873   Anova(rlog_c5conf_1,type="III")
3874   summary(rlog_c5conf_1)
3875   
3876   # Interpretation of model 1
3877   mc5conf_v <- emmeans(rlog_c5conf_1,~viz,type = "response") #proportions
3878   mc5conf_v
3879   plot(mc5conf_v)
3880   confint(pairs(mc5conf_v,reverse = TRUE)) #Odds ratios
3881   
3882   mc5conf_d <- emmeans(rlog_c5conf_1,  ~ disease, type = "response") #proportions
3883   mc5conf_d
3884   plot(mc5conf_d)
3885   confint(pairs(mc5conf_d,reverse = TRUE)) #Odds ratios
3886   
3887   
3888   # Model 2: Check for direct effects of factors with adjustment for other covariates
3889   
3890   rlog_c5conf_2 <-
3891   
glm(mean_C5_conf2
~ viz * disease +
3892   
mean_indivhorz +
3893   
mean_indivvertical +
3894   
mean_collhorz +
3895   
mean_collvertical +
3896   
bornincanada +
3897   
language_1 +
3898   
language_2 +
3899   
Asian_group +
3900   
White_group +
3901   
disability_any +
3902   
genderidentity +
3903   
income +
3904   
edhi +
3905   
age,
3906   
data = datMain,family=binomial("logit")
3907   
)
3908   Anova(rlog_c5conf_2, type = "III")
3909   summary(rlog_c5conf_2)
3910   
3911   
3912   # Interpretation of model 2
3913   mc5conf_2_v <- emmeans(rlog_c5conf_2,~viz,type = "response")
3914   mc5conf_2_v
3915   plot(mc5conf_2_v)
3916   confint(pairs(mc5conf_2_v,reverse = TRUE))
3917   
3918   mc5conf_2_d <- emmeans(rlog_c5conf_2,  ~ disease, type = "response")
3919   mc5conf_2_d
3920   plot(mc5conf_2_d)
3921   confint(pairs(mc5conf_2_d,reverse = TRUE))
3922   
3923   
3924   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
3925   rlog_c5conf_3 <-
3926   
glm(mean_C5_conf2 ~
3927   
viz * disease * mean_indivhorz +
3928   
viz * disease * mean_indivvertical +
3929   
viz * disease * mean_collhorz +
3930   
viz * disease * mean_collvertical +
3931   
bornincanada +
3932   
language_1 +
3933   
language_2 +
3934   
Asian_group +

3935   
White_group +
3936   
disability_any +
3937   
genderidentity +
3938   
income +
3939   
edhi +
3940   
age,
3941   
data = datMain,family=binomial("logit")
3942   
)
3943   Anova(rlog_c5conf_3, type = "III")
3944   summary(rlog_c5conf_3)
3945   
3946   ## Interpretation of model 3 
3947   emmip(rlog_c5conf_3, viz ~ mean_collvertical , cov.reduce = range, type = "response")
3948   
3949   
3950   
3951   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
3952   
3953   rlog_c5conf_4 <- glm(mean_C5_conf2
~ viz * disease + viz * edhi, data =
datMain,family=binomial("logit"))
3954   Anova(rlog_c5conf_4,type="III")
3955   summary(rlog_c5conf_4)
3956   
3957   # Interpretation of model 4
3958   mc5conf_4_v <- emmeans(rlog_c5conf_4,~viz|edhi,type = "response")
3959   mc5conf_4_v
3960   confint(pairs(mc5conf_4_v,reverse = TRUE))
3961   pairs(mc5conf_4_v,reverse = TRUE,type = "response")
3962   plot(mc5conf_4_v)
3963   
3964   mc5conf_4_e <- emmeans(rlog_c5conf_4,  ~ edhi|viz, type = "response")
3965   mc5conf_4_e
3966   confint(pairs(mc5conf_4_e,reverse = TRUE))
3967   pairs(mc5conf_4_e,reverse = TRUE, type = "reponse")
3968   plot(mc5conf_4_e)
3969   
3970   
3971   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
3972   
3973   rlog_c5conf_5 <-
3974   
glm(mean_C5_conf2
~ viz * disease +
3975   
viz * edhi +
3976   
mean_indivhorz +
3977   
mean_indivvertical +
3978   
mean_collhorz +
3979   
mean_collvertical +
3980   
bornincanada +
3981   
language_1 +
3982   
language_2 +
3983   
Asian_group +
3984   
White_group +
3985   
disability_any +
3986   
genderidentity +
3987   
income +
3988   
age,
3989   
data = datMain,family=binomial("logit")
3990   
)
3991   Anova(rlog_c5conf_5, type = "III")
3992   summary(rlog_c5conf_5)
3993   
3994   # Interpretation of model 5
3995   mc5conf_5_v <- emmeans(rlog_c5conf_5,~viz|edhi,type = "response")
3996   mc5conf_5_v
3997   confint(pairs(mc5conf_5_v,reverse = TRUE))
3998   pairs(mc5conf_5_v,reverse = TRUE,type = "response")
3999   plot(mc5conf_5_v)
4000   
4001   mc5conf_5_e <- emmeans(rlog_c5conf_5,  ~ edhi|viz, type = "response")
4002   mc5conf_5_e

4003   confint(pairs(mc5conf_5_e,reverse = TRUE))
4004   pairs(mc5conf_5_e,reverse = TRUE, type = "reponse")
4005   plot(mc5conf_5_e)
4006   
4007   
4008   # Now we run the models on imputed data. 
4009   #CHANGELOG ASJ: No missing data for mean_C5_conf2, no model with imputation performed, 
21-09-20.
4010   
4011   #### +++ Logistic regression for Mean C5 Complacency ####
4012   
4013   datMain$mean_C5_comp2<-relevel(as.factor(datMain$mean_C5_comp2),ref="0")
4014   
4015   #### + Model 1: Check for direct effects of factors without any covariates ####
4016   
4017   options(contrasts=c("contr.sum", "contr.poly"))
4018   rlog_c5comp_1 <- glm(mean_C5_comp2 ~ viz * disease, data =
datMain,family=binomial("logit"))
4019   Anova(rlog_c5comp_1,type="III")
4020   summary(rlog_c5comp_1)
4021   
4022   # Interpretation of model 1
4023   mc5comp_v <- emmeans(rlog_c5comp_1,~viz,type = "response") #proportions
4024   mc5comp_v
4025   plot(mc5comp_v)
4026   confint(pairs(mc5comp_v,reverse = TRUE)) #Odds ratios
4027   
4028   mc5comp_d <- emmeans(rlog_c5comp_1,  ~ disease, type = "response") #proportions
4029   mc5comp_d
4030   plot(mc5comp_d)
4031   confint(pairs(mc5comp_d,reverse = TRUE)) #Odds ratios
4032   
4033   
4034   # Model 2: Check for direct effects of factors with adjustment for other covariates
4035   
4036   rlog_c5comp_2 <-
4037   
glm(mean_C5_comp2
~ viz * disease +
4038   
mean_indivhorz +
4039   
mean_indivvertical +
4040   
mean_collhorz +
4041   
mean_collvertical +
4042   
bornincanada +
4043   
language_1 +
4044   
language_2 +
4045   
Asian_group +
4046   
White_group +
4047   
disability_any +
4048   
genderidentity +
4049   
income +
4050   
edhi +
4051   
age,
4052   
data = datMain,family=binomial("logit")
4053   
)
4054   Anova(rlog_c5comp_2, type = "III")
4055   summary(rlog_c5comp_2)
4056   
4057   
4058   # Interpretation of model 2
4059   mc5comp_2_v <- emmeans(rlog_c5comp_2,~viz,type = "response")
4060   mc5comp_2_v
4061   plot(mc5comp_2_v)
4062   confint(pairs(mc5comp_2_v,reverse = TRUE))
4063   
4064   mc5comp_2_d <- emmeans(rlog_c5comp_2,  ~ disease, type = "response")
4065   mc5comp_2_d
4066   plot(mc5comp_2_d)
4067   confint(pairs(mc5comp_2_d,reverse = TRUE))
4068   
4069   

4070   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
4071   rlog_c5comp_3 <-
4072   
glm(mean_C5_comp2 ~
4073   
viz * disease * mean_indivhorz +
4074   
viz * disease * mean_indivvertical +
4075   
viz * disease * mean_collhorz +
4076   
viz * disease * mean_collvertical +
4077   
bornincanada +
4078   
language_1 +
4079   
language_2 +
4080   
Asian_group +
4081   
White_group +
4082   
disability_any +
4083   
genderidentity +
4084   
income +
4085   
edhi +
4086   
age,
4087   
data = datMain,family=binomial("logit")
4088   
)
4089   Anova(rlog_c5comp_3, type = "III")
4090   summary(rlog_c5comp_3)
4091   
4092   ## Interpretation of model 3 : no moderating effect to interpret
4093   
4094   
4095   
4096   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
4097   
4098   rlog_c5comp_4 <- glm(mean_C5_comp2
~ viz * disease + viz * edhi, data =
datMain,family=binomial("logit"))
4099   Anova(rlog_c5comp_4,type="III")
4100   summary(rlog_c5comp_4)
4101   
4102   # Interpretation of model 4
4103   mc5comp_4_v <- emmeans(rlog_c5comp_4,~viz|edhi,type = "response")
4104   mc5comp_4_v
4105   confint(pairs(mc5comp_4_v,reverse = TRUE))
4106   pairs(mc5comp_4_v,reverse = TRUE,type = "response")
4107   plot(mc5comp_4_v)
4108   
4109   mc5comp_4_e <- emmeans(rlog_c5comp_4,  ~ edhi|viz, type = "response")
4110   mc5comp_4_e
4111   confint(pairs(mc5comp_4_e,reverse = TRUE))
4112   pairs(mc5comp_4_e,reverse = TRUE, type = "reponse")
4113   plot(mc5comp_4_e)
4114   
4115   
4116   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
4117   
4118   rlog_c5comp_5 <-
4119   
glm(mean_C5_comp2
~ viz * disease +
4120   
viz * edhi +
4121   
mean_indivhorz +
4122   
mean_indivvertical +
4123   
mean_collhorz +
4124   
mean_collvertical +
4125   
bornincanada +
4126   
language_1 +
4127   
language_2 +
4128   
Asian_group +
4129   
White_group +
4130   
disability_any +
4131   
genderidentity +
4132   
income +
4133   
age,
4134   
data = datMain,family=binomial("logit")
4135   
)
4136   Anova(rlog_c5comp_5, type = "III")

4137   summary(rlog_c5comp_5)
4138   
4139   # Interpretation of model 5
4140   mc5comp_5_v <- emmeans(rlog_c5comp_5,~viz|edhi,type = "response")
4141   mc5comp_5_v
4142   confint(pairs(mc5comp_5_v,reverse = TRUE))
4143   plot(mc5comp_5_v)
4144   
4145   mc5comp_5_e <- emmeans(rlog_c5comp_5,  ~ edhi|viz, type = "response")
4146   mc5comp_5_e
4147   confint(pairs(mc5comp_5_e,reverse = TRUE))
4148   plot(mc5comp_5_e)
4149   
4150   
4151   # Now we run the models on imputed data. 
4152   #CHANGELOG ASJ: No missing data for mean_C5_comp2, no model with imputation performed, 
21-09-20.
4153   
4154   
4155   
4156   
4157   #### +++ Logistic regression for Mean C5 Constraints ####
4158   
4159   datMain$mean_C5_cons2<-relevel(as.factor(datMain$mean_C5_cons2),ref="0")
4160   
4161   #### + Model 1: Check for direct effects of factors without any covariates ####
4162   
4163   options(contrasts=c("contr.sum", "contr.poly"))
4164   rlog_c5cons_1 <- glm(mean_C5_cons2 ~ viz * disease, data =
datMain,family=binomial("logit"))
4165   Anova(rlog_c5cons_1,type="III")
4166   summary(rlog_c5cons_1)
4167   
4168   # Interpretation of model 1
4169   mc5cons_v <- emmeans(rlog_c5cons_1,~viz,type = "response") #proportions
4170   mc5cons_v
4171   plot(mc5cons_v)
4172   confint(pairs(mc5cons_v,reverse = TRUE)) #Odds ratios
4173   
4174   mc5cons_d <- emmeans(rlog_c5cons_1,  ~ disease, type = "response") #proportions
4175   mc5cons_d
4176   plot(mc5cons_d)
4177   confint(pairs(mc5cons_d,reverse = TRUE)) #Odds ratios
4178   
4179   
4180   # Model 2: Check for direct effects of factors with adjustment for other covariates
4181   
4182   rlog_c5cons_2 <-
4183   
glm(mean_C5_cons2
~ viz * disease +
4184   
mean_indivhorz +
4185   
mean_indivvertical +
4186   
mean_collhorz +
4187   
mean_collvertical +
4188   
bornincanada +
4189   
language_1 +
4190   
language_2 +
4191   
Asian_group +
4192   
White_group +
4193   
disability_any +
4194   
genderidentity +
4195   
income +
4196   
edhi +
4197   
age,
4198   
data = datMain,family=binomial("logit")
4199   
)
4200   Anova(rlog_c5cons_2, type = "III")
4201   summary(rlog_c5cons_2)
4202   
4203   

4204   # Interpretation of model 2
4205   mc5cons_2_v <- emmeans(rlog_c5cons_2,~viz,type = "response")
4206   mc5cons_2_v
4207   plot(mc5cons_2_v)
4208   confint(pairs(mc5cons_2_v,reverse = TRUE))
4209   
4210   mc5cons_2_d <- emmeans(rlog_c5cons_2,  ~ disease, type = "response")
4211   mc5cons_2_d
4212   plot(mc5cons_2_d)
4213   confint(pairs(mc5cons_2_d,reverse = TRUE))
4214   
4215   
4216   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
4217   rlog_c5cons_3 <-
4218   
glm(mean_C5_cons2 ~
4219   
viz * disease * mean_indivhorz +
4220   
viz * disease * mean_indivvertical +
4221   
viz * disease * mean_collhorz +
4222   
viz * disease * mean_collvertical +
4223   
bornincanada +
4224   
language_1 +
4225   
language_2 +
4226   
Asian_group +
4227   
White_group +
4228   
disability_any +
4229   
genderidentity +
4230   
income +
4231   
edhi +
4232   
age,
4233   
data = datMain,family=binomial("logit")
4234   
)
4235   Anova(rlog_c5cons_3, type = "III")
4236   summary(rlog_c5cons_3)
4237   
4238   ## Interpretation of model 3 
4239   emmip(rlog_c5cons_3, viz ~ mean_indivvertical , cov.reduce = range, type = "response")
4240   
4241   
4242   
4243   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
4244   
4245   rlog_c5cons_4 <- glm(mean_C5_cons2
~ viz * disease + viz * edhi, data =
datMain,family=binomial("logit"))
4246   Anova(rlog_c5cons_4,type="III")
4247   summary(rlog_c5cons_4)
4248   
4249   # Interpretation of model 4
4250   mc5cons_4_v <- emmeans(rlog_c5cons_4,~viz|edhi,type = "response")
4251   mc5cons_4_v
4252   confint(pairs(mc5cons_4_v,reverse = TRUE))
4253   pairs(mc5cons_4_v,reverse = TRUE,type = "response")
4254   plot(mc5cons_4_v)
4255   
4256   mc5cons_4_e <- emmeans(rlog_c5cons_4,  ~ edhi|viz, type = "response")
4257   mc5cons_4_e
4258   confint(pairs(mc5cons_4_e,reverse = TRUE))
4259   pairs(mc5cons_4_e,reverse = TRUE, type = "reponse")
4260   plot(mc5cons_4_e)
4261   
4262   
4263   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
4264   
4265   rlog_c5cons_5 <-
4266   
glm(mean_C5_cons2
~ viz * disease +
4267   
viz * edhi +
4268   
mean_indivhorz +
4269   
mean_indivvertical +
4270   
mean_collhorz +

4271   
mean_collvertical +
4272   
bornincanada +
4273   
language_1 +
4274   
language_2 +
4275   
Asian_group +
4276   
White_group +
4277   
disability_any +
4278   
genderidentity +
4279   
income +
4280   
age,
4281   
data = datMain,family=binomial("logit")
4282   
)
4283   Anova(rlog_c5cons_5, type = "III")
4284   summary(rlog_c5cons_5)
4285   
4286   # Interpretation of model 5
4287   mc5cons_5_v <- emmeans(rlog_c5cons_5,~viz|edhi,type = "response")
4288   mc5cons_5_v
4289   confint(pairs(mc5cons_5_v,reverse = TRUE))
4290   pairs(mc5cons_5_v,reverse = TRUE,type = "response")
4291   plot(mc5cons_5_v)
4292   
4293   mc5cons_5_e <- emmeans(rlog_c5cons_5,  ~ edhi|viz, type = "response")
4294   mc5cons_5_e
4295   confint(pairs(mc5cons_5_e,reverse = TRUE))
4296   pairs(mc5cons_5_e,reverse = TRUE, type = "reponse")
4297   plot(mc5cons_5_e)
4298   
4299   
4300   # Now we run the models on imputed data. 
4301   #CHANGELOG ASJ: No missing data for mean_C5_cons2, no model with imputation performed, 
21-09-20.
4302   
4303   
4304   
4305   #### +++ Logistic regression for Mean C5 Calculation ####
4306   
4307   datMain$mean_C5_calc2<-relevel(as.factor(datMain$mean_C5_calc2),ref="0")
4308   
4309   #### + Model 1: Check for direct effects of factors without any covariates ####
4310   
4311   options(contrasts=c("contr.sum", "contr.poly"))
4312   rlog_c5calc_1 <- glm(mean_C5_calc2 ~ viz * disease, data =
datMain,family=binomial("logit"))
4313   Anova(rlog_c5calc_1,type="III")
4314   summary(rlog_c5calc_1)
4315   
4316   # Interpretation of model 1
4317   mc5calc_v <- emmeans(rlog_c5calc_1,~viz,type = "response") #proportions
4318   mc5calc_v
4319   plot(mc5calc_v)
4320   confint(pairs(mc5calc_v,reverse = TRUE)) #Odds ratios
4321   
4322   mc5calc_d <- emmeans(rlog_c5calc_1,  ~ disease, type = "response") #proportions
4323   mc5calc_d
4324   plot(mc5calc_d)
4325   confint(pairs(mc5calc_d,reverse = TRUE)) #Odds ratios
4326   
4327   
4328   # Model 2: Check for direct effects of factors with adjustment for other covariates
4329   
4330   rlog_c5calc_2 <-
4331   
glm(mean_C5_calc2
~ viz * disease +
4332   
mean_indivhorz +
4333   
mean_indivvertical +
4334   
mean_collhorz +
4335   
mean_collvertical +
4336   
bornincanada +
4337   
language_1 +

4338   
language_2 +
4339   
Asian_group +
4340   
White_group +
4341   
disability_any +
4342   
genderidentity +
4343   
income +
4344   
edhi +
4345   
age,
4346   
data = datMain,family=binomial("logit")
4347   
)
4348   Anova(rlog_c5calc_2, type = "III")
4349   summary(rlog_c5calc_2)
4350   
4351   
4352   # Interpretation of model 2
4353   mc5calc_2_v <- emmeans(rlog_c5calc_2,~viz,type = "response")
4354   mc5calc_2_v
4355   plot(mc5calc_2_v)
4356   confint(pairs(mc5calc_2_v,reverse = TRUE))
4357   
4358   mc5calc_2_d <- emmeans(rlog_c5calc_2,  ~ disease, type = "response")
4359   mc5calc_2_d
4360   plot(mc5calc_2_d)
4361   confint(pairs(mc5calc_2_d,reverse = TRUE))
4362   
4363   
4364   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
4365   rlog_c5calc_3 <-
4366   
glm(mean_C5_calc2 ~
4367   
viz * disease * mean_indivhorz +
4368   
viz * disease * mean_indivvertical +
4369   
viz * disease * mean_collhorz +
4370   
viz * disease * mean_collvertical +
4371   
bornincanada +
4372   
language_1 +
4373   
language_2 +
4374   
Asian_group +
4375   
White_group +
4376   
disability_any +
4377   
genderidentity +
4378   
income +
4379   
edhi +
4380   
age,
4381   
data = datMain,family=binomial("logit")
4382   
)
4383   Anova(rlog_c5calc_3, type = "III")
4384   summary(rlog_c5calc_3)
4385   
4386   ## Interpretation of model 3 : no moderation effect to interpret
4387   
4388   
4389   
4390   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
4391   
4392   rlog_c5calc_4 <- glm(mean_C5_calc2
~ viz * disease + viz * edhi, data =
datMain,family=binomial("logit"))
4393   Anova(rlog_c5calc_4,type="III")
4394   summary(rlog_c5calc_4)
4395   
4396   # Interpretation of model 4
4397   mc5calc_4_v <- emmeans(rlog_c5calc_4,~viz|edhi,type = "response")
4398   mc5calc_4_v
4399   confint(pairs(mc5calc_4_v,reverse = TRUE))
4400   plot(mc5calc_4_v)
4401   
4402   mc5calc_4_e <- emmeans(rlog_c5calc_4,  ~ edhi|viz, type = "response")
4403   mc5calc_4_e
4404   confint(pairs(mc5calc_4_e,reverse = TRUE))

4405   plot(mc5calc_4_e)
4406   
4407   
4408   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
4409   
4410   rlog_c5calc_5 <-
4411   
glm(mean_C5_calc2
~ viz * disease +
4412   
viz * edhi +
4413   
mean_indivhorz +
4414   
mean_indivvertical +
4415   
mean_collhorz +
4416   
mean_collvertical +
4417   
bornincanada +
4418   
language_1 +
4419   
language_2 +
4420   
Asian_group +
4421   
White_group +
4422   
disability_any +
4423   
genderidentity +
4424   
income +
4425   
age,
4426   
data = datMain,family=binomial("logit")
4427   
)
4428   Anova(rlog_c5calc_5, type = "III")
4429   summary(rlog_c5calc_5)
4430   
4431   # Interpretation of model 5
4432   mc5calc_5_v <- emmeans(rlog_c5calc_5,~viz|edhi,type = "response")
4433   mc5calc_5_v
4434   confint(pairs(mc5calc_5_v,reverse = TRUE))
4435   plot(mc5calc_5_v)
4436   
4437   mc5calc_5_e <- emmeans(rlog_c5calc_5,  ~ edhi|viz, type = "response")
4438   mc5calc_5_e
4439   confint(pairs(mc5calc_5_e,reverse = TRUE))
4440   plot(mc5calc_5_e)
4441   
4442   
4443   # Now we run the models on imputed data. 
4444   #CHANGELOG ASJ: No missing data for mean_C5_calc2, no model with imputation performed, 
21-09-20.
4445   
4446   
4447   
4448   #### +++ Logistic regression for Mean C5 Collective Response ####
4449   
4450   datMain$mean_C5_coll2<-relevel(as.factor(datMain$mean_C5_coll2),ref="0")
4451   
4452   #### + Model 1: Check for direct effects of factors without any covariates ####
4453   
4454   options(contrasts=c("contr.sum", "contr.poly"))
4455   rlog_c5coll_1 <- glm(mean_C5_coll2 ~ viz * disease, data =
datMain,family=binomial("logit"))
4456   Anova(rlog_c5coll_1,type="III")
4457   summary(rlog_c5coll_1)
4458   
4459   # Interpretation of model 1
4460   mc5coll_v <- emmeans(rlog_c5coll_1,~viz,type = "response") #proportions
4461   mc5coll_v
4462   plot(mc5coll_v)
4463   confint(pairs(mc5coll_v,reverse = TRUE)) #Odds ratios
4464   
4465   mc5coll_d <- emmeans(rlog_c5coll_1,  ~ disease, type = "response") #proportions
4466   mc5coll_d
4467   plot(mc5coll_d)
4468   confint(pairs(mc5coll_d,reverse = TRUE)) #Odds ratios
4469   
4470   
4471   # Model 2: Check for direct effects of factors with adjustment for other covariates

4472   
4473   rlog_c5coll_2 <-
4474   
glm(mean_C5_coll2
~ viz * disease +
4475   
mean_indivhorz +
4476   
mean_indivvertical +
4477   
mean_collhorz +
4478   
mean_collvertical +
4479   
bornincanada +
4480   
language_1 +
4481   
language_2 +
4482   
Asian_group +
4483   
White_group +
4484   
disability_any +
4485   
genderidentity +
4486   
income +
4487   
edhi +
4488   
age,
4489   
data = datMain,family=binomial("logit")
4490   
)
4491   Anova(rlog_c5coll_2, type = "III")
4492   summary(rlog_c5coll_2)
4493   
4494   
4495   # Interpretation of model 2
4496   mc5coll_2_v <- emmeans(rlog_c5coll_2,~viz,type = "response")
4497   mc5coll_2_v
4498   plot(mc5coll_2_v)
4499   confint(pairs(mc5coll_2_v,reverse = TRUE))
4500   
4501   mc5coll_2_d <- emmeans(rlog_c5coll_2,  ~ disease, type = "response")
4502   mc5coll_2_d
4503   pairs(mc5coll_2_d,reverse = TRUE)
4504   plot(mc5coll_2_d)
4505   confint(pairs(mc5coll_2_d,reverse = TRUE))
4506   
4507   
4508   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
4509   rlog_c5coll_3 <-
4510   
glm(mean_C5_coll2 ~
4511   
viz * disease * mean_indivhorz +
4512   
viz * disease * mean_indivvertical +
4513   
viz * disease * mean_collhorz +
4514   
viz * disease * mean_collvertical +
4515   
bornincanada +
4516   
language_1 +
4517   
language_2 +
4518   
Asian_group +
4519   
White_group +
4520   
disability_any +
4521   
genderidentity +
4522   
income +
4523   
edhi +
4524   
age,
4525   
data = datMain,family=binomial("logit")
4526   
)
4527   Anova(rlog_c5coll_3, type = "III")
4528   summary(rlog_c5coll_3)
4529   
4530   ## Interpretation of model 3 
4531   emmip(rlog_c5coll_3, viz ~ mean_indivvertical , cov.reduce = range, type = "response")
4532   emmip(rlog_c5coll_3, viz ~ mean_collhorz , cov.reduce = range, type = "response")
4533   
4534   
4535   
4536   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
4537   
4538   rlog_c5coll_4 <- glm(mean_C5_coll2
~ viz * disease + viz * edhi, data =
datMain,family=binomial("logit"))

4539   Anova(rlog_c5coll_4,type="III")
4540   summary(rlog_c5coll_4)
4541   
4542   # Interpretation of model 4
4543   mc5coll_4_v <- emmeans(rlog_c5coll_4,~viz|edhi,type = "response")
4544   mc5coll_4_v
4545   confint(pairs(mc5coll_4_v,reverse = TRUE))
4546   plot(mc5coll_4_v)
4547   
4548   mc5coll_4_e <- emmeans(rlog_c5coll_4,  ~ edhi|viz, type = "response")
4549   mc5coll_4_e
4550   confint(pairs(mc5coll_4_e,reverse = TRUE))
4551   plot(mc5coll_4_e)
4552   
4553   
4554   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
4555   
4556   rlog_c5coll_5 <-
4557   
glm(mean_C5_coll2
~ viz * disease +
4558   
viz * edhi +
4559   
mean_indivhorz +
4560   
mean_indivvertical +
4561   
mean_collhorz +
4562   
mean_collvertical +
4563   
bornincanada +
4564   
language_1 +
4565   
language_2 +
4566   
Asian_group +
4567   
White_group +
4568   
disability_any +
4569   
genderidentity +
4570   
income +
4571   
age,
4572   
data = datMain,family=binomial("logit")
4573   
)
4574   Anova(rlog_c5coll_5, type = "III")
4575   summary(rlog_c5coll_5)
4576   
4577   # Interpretation of model 5
4578   mc5coll_5_v <- emmeans(rlog_c5coll_5,~viz|edhi,type = "response")
4579   mc5coll_5_v
4580   confint(pairs(mc5coll_5_v,reverse = TRUE))
4581   plot(mc5coll_5_v)
4582   
4583   mc5coll_5_e <- emmeans(rlog_c5coll_5,  ~ edhi|viz, type = "response")
4584   mc5coll_5_e
4585   confint(pairs(mc5coll_5_e,reverse = TRUE))
4586   plot(mc5coll_5_e)
4587   
4588   
4589   # Now we run the models on imputed data. 
4590   #CHANGELOG ASJ: No missing data for mean_C5_coll2, no model with imputation performed, 
21-09-20.
4591   
4592   
4593   
4594   #### RESEARCH QUESTION 3: EXISTING INTERVENTIONS VS HERDIMM ####
4595   
4596   # Recall: Research question 3 (secondary): For any of the 4 diseases, do existing 
interventions 
4597   # already available online outperform the herdimm intervention?
4598   
4599   # 1-way ANOVA (adjusted for covariates and with moderators)
4600   
4601   # Here, we test to see if there is an existing intervention to convey the concept of 
herd immunity 
4602   # that outperforms our intervention. Because the existing interventions each only 
represent one
4603   # disease whereas ours was built to explicitly represent to the epidemiology of 

different infectious
4604   # diseases, we do this by comparing relevant study arms for one disease at a time. 
These models are
4605   # therefore similar to our models for two-way analyses, but disease*viz collapses into 
a single
4606   # variable (study arm).
4607   
4608   #### +++ ONE WAY ANOVA FOR RISK PERCEPTION 2-6 ####
4609   #### + Generic ####
4610   
4611   #CHANGELOG ASJ: Mean risk perception replaced by MRP2_6 in the rest of the section, 
2021-08-05.
4612   
4613   # Model 1: Check for direct effects of factors without any covariates
4614   options(contrasts=c("contr.sum", "contr.poly")) # CHANGELOG: Added to calculate 
properly the type III sum of squares with lm 2021-07-27
4615   mG_RP1 <- lm(mean_riskperception2_6 ~ studyarm, data=datGeneric)
4616   Anova(mG_RP1,type="III")
4617   summary(mG_RP1)
4618   
4619   # Model 2: Check for direct effects of factors with adjustment for other covariates
4620   mG_RP2 <-
4621   
lm(
4622   
mean_riskperception2_6 ~
4623   
studyarm +
4624   
mean_indivhorz +
4625   
mean_indivvertical +
4626   
mean_collhorz +
4627   
mean_collvertical +
4628   
bornincanada +
#CHANGELOG ASJ: covariate list shortened 2021-08-04
4629   
language_1 +
4630   
language_2 +
4631   
Asian_group +
4632   
White_group +
4633   
disability_any +
4634   
genderidentity +
4635   
income +
4636   
edhi +
4637   
age,
4638   
data = datGeneric
4639   
)
4640   Anova(mG_RP2,type="III")
4641   summary(mG_RP2)
4642   
4643   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
4644   mG_RP3 <-
4645   
lm(
4646   
mean_riskperception2_6 ~
4647   
studyarm * mean_indivhorz +
4648   
studyarm * mean_indivvertical +
4649   
studyarm * mean_collhorz +
4650   
studyarm * mean_collvertical +
4651   
bornincanada +
#CHANGELOG ASJ: covariate list shortened 2021-08-04
4652   
language_1 +
4653   
language_2 +
4654   
Asian_group +
4655   
White_group +
4656   
disability_any +
4657   
genderidentity +
4658   
income +
4659   
edhi +
4660   
age,
4661   
data = datGeneric
4662   
)
4663   Anova(mG_RP3,type="III")
4664   summary(mG_RP3)
4665   
4666   # CHANGELOG: Model 4 + 5 : To check the interaction between the study arm and education

4667   # Model 4: Check for interaction studyarm*edhi 
4668   mG_RP4 <- lm(mean_riskperception2_6 ~ studyarm*edhi, data=datGeneric)
4669   Anova(mG_RP4,type="III")
4670   summary(mG_RP4)
4671   
4672   # Model 5: Check for interaction studyarm*edhi with adjustment for other covariates
4673   mG_RP5 <- lm(mean_riskperception2_6 ~ studyarm*edhi +
4674   
mean_indivhorz +
4675   
mean_indivvertical +
4676   
mean_collhorz +
4677   
mean_collvertical +
4678   
bornincanada +
4679   
language_1 +
4680   
language_2 +
4681   
Asian_group +
4682   
White_group +
4683   
disability_any +
4684   
genderidentity +
4685   
income +
4686   
age, data=datGeneric)
4687   Anova(mG_RP5,type="III")
4688   summary(mG_RP5)
4689   
4690   #### ++ Validating assumptions ####
4691   
4692   # Check to see if the assumptions of the models are respected. If not, we will 
transform the
4693   # outcome.
4694   
4695   checkassumptions(mG_RP1)
4696   checkassumptions(mG_RP2)
4697   checkassumptions(mG_RP3)
4698   checkassumptions(mG_RP4)
4699   checkassumptions(mG_RP5)
4700   
4701   #### ++ Interpretation ####
4702   
4703   mG_RP1_arm <- emmeans(mG_RP1,~studyarm)
4704   mG_RP1_arm
4705   pairs(mG_RP1_arm)
4706   plot(mG_RP1_arm)
4707   
4708   mG_RP2_arm <- emmeans(mG_RP2,~studyarm)
4709   mG_RP2_arm
4710   pairs(mG_RP2_arm)
4711   plot(mG_RP2_arm)
4712   
4713   emmip(mG_RP3, studyarm ~ mean_indivhorz, cov.reduce = range)
4714   emmip(mG_RP3, studyarm ~ mean_indivvertical, cov.reduce = range)
4715   emmip(mG_RP3, studyarm ~ mean_collvertical, cov.reduce = range)
4716   
4717   mG_RP4_v <- emmeans(mG_RP4,~studyarm|edhi)
4718   mG_RP4_v
4719   pairs(mG_RP4_v)
4720   mG_RP4_e <- emmeans(mG_RP4,~edhi|studyarm)
4721   mG_RP4_e
4722   pairs(mG_RP4_e)
4723   
4724   emmeans(mG_RP5,~studyarm|edhi)
4725   
4726   
4727   
4728   
4729   # Now running models on imputed data.
4730   #CHANGELOG ASJ: No missing data for mean_riskperception2_6, no model with imputation 
performed, 21-09-20.
4731   
4732   
4733   #### + Measles ####

4734   
4735   # Model 1: Check for direct effects of factors without any covariates
4736   mM_RP26_1 <- lm(mean_riskperception2_6 ~ studyarm, data=datMeasles)
4737   Anova(mM_RP26_1,type="III")
4738   summary(mM_RP26_1)
4739   
4740   # Model 2: Check for direct effects of factors with adjustment for other covariates
4741   mM_RP26_2 <-
4742   
lm(
4743   
mean_riskperception2_6 ~
4744   
studyarm +
4745   
mean_indivhorz +
4746   
mean_indivvertical +
4747   
mean_collhorz +
4748   
mean_collvertical +
4749   
bornincanada +
#CHANGELOG ASJ: covariate list shortened 2021-08-04
4750   
language_1 +
4751   
language_2 +
4752   
Asian_group +
4753   
White_group +
4754   
disability_any +
4755   
genderidentity +
4756   
income +
4757   
edhi +
4758   
age,
4759   
data = datMeasles
4760   
)
4761   Anova(mM_RP26_2,type="III")
4762   summary(mM_RP26_2)
4763   
4764   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
4765   mM_RP26_3 <-
4766   
lm(
4767   
mean_riskperception2_6 ~
4768   
studyarm * mean_indivhorz +
4769   
studyarm * mean_indivvertical +
4770   
studyarm * mean_collhorz +
4771   
studyarm * mean_collvertical +
4772   
bornincanada +
#CHANGELOG ASJ: covariate list shortened 2021-08-04
4773   
language_1 +
4774   
language_2 +
4775   
Asian_group +
4776   
White_group +
4777   
disability_any +
4778   
genderidentity +
4779   
income +
4780   
edhi +
4781   
age,
4782   
data = datMeasles
4783   
)
4784   Anova(mM_RP26_3,type="III")
4785   summary(mM_RP26_3)
4786   
4787   # CHANGELOG: Model 4 + 5 : To check the interaction between the study arm and education
4788   # Model 4: Check for interaction studyarm*edhi 
4789   mM_RP26_4 <- lm(mean_riskperception2_6 ~ studyarm*edhi, data=datMeasles)
4790   Anova(mM_RP26_4,type="III")
4791   summary(mM_RP26_4)
4792   
4793   # Model 5: Check for interaction studyarm*edhi with adjustment for other covariates
4794   mM_RP26_5 <- lm(mean_riskperception2_6 ~ studyarm*edhi +
4795   
mean_indivhorz +
4796   
mean_indivvertical +
4797   
mean_collhorz +
4798   
mean_collvertical +
4799   
bornincanada +
4800   
language_1 +
4801   
language_2 +

4802   
Asian_group +
4803   
White_group +
4804   
disability_any +
4805   
genderidentity +
4806   
income +
4807   
age, data=datMeasles)
4808   Anova(mM_RP26_5,type="III")
4809   summary(mM_RP26_5)
4810   
4811   #### ++ Validating assumptions ####
4812   
4813   # Check to see if the assumptions of the models are respected. If not, we will 
transform the
4814   # outcome.
4815   
4816   checkassumptions(mM_RP26_1)
4817   checkassumptions(mM_RP26_2)
4818   checkassumptions(mM_RP26_3)
4819   checkassumptions(mM_RP26_4)
4820   checkassumptions(mM_RP26_5)
4821   
4822   #### ++ Interpretation ####
4823   #CHANGELOG ASJ: adapt relevant functions depending on results of global tests, 
2021-08-11.
4824   mM_RP26_1_arm <- emmeans(mM_RP26_1,~studyarm)
4825   mM_RP26_1_arm
4826   pairs(mM_RP26_1_arm)
4827   
4828   emmeans(mM_RP26_2,~studyarm)
4829   
4830   emmip(mM_RP26_3, studyarm ~ mean_indivvertical, cov.reduce = range)
4831   
4832   emmeans(mM_RP26_4,~studyarm|edhi)
4833   
4834   emmeans(mM_RP26_5,~studyarm|edhi)
4835   
4836   
4837   
4838   # Now running models on imputed data.
4839   #CHANGELOG ASJ: No missing data for mean_riskperception2_6, no model with imputation 
performed, 21-09-20.
4840   
4841   
4842   
4843   #### + Flu ####
4844   
4845   # Model 1: Check for direct effects of factors without any covariates
4846   mF_RP26_1 <- lm(mean_riskperception2_6 ~ studyarm, data=datFlu)
4847   Anova(mF_RP26_1,type="III")
4848   summary(mF_RP26_1)
4849   
4850   # Model 2: Check for direct effects of factors with adjustment for other covariates
4851   mF_RP26_2 <-
4852   
lm(
4853   
mean_riskperception2_6 ~
4854   
studyarm +
4855   
mean_indivhorz +
4856   
mean_indivvertical +
4857   
mean_collhorz +
4858   
mean_collvertical +
4859   
bornincanada +
#CHANGELOG ASJ: covariate list shortened 2021-08-04
4860   
language_1 +
4861   
language_2 +
4862   
Asian_group +
4863   
White_group +
4864   
disability_any +
4865   
genderidentity +
4866   
income +
4867   
edhi +

4868   
age,
4869   
data = datFlu
4870   
)
4871   Anova(mF_RP26_2,type="III")
4872   summary(mF_RP26_2)
4873   
4874   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
4875   mF_RP26_3 <-
4876   
lm(
4877   
mean_riskperception2_6 ~
4878   
studyarm * mean_indivhorz +
4879   
studyarm * mean_indivvertical +
4880   
studyarm * mean_collhorz +
4881   
studyarm * mean_collvertical +
4882   
bornincanada + #CHANGELOG ASJ: covariate list shortened 2021-08-04 
4883   
language_1 +
4884   
language_2 +
4885   
Asian_group +
4886   
White_group +
4887   
disability_any +
4888   
genderidentity +
4889   
income +
4890   
edhi +
4891   
age,
4892   
data = datFlu
4893   
)
4894   Anova(mF_RP26_3,type="III")
4895   summary(mF_RP26_3)
4896   
4897   
4898   # CHANGELOG: Model 4 + 5 : To check the interaction between the study arm and education
4899   # Model 4: Check for interaction studyarm*edhi 
4900   mF_RP26_4 <- lm(mean_riskperception2_6 ~ studyarm*edhi, data=datFlu)
4901   Anova(mF_RP26_4,type="III")
4902   summary(mF_RP26_4)
4903   
4904   # Model 5: Check for interaction studyarm*edhi with adjustment for other covariates
4905   mF_RP26_5 <- lm(mean_riskperception2_6 ~ studyarm*edhi +
4906   
mean_indivhorz +
4907   
mean_indivvertical +
4908   
mean_collhorz +
4909   
mean_collvertical +
4910   
bornincanada +
4911   
language_1 +
4912   
language_2 +
4913   
Asian_group +
4914   
White_group +
4915   
disability_any +
4916   
genderidentity +
4917   
income +
4918   
age, data=datFlu)
4919   Anova(mF_RP26_5,type="III")
4920   summary(mF_RP26_5)
4921   
4922   
4923   #### ++ Validating assumptions ####
4924   
4925   # Check to see if the assumptions of the models are respected. If not, we will 
transform the
4926   # outcome.
4927   
4928   checkassumptions(mF_RP26_1)
4929   checkassumptions(mF_RP26_2)
4930   checkassumptions(mF_RP26_3)
4931   checkassumptions(mF_RP26_4)
4932   checkassumptions(mF_RP26_5)
4933   
4934   #### ++ Interpretation ####

4935   #CHANGELOG ASJ: adapt relevant functions depending on results of global tests, 
2021-08-11.
4936   
4937   mF_RP26_1_arm <- emmeans(mF_RP26_1,~studyarm)
4938   mF_RP26_1_arm
4939   pairs(mF_RP26_1_arm)
4940   
4941   mF_RP26_2_arm <- emmeans(mF_RP26_2,~studyarm)
4942   mF_RP26_2_arm
4943   pairs(mF_RP26_2_arm)
4944   
4945   emmip(mF_RP26_3, studyarm ~ mean_indivhorz, cov.reduce = range)
4946   emmip(mF_RP26_3, studyarm ~ mean_indivvertical, cov.reduce = range)
4947   
4948   emmeans(mF_RP26_4,~studyarm|edhi)
4949   
4950   emmeans(mF_RP26_5,~studyarm|edhi)
4951   
4952   
4953   
4954   
4955   # Now running models on imputed data.
4956   #CHANGELOG ASJ: No missing data for mean_riskperception2_6, no model with imputation 
performed, 21-09-20.
4957   
4958   
4959   
4960   #CHANGELOG ASJ: Added for secondary outcomes, 21-09-03.
4961   #### +++ ONE WAY ANOVA FOR EMOTIONS ####
4962   #### + Generic ####
4963   
4964   # Model 1: Check for direct effects of factors without any covariates
4965   options(contrasts=c("contr.sum", "contr.poly"))
4966   mG_E1 <- lm(mean_emotion ~ studyarm, data=datGeneric)
4967   Anova(mG_E1,type="III")
4968   summary(mG_E1)
4969   
4970   # Model 2: Check for direct effects of factors with adjustment for other covariates
4971   mG_E2 <-
4972   
lm(
4973   
mean_emotion ~
4974   
studyarm +
4975   
mean_indivhorz +
4976   
mean_indivvertical +
4977   
mean_collhorz +
4978   
mean_collvertical +
4979   
bornincanada +
4980   
language_1 +
4981   
language_2 +
4982   
Asian_group +
4983   
White_group +
4984   
disability_any +
4985   
genderidentity +
4986   
income +
4987   
edhi +
4988   
age,
4989   
data = datGeneric
4990   
)
4991   Anova(mG_E2,type="III")
4992   summary(mG_E2)
4993   
4994   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
4995   mG_E3 <-
4996   
lm(
4997   
mean_emotion ~
4998   
studyarm * mean_indivhorz +
4999   
studyarm * mean_indivvertical +
5000   
studyarm * mean_collhorz +

5001   
studyarm * mean_collvertical +
5002   
bornincanada +
5003   
language_1 +
5004   
language_2 +
5005   
Asian_group +
5006   
White_group +
5007   
disability_any +
5008   
genderidentity +
5009   
income +
5010   
edhi +
5011   
age,
5012   
data = datGeneric
5013   
)
5014   Anova(mG_E3,type="III")
5015   summary(mG_E3)
5016   
5017   # CHANGELOG: Model 4 + 5 : To check the interaction between the study arm and education
5018   # Model 4: Check for interaction studyarm*edhi 
5019   mG_E4 <- lm(mean_emotion ~ studyarm*edhi, data=datGeneric)
5020   Anova(mG_E4,type="III")
5021   summary(mG_E4)
5022   
5023   # Model 5: Check for interaction studyarm*edhi with adjustment for other covariates
5024   mG_E5 <- lm(mean_emotion ~ studyarm*edhi +
5025   
mean_indivhorz +
5026   
mean_indivvertical +
5027   
mean_collhorz +
5028   
mean_collvertical +
5029   
bornincanada +
5030   
language_1 +
5031   
language_2 +
5032   
Asian_group +
5033   
White_group +
5034   
disability_any +
5035   
genderidentity +
5036   
income +
5037   
age, data=datGeneric)
5038   Anova(mG_E5,type="III")
5039   summary(mG_E5)
5040   
5041   #### ++ Validating assumptions ####
5042   
5043   # Check to see if the assumptions of the models are respected. If not, we will 
transform the
5044   # outcome.
5045   
5046   checkassumptions(mG_E1)
5047   checkassumptions(mG_E2)
5048   checkassumptions(mG_E3)
5049   checkassumptions(mG_E4)
5050   checkassumptions(mG_E5)
5051   
5052   #### ++ Interpretation ####
5053   
5054   mG_E1_arm <- emmeans(mG_E1,~studyarm)
5055   mG_E1_arm
5056   plot(mG_E1_arm)
5057   
5058   mG_E2_arm <- emmeans(mG_E2,~studyarm)
5059   mG_E2_arm
5060   plot(mG_E2_arm)
5061   
5062   emmip(mG_E3, studyarm ~ mean_indivhorz, cov.reduce = range)
5063   emmip(mG_E3, studyarm ~ mean_collhorz, cov.reduce = range)
5064   
5065   emmeans(mG_E4,~studyarm|edhi)
5066   
5067   emmeans(mG_E5,~studyarm|edhi)
5068   

5069   
5070   
5071   
5072   # Now running models on imputed data.
5073   #CHANGELOG ASJ: No missing data for mean_emotion, no model with imputation performed, 
21-09-20.
5074   
5075   
5076   
5077   #### + Measles ####
5078   
5079   # Model 1: Check for direct effects of factors without any covariates
5080   mM_E_1 <- lm(mean_emotion ~ studyarm, data=datMeasles)
5081   Anova(mM_E_1,type="III")
5082   summary(mM_E_1)
5083   
5084   # Model 2: Check for direct effects of factors with adjustment for other covariates
5085   mM_E_2 <-
5086   
lm(
5087   
mean_emotion ~
5088   
studyarm +
5089   
mean_indivhorz +
5090   
mean_indivvertical +
5091   
mean_collhorz +
5092   
mean_collvertical +
5093   
bornincanada +
5094   
language_1 +
5095   
language_2 +
5096   
Asian_group +
5097   
White_group +
5098   
disability_any +
5099   
genderidentity +
5100   
income +
5101   
edhi +
5102   
age,
5103   
data = datMeasles
5104   
)
5105   Anova(mM_E_2,type="III")
5106   summary(mM_E_2)
5107   
5108   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
5109   mM_E_3 <-
5110   
lm(
5111   
mean_emotion ~
5112   
studyarm * mean_indivhorz +
5113   
studyarm * mean_indivvertical +
5114   
studyarm * mean_collhorz +
5115   
studyarm * mean_collvertical +
5116   
bornincanada +
5117   
language_1 +
5118   
language_2 +
5119   
Asian_group +
5120   
White_group +
5121   
disability_any +
5122   
genderidentity +
5123   
income +
5124   
edhi +
5125   
age,
5126   
data = datMeasles
5127   
)
5128   Anova(mM_E_3,type="III")
5129   summary(mM_E_3)
5130   
5131   # CHANGELOG: Model 4 + 5 : To check the interaction between the study arm and education
5132   # Model 4: Check for interaction studyarm*edhi 
5133   mM_E_4 <- lm(mean_emotion ~ studyarm*edhi, data=datMeasles)
5134   Anova(mM_E_4,type="III")
5135   summary(mM_E_4)

5136   
5137   # Model 5: Check for interaction studyarm*edhi with adjustment for other covariates
5138   mM_E_5 <- lm(mean_emotion ~ studyarm*edhi +
5139   
mean_indivhorz +
5140   
mean_indivvertical +
5141   
mean_collhorz +
5142   
mean_collvertical +
5143   
bornincanada +
5144   
language_1 +
5145   
language_2 +
5146   
Asian_group +
5147   
White_group +
5148   
disability_any +
5149   
genderidentity +
5150   
income +
5151   
age, data=datMeasles)
5152   Anova(mM_E_5,type="III")
5153   summary(mM_E_5)
5154   
5155   #### ++ Validating assumptions ####
5156   
5157   # Check to see if the assumptions of the models are respected. If not, we will 
transform the
5158   # outcome.
5159   
5160   checkassumptions(mM_E_1)
5161   checkassumptions(mM_E_2)
5162   checkassumptions(mM_E_3)
5163   checkassumptions(mM_E_4)
5164   checkassumptions(mM_E_5)
5165   
5166   #### ++ Interpretation ####
5167   #CHANGELOG ASJ: adapt relevant functions depending on results of global tests, 
2021-08-11.
5168   mM_E_1_arm <- emmeans(mM_E_1,~studyarm)
5169   mM_E_1_arm
5170   pairs(mM_E_1_arm)
5171   
5172   mM_E_2_arm <- emmeans(mM_E_2,~studyarm)
5173   mM_E_2_arm
5174   pairs(mM_E_2_arm)
5175   
5176   emmeans(mM_E_4,~studyarm|edhi)
5177   
5178   emmeans(mM_E_5,~studyarm|edhi)
5179   
5180   
5181   
5182   # Now running models on imputed data.
5183   #CHANGELOG ASJ: No missing data for mean_emotion, no model with imputation performed, 
21-09-20.
5184   
5185   
5186   #### + Flu ####
5187   
5188   # Model 1: Check for direct effects of factors without any covariates
5189   mF_E_1 <- lm(mean_emotion ~ studyarm, data=datFlu)
5190   Anova(mF_E_1,type="III")
5191   summary(mF_E_1)
5192   
5193   # Model 2: Check for direct effects of factors with adjustment for other covariates
5194   mF_E_2 <-
5195   
lm(
5196   
mean_emotion ~
5197   
studyarm +
5198   
mean_indivhorz +
5199   
mean_indivvertical +
5200   
mean_collhorz +
5201   
mean_collvertical +

5202   
bornincanada +
5203   
language_1 +
5204   
language_2 +
5205   
Asian_group +
5206   
White_group +
5207   
disability_any +
5208   
genderidentity +
5209   
income +
5210   
edhi +
5211   
age,
5212   
data = datFlu
5213   
)
5214   Anova(mF_E_2,type="III")
5215   summary(mF_E_2)
5216   
5217   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
5218   mF_E_3 <-
5219   
lm(
5220   
mean_emotion ~
5221   
studyarm * mean_indivhorz +
5222   
studyarm * mean_indivvertical +
5223   
studyarm * mean_collhorz +
5224   
studyarm * mean_collvertical +
5225   
bornincanada +
5226   
language_1 +
5227   
language_2 +
5228   
Asian_group +
5229   
White_group +
5230   
disability_any +
5231   
genderidentity +
5232   
income +
5233   
edhi +
5234   
age,
5235   
data = datFlu
5236   
)
5237   Anova(mF_E_3,type="III")
5238   summary(mF_E_3)
5239   
5240   
5241   # CHANGELOG: Model 4 + 5 : To check the interaction between the study arm and education
5242   # Model 4: Check for interaction studyarm*edhi 
5243   mF_E_4 <- lm(mean_emotion ~ studyarm*edhi, data=datFlu)
5244   Anova(mF_E_4,type="III")
5245   summary(mF_E_4)
5246   
5247   # Model 5: Check for interaction studyarm*edhi with adjustment for other covariates
5248   mF_E_5 <- lm(mean_emotion ~ studyarm*edhi +
5249   
mean_indivhorz +
5250   
mean_indivvertical +
5251   
mean_collhorz +
5252   
mean_collvertical +
5253   
bornincanada +
5254   
language_1 +
5255   
language_2 +
5256   
Asian_group +
5257   
White_group +
5258   
disability_any +
5259   
genderidentity +
5260   
income +
5261   
age, data=datFlu)
5262   Anova(mF_E_5,type="III")
5263   summary(mF_E_5)
5264   
5265   
5266   #### ++ Validating assumptions ####
5267   
5268   # Check to see if the assumptions of the models are respected. If not, we will 
transform the

5269   # outcome.
5270   
5271   checkassumptions(mF_E_1)
5272   checkassumptions(mF_E_2)
5273   checkassumptions(mF_E_3)
5274   checkassumptions(mF_E_4)
5275   checkassumptions(mF_E_5)
5276   
5277   #### ++ Interpretation ####
5278   #CHANGELOG ASJ: adapt relevant functions depending on results of global tests, 
2021-08-11.
5279   
5280   emmeans(mF_E_1,~studyarm)
5281   
5282   emmeans(mF_E_2,~studyarm)
5283   
5284   mF_E4_s<-emmeans(mF_E_4,~studyarm|edhi)
5285   mF_E4_s
5286   pairs(mF_E4_s)
5287   
5288   mF_E4_e<-emmeans(mF_E_4,~edhi|studyarm)
5289   pairs(mF_E4_e)
5290   
5291   emmeans(mF_E_5,~studyarm|edhi)
5292   
5293   
5294   
5295   
5296   # Now running models on imputed data.
5297   #CHANGELOG ASJ: No missing data for mean_emotion, no model with imputation performed, 
21-09-20.
5298   
5299   
5300   #### +++ ONE WAY ANOVA FOR KNOWLEDGE ####
5301   #### + Generic ####
5302   
5303   # Model 1: Check for direct effects of factors without any covariates
5304   options(contrasts=c("contr.sum", "contr.poly"))
5305   mG_K1 <- lm(sum_knowledge ~ studyarm, data=datGeneric)
5306   Anova(mG_K1,type="III")
5307   summary(mG_K1)
5308   
5309   # Model 2: Check for direct effects of factors with adjustment for other covariates
5310   mG_K2 <-
5311   
lm(
5312   
sum_knowledge ~
5313   
studyarm +
5314   
mean_indivhorz +
5315   
mean_indivvertical +
5316   
mean_collhorz +
5317   
mean_collvertical +
5318   
bornincanada +
5319   
language_1 +
5320   
language_2 +
5321   
Asian_group +
5322   
White_group +
5323   
disability_any +
5324   
genderidentity +
5325   
income +
5326   
edhi +
5327   
age,
5328   
data = datGeneric
5329   
)
5330   Anova(mG_K2,type="III")
5331   summary(mG_K2)
5332   
5333   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
5334   mG_K3 <-

5335   
lm(
5336   
sum_knowledge ~
5337   
studyarm * mean_indivhorz +
5338   
studyarm * mean_indivvertical +
5339   
studyarm * mean_collhorz +
5340   
studyarm * mean_collvertical +
5341   
bornincanada +
5342   
language_1 +
5343   
language_2 +
5344   
Asian_group +
5345   
White_group +
5346   
disability_any +
5347   
genderidentity +
5348   
income +
5349   
edhi +
5350   
age,
5351   
data = datGeneric
5352   
)
5353   Anova(mG_K3,type="III")
5354   summary(mG_K3)
5355   
5356   # CHANGELOG: Model 4 + 5 : To check the interaction between the study arm and education
5357   # Model 4: Check for interaction studyarm*edhi 
5358   mG_K4 <- lm(sum_knowledge ~ studyarm*edhi, data=datGeneric)
5359   Anova(mG_K4,type="III")
5360   summary(mG_K4)
5361   
5362   # Model 5: Check for interaction studyarm*edhi with adjustment for other covariates
5363   mG_K5 <- lm(sum_knowledge ~ studyarm*edhi +
5364   
mean_indivhorz +
5365   
mean_indivvertical +
5366   
mean_collhorz +
5367   
mean_collvertical +
5368   
bornincanada +
5369   
language_1 +
5370   
language_2 +
5371   
Asian_group +
5372   
White_group +
5373   
disability_any +
5374   
genderidentity +
5375   
income +
5376   
age, data=datGeneric)
5377   Anova(mG_K5,type="III")
5378   summary(mG_K5)
5379   
5380   #### ++ Validating assumptions ####
5381   
5382   # Check to see if the assumptions of the models are respected. If not, we will 
transform the
5383   # outcome.
5384   
5385   checkassumptions(mG_K1)
5386   checkassumptions(mG_K2)
5387   checkassumptions(mG_K3)
5388   checkassumptions(mG_K4)
5389   checkassumptions(mG_K5)
5390   
5391   #### ++ Interpretation ####
5392   
5393   mG_K1_arm <- emmeans(mG_K1,~studyarm)
5394   mG_K1_arm
5395   pairs(mG_K1_arm)
5396   
5397   mG_K2_arm <- emmeans(mG_K2,~studyarm)
5398   mG_K2_arm
5399   pairs(mG_K2_arm)
5400   
5401   emmeans(mG_K4,~studyarm|edhi)
5402   

5403   emmeans(mG_K5,~studyarm|edhi)
5404   
5405   
5406   # Now running models on imputed data.
5407   #CHANGELOG ASJ: No missing data for sum_knowledge, no model with imputation performed, 
21-09-20.
5408   
5409   
5410   
5411   #### + Measles ####
5412   
5413   # Model 1: Check for direct effects of factors without any covariates
5414   mM_K_1 <- lm(sum_knowledge ~ studyarm, data=datMeasles)
5415   Anova(mM_K_1,type="III")
5416   summary(mM_K_1)
5417   
5418   # Model 2: Check for direct effects of factors with adjustment for other covariates
5419   mM_K_2 <-
5420   
lm(
5421   
sum_knowledge ~
5422   
studyarm +
5423   
mean_indivhorz +
5424   
mean_indivvertical +
5425   
mean_collhorz +
5426   
mean_collvertical +
5427   
bornincanada +
5428   
language_1 +
5429   
language_2 +
5430   
Asian_group +
5431   
White_group +
5432   
disability_any +
5433   
genderidentity +
5434   
income +
5435   
edhi +
5436   
age,
5437   
data = datMeasles
5438   
)
5439   Anova(mM_K_2,type="III")
5440   summary(mM_K_2)
5441   
5442   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
5443   mM_K_3 <-
5444   
lm(
5445   
sum_knowledge ~
5446   
studyarm * mean_indivhorz +
5447   
studyarm * mean_indivvertical +
5448   
studyarm * mean_collhorz +
5449   
studyarm * mean_collvertical +
5450   
bornincanada +
5451   
language_1 +
5452   
language_2 +
5453   
Asian_group +
5454   
White_group +
5455   
disability_any +
5456   
genderidentity +
5457   
income +
5458   
edhi +
5459   
age,
5460   
data = datMeasles
5461   
)
5462   Anova(mM_K_3,type="III")
5463   summary(mM_K_3)
5464   
5465   # CHANGELOG: Model 4 + 5 : To check the interaction between the study arm and education
5466   # Model 4: Check for interaction studyarm*edhi 
5467   mM_K_4 <- lm(sum_knowledge ~ studyarm*edhi, data=datMeasles)
5468   Anova(mM_K_4,type="III")
5469   summary(mM_K_4)

5470   
5471   # Model 5: Check for interaction studyarm*edhi with adjustment for other covariates
5472   mM_K_5 <- lm(sum_knowledge ~ studyarm*edhi +
5473   
mean_indivhorz +
5474   
mean_indivvertical +
5475   
mean_collhorz +
5476   
mean_collvertical +
5477   
bornincanada +
5478   
language_1 +
5479   
language_2 +
5480   
Asian_group +
5481   
White_group +
5482   
disability_any +
5483   
genderidentity +
5484   
income +
5485   
age, data=datMeasles)
5486   Anova(mM_K_5,type="III")
5487   summary(mM_K_5)
5488   
5489   #### ++ Validating assumptions ####
5490   
5491   # Check to see if the assumptions of the models are respected. If not, we will 
transform the
5492   # outcome.
5493   
5494   checkassumptions(mM_K_1)
5495   checkassumptions(mM_K_2)
5496   checkassumptions(mM_K_3)
5497   checkassumptions(mM_K_4)
5498   checkassumptions(mM_K_5)
5499   
5500   #### ++ Interpretation ####
5501   #CHANGELOG ASJ: adapt relevant functions depending on results of global tests, 
2021-08-11.
5502   mM_K_1_arm <- emmeans(mM_K_1,~studyarm)
5503   mM_K_1_arm
5504   pairs(mM_K_1_arm)
5505   
5506   mM_K_2_arm <- emmeans(mM_K_2,~studyarm)
5507   mM_K_2_arm
5508   pairs(mM_K_2_arm)
5509   
5510   emmip(mM_K_3, studyarm ~ mean_indivvertical, cov.reduce = range)
5511   
5512   emmeans(mM_K_4,~studyarm|edhi)
5513   
5514   emmeans(mM_K_5,~studyarm|edhi)
5515   
5516   
5517   
5518   # Now running models on imputed data.
5519   #CHANGELOG ASJ: No missing data for sum_knowledge, no model with imputation performed, 
21-09-20.
5520   
5521   
5522   
5523   
5524   #### + Flu ####
5525   
5526   # Model 1: Check for direct effects of factors without any covariates
5527   mF_K_1 <- lm(sum_knowledge ~ studyarm, data=datFlu)
5528   Anova(mF_K_1,type="III")
5529   summary(mF_K_1)
5530   
5531   # Model 2: Check for direct effects of factors with adjustment for other covariates
5532   mF_K_2 <-
5533   
lm(
5534   
sum_knowledge ~
5535   
studyarm +

5536   
mean_indivhorz +
5537   
mean_indivvertical +
5538   
mean_collhorz +
5539   
mean_collvertical +
5540   
bornincanada +
5541   
language_1 +
5542   
language_2 +
5543   
Asian_group +
5544   
White_group +
5545   
disability_any +
5546   
genderidentity +
5547   
income +
5548   
edhi +
5549   
age,
5550   
data = datFlu
5551   
)
5552   Anova(mF_K_2,type="III")
5553   summary(mF_K_2)
5554   
5555   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
5556   mF_K_3 <-
5557   
lm(
5558   
sum_knowledge ~
5559   
studyarm * mean_indivhorz +
5560   
studyarm * mean_indivvertical +
5561   
studyarm * mean_collhorz +
5562   
studyarm * mean_collvertical +
5563   
bornincanada +
5564   
language_1 +
5565   
language_2 +
5566   
Asian_group +
5567   
White_group +
5568   
disability_any +
5569   
genderidentity +
5570   
income +
5571   
edhi +
5572   
age,
5573   
data = datFlu
5574   
)
5575   Anova(mF_K_3,type="III")
5576   summary(mF_K_3)
5577   
5578   
5579   # CHANGELOG: Model 4 + 5 : To check the interaction between the study arm and education
5580   # Model 4: Check for interaction studyarm*edhi 
5581   mF_K_4 <- lm(sum_knowledge ~ studyarm*edhi, data=datFlu)
5582   Anova(mF_K_4,type="III")
5583   summary(mF_K_4)
5584   
5585   # Model 5: Check for interaction studyarm*edhi with adjustment for other covariates
5586   mF_K_5 <- lm(sum_knowledge ~ studyarm*edhi +
5587   
mean_indivhorz +
5588   
mean_indivvertical +
5589   
mean_collhorz +
5590   
mean_collvertical +
5591   
bornincanada +
5592   
language_1 +
5593   
language_2 +
5594   
Asian_group +
5595   
White_group +
5596   
disability_any +
5597   
genderidentity +
5598   
income +
5599   
age, data=datFlu)
5600   Anova(mF_K_5,type="III")
5601   summary(mF_K_5)
5602   
5603   

5604   #### ++ Validating assumptions ####
5605   
5606   # Check to see if the assumptions of the models are respected. If not, we will 
transform the
5607   # outcome.
5608   
5609   checkassumptions(mF_K_1)
5610   checkassumptions(mF_K_2)
5611   checkassumptions(mF_K_3)
5612   checkassumptions(mF_K_4)
5613   checkassumptions(mF_K_5)
5614   
5615   #### ++ Interpretation ####
5616   #CHANGELOG ASJ: adapt relevant functions depending on results of global tests, 
2021-08-11.
5617   
5618   mF_K_1_arm <- emmeans(mF_K_1,~studyarm)
5619   mF_K_1_arm
5620   pairs(mF_K_1_arm)
5621   
5622   mF_K_2_arm <- emmeans(mF_K_2,~studyarm)
5623   mF_K_2_arm
5624   pairs(mF_K_2_arm)
5625   
5626   emmip(mF_K_3, studyarm ~ mean_indivvertical, cov.reduce = range)
5627   
5628   emmeans(mF_K_4,~studyarm|edhi)
5629   
5630   mF_K_5_arm <- emmeans(mF_K_5,~studyarm|edhi)
5631   mF_K_5_arm
5632   pairs(mF_K_5_arm)
5633   pairs(emmeans(mF_K_5,~edhi|studyarm))
5634   
5635   
5636   
5637   # Now running models on imputed data.
5638   #CHANGELOG ASJ: No missing data for sum_knowledge, no model with imputation performed, 
21-09-20.
5639   
5640   
5641   
5642   
5643   
5644   
5645   #CHANGELOG ASJ: Add logistic regression models for dichotomous outcomes, 2021-08-11.
5646   
5647   #### +++ Logistic regression for RP1 ####
5648   
5649   #Create relevel before model to avoid problems with pairs function.
5650   datGeneric$RP1_dicho <- relevel(datGeneric$RP1_dicho,ref = "Low")
5651   datMeasles$RP1_dicho <- relevel(datMeasles$RP1_dicho,ref = "Low")
5652   datFlu$RP1_dicho <- relevel(datFlu$RP1_dicho,ref = "Low")
5653   
5654   #### ++ Generic ####
5655   
5656   #### + Model 1: Check for direct effects of factors without any covariates ####
5657   
5658   options(contrasts=c("contr.sum", "contr.poly"))
5659   rlogG_RP1_1 <- glm(RP1_dicho
~ studyarm, data = datGeneric,family=binomial("logit"))
5660   Anova(rlogG_RP1_1,type="III")
5661   summary(rlogG_RP1_1)
5662   
5663   mgRP1 <- emmeans(rlogG_RP1_1,~studyarm,type = "response") #proportions
5664   mgRP1
5665   confint(pairs(mgRP1,reverse = TRUE)) #Odds ratios
5666   pairs(mgRP1,reverse = TRUE, type = "response")
5667   
5668   # Model 2: Check for direct effects of factors with adjustment for other covariates
5669   rlogG_RP1_2 <-

5670   
glm(RP1_dicho
~ studyarm +
5671   
mean_indivhorz +
5672   
mean_indivvertical +
5673   
mean_collhorz +
5674   
mean_collvertical +
5675   
bornincanada +
5676   
language_1 +
5677   
language_2 +
5678   
Asian_group +
5679   
White_group +
5680   
disability_any +
5681   
genderidentity +
5682   
income +
5683   
edhi +
5684   
age,
5685   
data = datGeneric,family=binomial("logit")
5686   
)
5687   Anova(rlogG_RP1_2, type = "III")
5688   summary(rlogG_RP1_2)
5689   
5690   mgRP1_2 <- emmeans(rlogG_RP1_2,~studyarm,type = "response")
5691   mgRP1_2
5692   confint(pairs(mgRP1_2,reverse = TRUE))
5693   pairs(mgRP1_2,reverse = TRUE,type = "response")
5694   
5695   
5696   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
5697   rlogG_RP1_3 <-
5698   
glm(RP1_dicho
~
5699   
studyarm * mean_indivhorz +
5700   
studyarm * mean_indivvertical +
5701   
studyarm * mean_collhorz +
5702   
studyarm * mean_collvertical +
5703   
bornincanada +
5704   
language_1 +
5705   
language_2 +
5706   
Asian_group +
5707   
White_group +
5708   
disability_any +
5709   
genderidentity +
5710   
income +
5711   
edhi +
5712   
age,
5713   
data = datGeneric,family=binomial("logit")
5714   
)
5715   Anova(rlogG_RP1_3, type = "III")
5716   summary(rlogG_RP1_3)
5717   
5718   #No interaction with moderator to interpret
5719   
5720   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
5721   
5722   rlogG_RP1_4 <- glm(RP1_dicho
~ studyarm * edhi, data =
datGeneric,family=binomial("logit"))
5723   Anova(rlogG_RP1_4,type="III")
5724   summary(rlogG_RP1_4)
5725   
5726   mgRP1_4_s <- emmeans(rlogG_RP1_4,~studyarm|edhi,type = "response")
5727   mgRP1_4_s
5728   confint(pairs(mgRP1_4_s,reverse = TRUE))
5729   
5730   mgRP1_4_e <- emmeans(rlogG_RP1_4,  ~ edhi|studyarm, type = "response")
5731   confint(pairs(mgRP1_4_e,reverse = TRUE))
5732   
5733   
5734   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
5735   
5736   rlogG_RP1_5 <-

5737   
glm(RP1_dicho
~ studyarm*edhi +
5738   
mean_indivhorz +
5739   
mean_indivvertical +
5740   
mean_collhorz +
5741   
mean_collvertical +
5742   
bornincanada +
5743   
language_1 +
5744   
language_2 +
5745   
Asian_group +
5746   
White_group +
5747   
disability_any +
5748   
genderidentity +
5749   
income +
5750   
age,
5751   
data = datGeneric,family=binomial("logit")
5752   
)
5753   Anova(rlogG_RP1_5, type = "III")
5754   summary(rlogG_RP1_5)
5755   
5756   mgRP1_5_s <- emmeans(rlogG_RP1_5,~studyarm|edhi,type = "response")
5757   mgRP1_5_s
5758   confint(pairs(mgRP1_5_s,reverse = TRUE))
5759   
5760   mgRP1_5_e <- emmeans(rlogG_RP1_5,  ~ edhi|studyarm, type = "response")
5761   confint(pairs(mgRP1_5_e,reverse = TRUE))
5762   
5763   # Now running models on imputed data.
5764   
5765   imprlogG_RP1_1 <-
5766   
with(data = datGenericImputed,
5767   
exp = glm(relevel(RP1_dicho,ref="Low") ~ studyarm,family = binomial("logit")))
5768   combineimprlogG_RP1_1 <- pool(imprlogG_RP1_1)
5769   summary(combineimprlogG_RP1_1)
5770   
5771   
5772   #### ++ Measles ####
5773   
5774   #### + Model 1: Check for direct effects of factors without any covariates ####
5775   
5776   options(contrasts=c("contr.sum", "contr.poly"))
5777   rlogM_RP1_1 <- glm(RP1_dicho
~ studyarm, data = datMeasles,family=binomial("logit"))
5778   Anova(rlogM_RP1_1,type="III")
5779   summary(rlogM_RP1_1)
5780   
5781   mmRP1 <- emmeans(rlogM_RP1_1,~studyarm,type = "response") #proportions
5782   mmRP1
5783   confint(pairs(mmRP1,reverse = TRUE)) #Odds ratios
5784   pairs(mmRP1,reverse = TRUE, type = "response")
5785   
5786   # Model 2: Check for direct effects of factors with adjustment for other covariates
5787   rlogM_RP1_2 <-
5788   
glm(RP1_dicho
~ studyarm +
5789   
mean_indivhorz +
5790   
mean_indivvertical +
5791   
mean_collhorz +
5792   
mean_collvertical +
5793   
bornincanada +
5794   
language_1 +
5795   
language_2 +
5796   
Asian_group +
5797   
White_group +
5798   
disability_any +
5799   
genderidentity +
5800   
income +
5801   
edhi +
5802   
age,
5803   
data = datMeasles,family=binomial("logit")
5804   
)
5805   Anova(rlogM_RP1_2, type = "III")

5806   summary(rlogM_RP1_2)
5807   
5808   mmRP1_2 <- emmeans(rlogM_RP1_2,~studyarm,type = "response")
5809   mmRP1_2
5810   confint(pairs(mmRP1_2,reverse = TRUE))
5811   pairs(mmRP1_2,reverse = TRUE,type = "response")
5812   
5813   
5814   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
5815   rlogM_RP1_3 <-
5816   
glm(RP1_dicho
~
5817   
studyarm * mean_indivhorz +
5818   
studyarm * mean_indivvertical +
5819   
studyarm * mean_collhorz +
5820   
studyarm * mean_collvertical +
5821   
bornincanada +
5822   
language_1 +
5823   
language_2 +
5824   
Asian_group +
5825   
White_group +
5826   
disability_any +
5827   
genderidentity +
5828   
income +
5829   
edhi +
5830   
age,
5831   
data = datMeasles,family=binomial("logit")
5832   
)
5833   Anova(rlogM_RP1_3, type = "III")
5834   summary(rlogM_RP1_3)
5835   
5836   #No interaction with moderator to interpret
5837   
5838   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
5839   
5840   rlogM_RP1_4 <- glm(RP1_dicho
~ studyarm * edhi, data =
datMeasles,family=binomial("logit"))
5841   Anova(rlogM_RP1_4,type="III")
5842   summary(rlogM_RP1_4)
5843   
5844   mmRP1_4_s <- emmeans(rlogM_RP1_4,~studyarm|edhi,type = "response")
5845   mmRP1_4_s
5846   confint(pairs(mmRP1_4_s,reverse = TRUE))
5847   
5848   mmRP1_4_e <- emmeans(rlogM_RP1_4,  ~ edhi|studyarm, type = "response")
5849   confint(pairs(mmRP1_4_e,reverse = TRUE))
5850   
5851   
5852   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
5853   
5854   rlogM_RP1_5 <-
5855   
glm(RP1_dicho
~ studyarm*edhi +
5856   
mean_indivhorz +
5857   
mean_indivvertical +
5858   
mean_collhorz +
5859   
mean_collvertical +
5860   
bornincanada +
5861   
language_1 +
5862   
language_2 +
5863   
Asian_group +
5864   
White_group +
5865   
disability_any +
5866   
genderidentity +
5867   
income +
5868   
age,
5869   
data = datMeasles,family=binomial("logit")
5870   
)
5871   Anova(rlogM_RP1_5, type = "III")
5872   summary(rlogM_RP1_5)

5873   
5874   mmRP1_5_s <- emmeans(rlogM_RP1_5,~studyarm|edhi,type = "response")
5875   mmRP1_5_s
5876   confint(pairs(mmRP1_5_s,reverse = TRUE))
5877   
5878   mmRP1_5_e <- emmeans(rlogM_RP1_5,  ~ edhi|studyarm, type = "response")
5879   confint(pairs(mmRP1_5_e,reverse = TRUE))
5880   
5881   # Now running models on imputed data.
5882   
5883   imprlogM_RP1_1 <-
5884   
with(data = datMeaslesImputed,
5885   
exp = glm(relevel(RP1_dicho,ref="Low") ~ studyarm,family = binomial("logit")))
5886   combineimprlogM_RP1_1 <- pool(imprlogM_RP1_1)
5887   summary(combineimprlogM_RP1_1)
5888   
5889   
5890   #### ++ Flu ####
5891   
5892   #### + Model 1: Check for direct effects of factors without any covariates ####
5893   
5894   options(contrasts=c("contr.sum", "contr.poly"))
5895   rlogF_RP1_1 <- glm(RP1_dicho
~ studyarm, data = datFlu,family=binomial("logit"))
5896   Anova(rlogF_RP1_1,type="III")
5897   summary(rlogF_RP1_1)
5898   
5899   mfRP1_1 <- emmeans(rlogF_RP1_1,~studyarm,type = "response") #proportions
5900   mfRP1_1
5901   confint(pairs(mfRP1_1,reverse = TRUE)) #Odds ratios
5902   pairs(mfRP1_1,reverse = TRUE, type = "response")
5903   
5904   # Model 2: Check for direct effects of factors with adjustment for other covariates
5905   rlogF_RP1_2 <-
5906   
glm(RP1_dicho
~ studyarm +
5907   
mean_indivhorz +
5908   
mean_indivvertical +
5909   
mean_collhorz +
5910   
mean_collvertical +
5911   
bornincanada +
5912   
language_1 +
5913   
language_2 +
5914   
Asian_group +
5915   
White_group +
5916   
disability_any +
5917   
genderidentity +
5918   
income +
5919   
edhi +
5920   
age,
5921   
data = datFlu,family=binomial("logit")
5922   
)
5923   Anova(rlogF_RP1_2, type = "III")
5924   summary(rlogF_RP1_2)
5925   
5926   mfRP1_2 <- emmeans(rlogF_RP1_2,~studyarm,type = "response")
5927   mfRP1_2
5928   confint(pairs(mfRP1_2,reverse = TRUE))
5929   pairs(mfRP1_2,reverse = TRUE,type = "response")
5930   
5931   
5932   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
5933   rlogF_RP1_3 <-
5934   
glm(RP1_dicho
~
5935   
studyarm * mean_indivhorz +
5936   
studyarm * mean_indivvertical +
5937   
studyarm * mean_collhorz +
5938   
studyarm * mean_collvertical +
5939   
bornincanada +
5940   
language_1 +

5941   
language_2 +
5942   
Asian_group +
5943   
White_group +
5944   
disability_any +
5945   
genderidentity +
5946   
income +
5947   
edhi +
5948   
age,
5949   
data = datFlu,family=binomial("logit")
5950   
)
5951   Anova(rlogF_RP1_3, type = "III")
5952   summary(rlogF_RP1_3)
5953   
5954   emmip(rlogF_RP1_3, studyarm ~ mean_collhorz, cov.reduce = range, type = "response")
5955   emmip(rlogF_RP1_3, studyarm ~ mean_collvertical, cov.reduce = range, type = "response")
5956   
5957   
5958   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
5959   
5960   rlogF_RP1_4 <- glm(RP1_dicho
~ studyarm * edhi, data =
datMeasles,family=binomial("logit"))
5961   Anova(rlogF_RP1_4,type="III")
5962   summary(rlogF_RP1_4)
5963   
5964   mfRP1_4_s <- emmeans(rlogF_RP1_4,~studyarm|edhi,type = "response")
5965   mfRP1_4_s
5966   confint(pairs(mfRP1_4_s,reverse = TRUE))
5967   
5968   mfRP1_4_e <- emmeans(rlogF_RP1_4,  ~ edhi|studyarm, type = "response")
5969   confint(pairs(mfRP1_4_e,reverse = TRUE))
5970   
5971   
5972   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
5973   
5974   rlogF_RP1_5 <-
5975   
glm(RP1_dicho
~ studyarm*edhi +
5976   
mean_indivhorz +
5977   
mean_indivvertical +
5978   
mean_collhorz +
5979   
mean_collvertical +
5980   
bornincanada +
5981   
language_1 +
5982   
language_2 +
5983   
Asian_group +
5984   
White_group +
5985   
disability_any +
5986   
genderidentity +
5987   
income +
5988   
age,
5989   
data = datFlu,family=binomial("logit")
5990   
)
5991   Anova(rlogF_RP1_5, type = "III")
5992   summary(rlogF_RP1_5)
5993   
5994   mfRP1_5_s <- emmeans(rlogF_RP1_5,~studyarm|edhi,type = "response")
5995   mfRP1_5_s
5996   confint(pairs(mfRP1_5_s,reverse = TRUE))
5997   
5998   mfRP1_5_e <- emmeans(rlogF_RP1_5,  ~ edhi|studyarm, type = "response")
5999   confint(pairs(mfRP1_5_e,reverse = TRUE))
6000   
6001   # Now running models on imputed data.
6002   
6003   imprlogF_RP1_1 <-
6004   
with(data = datFluImputed,
6005   
exp = glm(relevel(RP1_dicho,ref="Low") ~ studyarm,family = binomial("logit")))
6006   combineimprlogF_RP1_1 <- pool(imprlogF_RP1_1)
6007   summary(combineimprlogF_RP1_1)
6008   

6009   
6010   #### +++ Logistic regression for VaxIntention ####
6011   
6012   #Create relevel before model to avoid problems with pairs function.
6013   datGeneric$vaxintent <- relevel(datGeneric$vaxintent,ref = "Low")
6014   datMeasles$vaxintent <- relevel(datMeasles$vaxintent,ref = "Low")
6015   datFlu$vaxintent <- relevel(datFlu$vaxintent,ref = "Low")
6016   
6017   #### ++ Generic ####
6018   
6019   #### + Model 1: Check for direct effects of factors without any covariates ####
6020   
6021   options(contrasts=c("contr.sum", "contr.poly"))
6022   rlogG_vi_1 <- glm(vaxintent ~ studyarm, data = datGeneric,family=binomial("logit"))
6023   Anova(rlogG_vi_1,type="III")
6024   summary(rlogG_vi_1)
6025   
6026   mgvi_1 <- emmeans(rlogG_vi_1,~studyarm,type = "response") #proportions
6027   mgvi_1
6028   confint(pairs(mgvi_1,reverse = TRUE)) #Odds ratios
6029   
6030   # Model 2: Check for direct effects of factors with adjustment for other covariates
6031   rlogG_vi_2 <-
6032   
glm(vaxintent
~ studyarm +
6033   
mean_indivhorz +
6034   
mean_indivvertical +
6035   
mean_collhorz +
6036   
mean_collvertical +
6037   
bornincanada +
6038   
language_1 +
6039   
language_2 +
6040   
Asian_group +
6041   
White_group +
6042   
disability_any +
6043   
genderidentity +
6044   
income +
6045   
edhi +
6046   
age,
6047   
data = datGeneric,family=binomial("logit")
6048   
)
6049   Anova(rlogG_vi_2, type = "III")
6050   summary(rlogG_vi_2)
6051   
6052   mgvi_2 <- emmeans(rlogG_vi_2,~studyarm,type = "response")
6053   mgvi_2
6054   confint(pairs(mgvi_2,reverse = TRUE))
6055   
6056   
6057   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
6058   rlogG_vi_3 <-
6059   
glm(vaxintent
~
6060   
studyarm * mean_indivhorz +
6061   
studyarm * mean_indivvertical +
6062   
studyarm * mean_collhorz +
6063   
studyarm * mean_collvertical +
6064   
bornincanada +
6065   
language_1 +
6066   
language_2 +
6067   
Asian_group +
6068   
White_group +
6069   
disability_any +
6070   
genderidentity +
6071   
income +
6072   
edhi +
6073   
age,
6074   
data = datGeneric,family=binomial("logit")
6075   
)
6076   Anova(rlogG_vi_3, type = "III")

6077   summary(rlogG_vi_3)
6078   
6079   #No interaction with moderator to interpret
6080   
6081   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
6082   
6083   rlogG_vi_4 <- glm(vaxintent
~ studyarm * edhi, data =
datGeneric,family=binomial("logit"))
6084   Anova(rlogG_vi_4,type="III")
6085   summary(rlogG_vi_4)
6086   
6087   mgvi_4_s <- emmeans(rlogG_vi_4,~studyarm|edhi,type = "response")
6088   mgvi_4_s
6089   confint(pairs(mgvi_4_s,reverse = TRUE))
6090   
6091   mgvi_4_e <- emmeans(rlogG_vi_4,  ~ edhi|studyarm, type = "response")
6092   confint(pairs(mgvi_4_e,reverse = TRUE))
6093   
6094   
6095   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
6096   
6097   rlogG_vi_5 <-
6098   
glm(vaxintent
~ studyarm*edhi +
6099   
mean_indivhorz +
6100   
mean_indivvertical +
6101   
mean_collhorz +
6102   
mean_collvertical +
6103   
bornincanada +
6104   
language_1 +
6105   
language_2 +
6106   
Asian_group +
6107   
White_group +
6108   
disability_any +
6109   
genderidentity +
6110   
income +
6111   
age,
6112   
data = datGeneric,family=binomial("logit")
6113   
)
6114   Anova(rlogG_vi_5, type = "III")
6115   summary(rlogG_vi_5)
6116   
6117   mgvi_5_s <- emmeans(rlogG_vi_5,~studyarm|edhi,type = "response")
6118   mgvi_5_s
6119   confint(pairs(mgvi_5_s,reverse = TRUE))
6120   
6121   mgvi_5_e <- emmeans(rlogG_vi_5,  ~ edhi|studyarm, type = "response")
6122   confint(pairs(mgvi_5_e,reverse = TRUE))
6123   
6124   # Now running models on imputed data.
6125   
6126   imprlogG_vi_1 <-
6127   
with(data = datGenericImputed,
6128   
exp = glm(relevel(vaxintent,ref="Low") ~ studyarm,family = binomial("logit")))
6129   combineimprlogG_vi_1 <- pool(imprlogG_vi_1)
6130   summary(combineimprlogG_vi_1)
6131   
6132   #CHANGELOG ASJ: add test to check if global test result changes or not, 21-09-20.
6133   imprlogG_vi_vide <-
6134   
with(data = datGenericImputed,
6135   
exp = glm(relevel(vaxintent,ref="Low") ~ 1,family = binomial("logit"))) #model 
with intercept only
6136   combineimprlogG_vi_vide <- pool(imprlogG_vi_vide)
6137   summary(combineimprlogG_vi_vide)
6138   test_sig<-D2(imprlogG_vi_1,imprlogG_vi_vide) #compare model with studyarm vs model with 
intercept only
6139   summary(test_sig)
6140   
6141   
6142   

6143   
6144   #### ++ Measles ####
6145   
6146   #### + Model 1: Check for direct effects of factors without any covariates ####
6147   
6148   options(contrasts=c("contr.sum", "contr.poly"))
6149   rlogM_vi_1 <- glm(vaxintent
~ studyarm, data = datMeasles,family=binomial("logit"))
6150   Anova(rlogM_vi_1,type="III")
6151   summary(rlogM_vi_1)
6152   
6153   mmvi <- emmeans(rlogM_vi_1,~studyarm,type = "response") #proportions
6154   mmvi
6155   confint(pairs(mmvi,reverse = TRUE)) #Odds ratios
6156   pairs(mmvi,reverse = TRUE, type = "response")
6157   
6158   # Model 2: Check for direct effects of factors with adjustment for other covariates
6159   rlogM_vi_2 <-
6160   
glm(vaxintent
~ studyarm +
6161   
mean_indivhorz +
6162   
mean_indivvertical +
6163   
mean_collhorz +
6164   
mean_collvertical +
6165   
bornincanada +
6166   
language_1 +
6167   
language_2 +
6168   
Asian_group +
6169   
White_group +
6170   
disability_any +
6171   
genderidentity +
6172   
income +
6173   
edhi +
6174   
age,
6175   
data = datMeasles,family=binomial("logit")
6176   
)
6177   Anova(rlogM_vi_2, type = "III")
6178   summary(rlogM_vi_2)
6179   
6180   mmvi_2 <- emmeans(rlogM_vi_2,~studyarm,type = "response")
6181   mmvi_2
6182   confint(pairs(mmvi_2,reverse = TRUE))
6183   
6184   
6185   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
6186   rlogM_vi_3 <-
6187   
glm(vaxintent
~
6188   
studyarm * mean_indivhorz +
6189   
studyarm * mean_indivvertical +
6190   
studyarm * mean_collhorz +
6191   
studyarm * mean_collvertical +
6192   
bornincanada +
6193   
language_1 +
6194   
language_2 +
6195   
Asian_group +
6196   
White_group +
6197   
disability_any +
6198   
genderidentity +
6199   
income +
6200   
edhi +
6201   
age,
6202   
data = datMeasles,family=binomial("logit")
6203   
)
6204   Anova(rlogM_vi_3, type = "III")
6205   summary(rlogM_vi_3)
6206   
6207   #No interaction with moderator to interpret
6208   
6209   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
6210   

6211   rlogM_vi_4 <- glm(vaxintent
~ studyarm * edhi, data =
datMeasles,family=binomial("logit"))
6212   Anova(rlogM_vi_4,type="III")
6213   summary(rlogM_vi_4)
6214   
6215   mmvi_4_s <- emmeans(rlogM_vi_4,~studyarm|edhi,type = "response")
6216   mmvi_4_s
6217   confint(pairs(mmvi_4_s,reverse = TRUE))
6218   
6219   mmvi_4_e <- emmeans(rlogM_vi_4,  ~ edhi|studyarm, type = "response")
6220   confint(pairs(mmvi_4_e,reverse = TRUE))
6221   
6222   
6223   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
6224   
6225   rlogM_vi_5 <-
6226   
glm(vaxintent
~ studyarm*edhi +
6227   
mean_indivhorz +
6228   
mean_indivvertical +
6229   
mean_collhorz +
6230   
mean_collvertical +
6231   
bornincanada +
6232   
language_1 +
6233   
language_2 +
6234   
Asian_group +
6235   
White_group +
6236   
disability_any +
6237   
genderidentity +
6238   
income +
6239   
age,
6240   
data = datMeasles,family=binomial("logit")
6241   
)
6242   Anova(rlogM_vi_5, type = "III")
6243   summary(rlogM_vi_5)
6244   
6245   mmvi_5_s <- emmeans(rlogM_vi_5,~studyarm|edhi,type = "response")
6246   mmvi_5_s
6247   confint(pairs(mmvi_5_s,reverse = TRUE))
6248   
6249   mmvi_5_e <- emmeans(rlogM_vi_5,  ~ edhi|studyarm, type = "response")
6250   confint(pairs(mmvi_5_e,reverse = TRUE))
6251   
6252   # Now running models on imputed data.
6253   imprlogM_vi_1 <-
6254   
with(data = datMeaslesImputed,
6255   
exp = glm(relevel(vaxintent,ref="Low") ~ studyarm,family = binomial("logit")))
6256   combineimprlogM_vi_1 <- pool(imprlogM_vi_1)
6257   summary(combineimprlogM_vi_1)
6258   
6259   
6260   #### ++ Flu ####
6261   
6262   #### + Model 1: Check for direct effects of factors without any covariates ####
6263   
6264   options(contrasts=c("contr.sum", "contr.poly"))
6265   rlogF_vi_1 <- glm(vaxintent
~ studyarm, data = datFlu,family=binomial("logit"))
6266   Anova(rlogF_vi_1,type="III")
6267   summary(rlogF_vi_1)
6268   
6269   mfvi_1 <- emmeans(rlogF_vi_1,~studyarm,type = "response") #proportions
6270   mfvi_1
6271   confint(pairs(mfvi_1,reverse = TRUE)) #Odds ratios
6272   
6273   
6274   # Model 2: Check for direct effects of factors with adjustment for other covariates
6275   rlogF_vi_2 <-
6276   
glm(vaxintent
~ studyarm +
6277   
mean_indivhorz +
6278   
mean_indivvertical +

6279   
mean_collhorz +
6280   
mean_collvertical +
6281   
bornincanada +
6282   
language_1 +
6283   
language_2 +
6284   
Asian_group +
6285   
White_group +
6286   
disability_any +
6287   
genderidentity +
6288   
income +
6289   
edhi +
6290   
age,
6291   
data = datFlu,family=binomial("logit")
6292   
)
6293   Anova(rlogF_vi_2, type = "III")
6294   summary(rlogF_vi_2)
6295   
6296   mfvi_2 <- emmeans(rlogF_vi_2,~studyarm,type = "response")
6297   mfvi_2
6298   confint(pairs(mfvi_2,reverse = TRUE))
6299   
6300   
6301   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
6302   rlogF_vi_3 <-
6303   
glm(vaxintent
~
6304   
studyarm * mean_indivhorz +
6305   
studyarm * mean_indivvertical +
6306   
studyarm * mean_collhorz +
6307   
studyarm * mean_collvertical +
6308   
bornincanada +
6309   
language_1 +
6310   
language_2 +
6311   
Asian_group +
6312   
White_group +
6313   
disability_any +
6314   
genderidentity +
6315   
income +
6316   
edhi +
6317   
age,
6318   
data = datFlu,family=binomial("logit")
6319   
)
6320   Anova(rlogF_vi_3, type = "III")
6321   summary(rlogF_vi_3)
6322   
6323   emmip(rlogF_vi_3, studyarm ~ mean_indivvertical, cov.reduce = range, type = "response")
6324   
6325   
6326   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
6327   
6328   rlogF_vi_4 <- glm(vaxintent
~ studyarm * edhi, data = datFlu,family=binomial("logit"))
6329   Anova(rlogF_vi_4,type="III")
6330   summary(rlogF_vi_4)
6331   
6332   mfvi_4_s <- emmeans(rlogF_vi_4,~studyarm|edhi,type = "response")
6333   mfvi_4_s
6334   confint(pairs(mfvi_4_s,reverse = TRUE))
6335   
6336   mfvi_4_e <- emmeans(rlogF_vi_4,  ~ edhi|studyarm, type = "response")
6337   confint(pairs(mfvi_4_e,reverse = TRUE))
6338   
6339   
6340   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
6341   
6342   rlogF_vi_5 <-
6343   
glm(vaxintent
~ studyarm*edhi +
6344   
mean_indivhorz +
6345   
mean_indivvertical +
6346   
mean_collhorz +

6347   
mean_collvertical +
6348   
bornincanada +
6349   
language_1 +
6350   
language_2 +
6351   
Asian_group +
6352   
White_group +
6353   
disability_any +
6354   
genderidentity +
6355   
income +
6356   
age,
6357   
data = datFlu,family=binomial("logit")
6358   
)
6359   Anova(rlogF_vi_5, type = "III")
6360   summary(rlogF_vi_5)
6361   
6362   mfvi_5_s <- emmeans(rlogF_vi_5,~studyarm|edhi,type = "response")
6363   mfvi_5_s
6364   confint(pairs(mfvi_5_s,reverse = TRUE))
6365   
6366   mfvi_5_e <- emmeans(rlogF_vi_5,  ~ edhi|studyarm, type = "response")
6367   confint(pairs(mfvi_5_e,reverse = TRUE))
6368   
6369   # Now running models on imputed data.
6370   imprlogF_vi_1 <-
6371   
with(data = datFluImputed,
6372   
exp = glm(relevel(vaxintent,ref="Low") ~ studyarm,family = binomial("logit")))
6373   combineimprlogF_vi_1 <- pool(imprlogF_vi_1)
6374   summary(combineimprlogF_vi_1)
6375   
6376   #### +++ Logistic regression for C19VaxIntention ####
6377   
6378   #Create relevel before model to avoid problems with pairs function.
6379   datGeneric$c19vaxintent <- relevel(datGeneric$c19vaxintent,ref = "Low")
6380   datMeasles$c19vaxintent <- relevel(datMeasles$c19vaxintent,ref = "Low")
6381   datFlu$c19vaxintent <- relevel(datFlu$c19vaxintent,ref = "Low")
6382   
6383   #### ++ Generic ####
6384   
6385   #### + Model 1: Check for direct effects of factors without any covariates ####
6386   
6387   options(contrasts=c("contr.sum", "contr.poly"))
6388   rlogG_c19vi_1 <- glm(c19vaxintent
~ studyarm, data =
datGeneric,family=binomial("logit"))
6389   Anova(rlogG_c19vi_1,type="III")
6390   summary(rlogG_c19vi_1)
6391   
6392   mgc19vi_1 <- emmeans(rlogG_c19vi_1,~studyarm,type = "response") #proportions
6393   mgc19vi_1
6394   confint(pairs(mgc19vi_1,reverse = TRUE)) #Odds ratios
6395   
6396   # Model 2: Check for direct effects of factors with adjustment for other covariates
6397   rlogG_c19vi_2 <-
6398   
glm(c19vaxintent
~ studyarm +
6399   
mean_indivhorz +
6400   
mean_indivvertical +
6401   
mean_collhorz +
6402   
mean_collvertical +
6403   
bornincanada +
6404   
language_1 +
6405   
language_2 +
6406   
Asian_group +
6407   
White_group +
6408   
disability_any +
6409   
genderidentity +
6410   
income +
6411   
edhi +
6412   
age,
6413   
data = datGeneric,family=binomial("logit")
6414   
)

6415   Anova(rlogG_c19vi_2, type = "III")
6416   summary(rlogG_c19vi_2)
6417   
6418   mgc19vi_2 <- emmeans(rlogG_c19vi_2,~studyarm,type = "response")
6419   mgc19vi_2
6420   confint(pairs(mgc19vi_2,reverse = TRUE))
6421   pairs(mgc19vi_2,reverse = TRUE, type = "response")
6422   
6423   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
6424   rlogG_c19vi_3 <-
6425   
glm(c19vaxintent
~
6426   
studyarm * mean_indivhorz +
6427   
studyarm * mean_indivvertical +
6428   
studyarm * mean_collhorz +
6429   
studyarm * mean_collvertical +
6430   
bornincanada +
6431   
language_1 +
6432   
language_2 +
6433   
Asian_group +
6434   
White_group +
6435   
disability_any +
6436   
genderidentity +
6437   
income +
6438   
edhi +
6439   
age,
6440   
data = datGeneric,family=binomial("logit")
6441   
)
6442   Anova(rlogG_c19vi_3, type = "III")
6443   summary(rlogG_c19vi_3)
6444   
6445   #No interaction with moderator to interpret
6446   
6447   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
6448   
6449   rlogG_c19vi_4 <- glm(c19vaxintent
~ studyarm * edhi, data =
datGeneric,family=binomial("logit"))
6450   Anova(rlogG_c19vi_4,type="III")
6451   summary(rlogG_c19vi_4)
6452   
6453   mgc19vi_4_s <- emmeans(rlogG_c19vi_4,~studyarm|edhi,type = "response")
6454   mgc19vi_4_s
6455   confint(pairs(mgc19vi_4_s,reverse = TRUE))
6456   
6457   mgc19vi_4_e <- emmeans(rlogG_c19vi_4,  ~ edhi|studyarm, type = "response")
6458   confint(pairs(mgc19vi_4_e,reverse = TRUE))
6459   
6460   
6461   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
6462   
6463   rlogG_c19vi_5 <-
6464   
glm(c19vaxintent
~ studyarm*edhi +
6465   
mean_indivhorz +
6466   
mean_indivvertical +
6467   
mean_collhorz +
6468   
mean_collvertical +
6469   
bornincanada +
6470   
language_1 +
6471   
language_2 +
6472   
Asian_group +
6473   
White_group +
6474   
disability_any +
6475   
genderidentity +
6476   
income +
6477   
age,
6478   
data = datGeneric,family=binomial("logit")
6479   
)
6480   Anova(rlogG_c19vi_5, type = "III")
6481   summary(rlogG_c19vi_5)

6482   
6483   mgc19vi_5_s <- emmeans(rlogG_c19vi_5,~studyarm|edhi,type = "response")
6484   mgc19vi_5_s
6485   confint(pairs(mgc19vi_5_s,reverse = TRUE))
6486   
6487   mgc19vi_5_e <- emmeans(rlogG_c19vi_5,  ~ edhi|studyarm, type = "response")
6488   confint(pairs(mgc19vi_5_e,reverse = TRUE))
6489   
6490   #### ++ Measles ####
6491   
6492   #### + Model 1: Check for direct effects of factors without any covariates ####
6493   
6494   options(contrasts=c("contr.sum", "contr.poly"))
6495   rlogM_c19vi_1 <- glm(c19vaxintent
~ studyarm, data =
datMeasles,family=binomial("logit"))
6496   Anova(rlogM_c19vi_1,type="III")
6497   summary(rlogM_c19vi_1)
6498   
6499   mmc19vi_1 <- emmeans(rlogM_c19vi_1,~studyarm,type = "response") #proportions
6500   mmc19vi_1
6501   confint(pairs(mmc19vi_1,reverse = TRUE)) #Odds ratios
6502   
6503   # Model 2: Check for direct effects of factors with adjustment for other covariates
6504   rlogM_c19vi_2 <-
6505   
glm(c19vaxintent
~ studyarm +
6506   
mean_indivhorz +
6507   
mean_indivvertical +
6508   
mean_collhorz +
6509   
mean_collvertical +
6510   
bornincanada +
6511   
language_1 +
6512   
language_2 +
6513   
Asian_group +
6514   
White_group +
6515   
disability_any +
6516   
genderidentity +
6517   
income +
6518   
edhi +
6519   
age,
6520   
data = datMeasles,family=binomial("logit")
6521   
)
6522   Anova(rlogM_c19vi_2, type = "III")
6523   summary(rlogM_c19vi_2)
6524   
6525   mmc19vi_2 <- emmeans(rlogM_c19vi_2,~studyarm,type = "response")
6526   mmc19vi_2
6527   confint(pairs(mmc19vi_2,reverse = TRUE))
6528   
6529   
6530   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
6531   rlogM_c19vi_3 <-
6532   
glm(c19vaxintent
~
6533   
studyarm * mean_indivhorz +
6534   
studyarm * mean_indivvertical +
6535   
studyarm * mean_collhorz +
6536   
studyarm * mean_collvertical +
6537   
bornincanada +
6538   
language_1 +
6539   
language_2 +
6540   
Asian_group +
6541   
White_group +
6542   
disability_any +
6543   
genderidentity +
6544   
income +
6545   
edhi +
6546   
age,
6547   
data = datMeasles,family=binomial("logit")
6548   
)

6549   Anova(rlogM_c19vi_3, type = "III")
6550   summary(rlogM_c19vi_3)
6551   
6552   #No interaction with moderator to interpret
6553   
6554   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
6555   
6556   rlogM_c19vi_4 <- glm(c19vaxintent
~ studyarm * edhi, data =
datMeasles,family=binomial("logit"))
6557   Anova(rlogM_c19vi_4,type="III")
6558   summary(rlogM_c19vi_4)
6559   
6560   mmc19vi_4_s <- emmeans(rlogM_c19vi_4,~studyarm|edhi,type = "response")
6561   mmc19vi_4_s
6562   confint(pairs(mmc19vi_4_s,reverse = TRUE))
6563   
6564   mmc19vi_4_e <- emmeans(rlogM_c19vi_4,  ~ edhi|studyarm, type = "response")
6565   confint(pairs(mmc19vi_4_e,reverse = TRUE))
6566   
6567   
6568   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
6569   
6570   rlogM_c19vi_5 <-
6571   
glm(c19vaxintent
~ studyarm*edhi +
6572   
mean_indivhorz +
6573   
mean_indivvertical +
6574   
mean_collhorz +
6575   
mean_collvertical +
6576   
bornincanada +
6577   
language_1 +
6578   
language_2 +
6579   
Asian_group +
6580   
White_group +
6581   
disability_any +
6582   
genderidentity +
6583   
income +
6584   
age,
6585   
data = datMeasles,family=binomial("logit")
6586   
)
6587   Anova(rlogM_c19vi_5, type = "III")
6588   summary(rlogM_c19vi_5)
6589   
6590   mmc19vi_5_s <- emmeans(rlogM_c19vi_5,~studyarm|edhi,type = "response")
6591   mmc19vi_5_s
6592   confint(pairs(mmc19vi_5_s,reverse = TRUE))
6593   
6594   mmc19vi_5_e <- emmeans(rlogM_c19vi_5,  ~ edhi|studyarm, type = "response")
6595   confint(pairs(mmc19vi_5_e,reverse = TRUE))
6596   
6597   
6598   
6599   #### ++ Flu ####
6600   
6601   #### + Model 1: Check for direct effects of factors without any covariates ####
6602   
6603   options(contrasts=c("contr.sum", "contr.poly"))
6604   rlogF_c19vi_1 <- glm(c19vaxintent
~ studyarm, data = datFlu,family=binomial("logit"))
6605   Anova(rlogF_c19vi_1,type="III")
6606   summary(rlogF_c19vi_1)
6607   
6608   mfc19vi_1 <- emmeans(rlogF_c19vi_1,~studyarm,type = "response") #proportions
6609   mfc19vi_1
6610   confint(pairs(mfc19vi_1,reverse = TRUE)) #Odds ratios
6611   
6612   
6613   # Model 2: Check for direct effects of factors with adjustment for other covariates
6614   rlogF_c19vi_2 <-
6615   
glm(c19vaxintent
~ studyarm +
6616   
mean_indivhorz +

6617   
mean_indivvertical +
6618   
mean_collhorz +
6619   
mean_collvertical +
6620   
bornincanada +
6621   
language_1 +
6622   
language_2 +
6623   
Asian_group +
6624   
White_group +
6625   
disability_any +
6626   
genderidentity +
6627   
income +
6628   
edhi +
6629   
age,
6630   
data = datFlu,family=binomial("logit")
6631   
)
6632   Anova(rlogF_c19vi_2, type = "III")
6633   summary(rlogF_c19vi_2)
6634   
6635   mfc19vi_2 <- emmeans(rlogF_c19vi_2,~studyarm,type = "response")
6636   mfc19vi_2
6637   confint(pairs(mfc19vi_2,reverse = TRUE))
6638   
6639   
6640   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
6641   rlogF_c19vi_3 <-
6642   
glm(c19vaxintent
~
6643   
studyarm * mean_indivhorz +
6644   
studyarm * mean_indivvertical +
6645   
studyarm * mean_collhorz +
6646   
studyarm * mean_collvertical +
6647   
bornincanada +
6648   
language_1 +
6649   
language_2 +
6650   
Asian_group +
6651   
White_group +
6652   
disability_any +
6653   
genderidentity +
6654   
income +
6655   
edhi +
6656   
age,
6657   
data = datFlu,family=binomial("logit")
6658   
)
6659   Anova(rlogF_c19vi_3, type = "III")
6660   summary(rlogF_c19vi_3)
6661   
6662   #No interaction with moderator to interpret
6663   
6664   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
6665   
6666   rlogF_c19vi_4 <- glm(c19vaxintent
~ studyarm * edhi, data =
datFlu,family=binomial("logit"))
6667   Anova(rlogF_c19vi_4,type="III")
6668   summary(rlogF_c19vi_4)
6669   
6670   mfc19vi_4_s <- emmeans(rlogF_c19vi_4,~studyarm|edhi,type = "response")
6671   mfc19vi_4_s
6672   confint(pairs(mfc19vi_4_s,reverse = TRUE))
6673   
6674   mfc19vi_4_e <- emmeans(rlogF_c19vi_4,  ~ edhi|studyarm, type = "response")
6675   confint(pairs(mfc19vi_4_e,reverse = TRUE))
6676   
6677   
6678   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
6679   
6680   rlogF_c19vi_5 <-
6681   
glm(c19vaxintent
~ studyarm*edhi +
6682   
mean_indivhorz +
6683   
mean_indivvertical +

6684   
mean_collhorz +
6685   
mean_collvertical +
6686   
bornincanada +
6687   
language_1 +
6688   
language_2 +
6689   
Asian_group +
6690   
White_group +
6691   
disability_any +
6692   
genderidentity +
6693   
income +
6694   
age,
6695   
data = datFlu,family=binomial("logit")
6696   
)
6697   Anova(rlogF_c19vi_5, type = "III")
6698   summary(rlogF_c19vi_5)
6699   
6700   mfc19vi_5_s <- emmeans(rlogF_c19vi_5,~studyarm|edhi,type = "response")
6701   mfc19vi_5_s
6702   confint(pairs(mfc19vi_5_s,reverse = TRUE))
6703   
6704   mfc19vi_5_e <- emmeans(rlogF_c19vi_5,  ~ edhi|studyarm, type = "response")
6705   confint(pairs(mfc19vi_5_e,reverse = TRUE))
6706   
6707   
6708   
6709   
6710   
6711   
6712   
6713   #### +++ Logistic regression for Trust Info ####
6714   
6715   #Create relevel before model to avoid problems with pairs function.
6716   datGeneric$Htrustinfo <- relevel(datGeneric$Htrustinfo,ref = "No")
6717   datMeasles$Htrustinfo <- relevel(datMeasles$Htrustinfo,ref = "No")
6718   datFlu$Htrustinfo <- relevel(datFlu$Htrustinfo,ref = "No")
6719   
6720   #### ++ Generic ####
6721   
6722   #### + Model 1: Check for direct effects of factors without any covariates ####
6723   
6724   options(contrasts=c("contr.sum", "contr.poly"))
6725   rlogG_ti_1 <- glm(Htrustinfo
~ studyarm, data = datGeneric,family=binomial("logit"))
6726   Anova(rlogG_ti_1,type="III")
6727   summary(rlogG_ti_1)
6728   
6729   mgti_1 <- emmeans(rlogG_ti_1,~studyarm,type = "response") #proportions
6730   mgti_1
6731   confint(pairs(mgti_1,reverse = TRUE)) #Odds ratios
6732   pairs(mgti_1,reverse = TRUE,type="response")
6733   
6734   # Model 2: Check for direct effects of factors with adjustment for other covariates
6735   rlogG_ti_2 <-
6736   
glm(Htrustinfo
~ studyarm +
6737   
mean_indivhorz +
6738   
mean_indivvertical +
6739   
mean_collhorz +
6740   
mean_collvertical +
6741   
bornincanada +
6742   
language_1 +
6743   
language_2 +
6744   
Asian_group +
6745   
White_group +
6746   
disability_any +
6747   
genderidentity +
6748   
income +
6749   
edhi +
6750   
age,
6751   
data = datGeneric,family=binomial("logit")
6752   
)

6753   Anova(rlogG_ti_2, type = "III")
6754   summary(rlogG_ti_2)
6755   
6756   mgti_2 <- emmeans(rlogG_ti_2,~studyarm,type = "response")
6757   mgti_2
6758   confint(pairs(mgti_2,reverse = TRUE))
6759   pairs(mgti_2,reverse = TRUE,type="response")
6760   
6761   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
6762   rlogG_ti_3 <-
6763   
glm(Htrustinfo
~
6764   
studyarm * mean_indivhorz +
6765   
studyarm * mean_indivvertical +
6766   
studyarm * mean_collhorz +
6767   
studyarm * mean_collvertical +
6768   
bornincanada +
6769   
language_1 +
6770   
language_2 +
6771   
Asian_group +
6772   
White_group +
6773   
disability_any +
6774   
genderidentity +
6775   
income +
6776   
edhi +
6777   
age,
6778   
data = datGeneric,family=binomial("logit")
6779   
)
6780   Anova(rlogG_ti_3, type = "III")
6781   summary(rlogG_ti_3)
6782   
6783   #No interaction with moderator to interpret
6784   
6785   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
6786   
6787   rlogG_ti_4 <- glm(Htrustinfo
~ studyarm * edhi, data =
datGeneric,family=binomial("logit"))
6788   Anova(rlogG_ti_4,type="III")
6789   summary(rlogG_ti_4)
6790   
6791   mgti_4_s <- emmeans(rlogG_ti_4,~studyarm|edhi,type = "response")
6792   mgti_4_s
6793   confint(pairs(mgti_4_s,reverse = TRUE))
6794   
6795   mgti_4_e <- emmeans(rlogG_ti_4,  ~ edhi|studyarm, type = "response")
6796   confint(pairs(mgti_4_e,reverse = TRUE))
6797   
6798   
6799   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
6800   
6801   rlogG_ti_5 <-
6802   
glm(Htrustinfo
~ studyarm*edhi +
6803   
mean_indivhorz +
6804   
mean_indivvertical +
6805   
mean_collhorz +
6806   
mean_collvertical +
6807   
bornincanada +
6808   
language_1 +
6809   
language_2 +
6810   
Asian_group +
6811   
White_group +
6812   
disability_any +
6813   
genderidentity +
6814   
income +
6815   
age,
6816   
data = datGeneric,family=binomial("logit")
6817   
)
6818   Anova(rlogG_ti_5, type = "III")
6819   summary(rlogG_ti_5)

6820   
6821   mgti_5_s <- emmeans(rlogG_ti_5,~studyarm|edhi,type = "response")
6822   mgti_5_s
6823   confint(pairs(mgti_5_s,reverse = TRUE))
6824   
6825   mgti_5_e <- emmeans(rlogG_ti_5,  ~ edhi|studyarm, type = "response")
6826   confint(pairs(mgti_5_e,reverse = TRUE))
6827   
6828   # Now running models on imputed data.
6829   imprlogG_ti_1 <-
6830   
with(data = datGenericImputed,
6831   
exp = glm(relevel(Htrustinfo,ref="No") ~ studyarm,family = binomial("logit")))
6832   combineimprlogG_ti_1 <- pool(imprlogG_ti_1)
6833   summary(combineimprlogG_ti_1)
6834   
6835   
6836   #### ++ Measles ####
6837   
6838   #### + Model 1: Check for direct effects of factors without any covariates ####
6839   
6840   options(contrasts=c("contr.sum", "contr.poly"))
6841   rlogM_ti_1 <- glm(Htrustinfo
~ studyarm, data = datMeasles,family=binomial("logit"))
6842   Anova(rlogM_ti_1,type="III")
6843   summary(rlogM_ti_1)
6844   
6845   mmti_1 <- emmeans(rlogM_ti_1,~studyarm,type = "response") #proportions
6846   mmti_1
6847   confint(pairs(mmti_1,reverse = TRUE)) #Odds ratios
6848   pairs(mmti_1,reverse = TRUE, type = "response")
6849   
6850   # Model 2: Check for direct effects of factors with adjustment for other covariates
6851   rlogM_ti_2 <-
6852   
glm(Htrustinfo
~ studyarm +
6853   
mean_indivhorz +
6854   
mean_indivvertical +
6855   
mean_collhorz +
6856   
mean_collvertical +
6857   
bornincanada +
6858   
language_1 +
6859   
language_2 +
6860   
Asian_group +
6861   
White_group +
6862   
disability_any +
6863   
genderidentity +
6864   
income +
6865   
edhi +
6866   
age,
6867   
data = datMeasles,family=binomial("logit")
6868   
)
6869   Anova(rlogM_ti_2, type = "III")
6870   summary(rlogM_ti_2)
6871   
6872   mmti_2 <- emmeans(rlogM_ti_2,~studyarm,type = "response")
6873   mmti_2
6874   confint(pairs(mmti_2,reverse = TRUE))
6875   pairs(mmti_2,reverse = TRUE,type = "response")
6876   
6877   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
6878   rlogM_ti_3 <-
6879   
glm(Htrustinfo
~
6880   
studyarm * mean_indivhorz +
6881   
studyarm * mean_indivvertical +
6882   
studyarm * mean_collhorz +
6883   
studyarm * mean_collvertical +
6884   
bornincanada +
6885   
language_1 +
6886   
language_2 +
6887   
Asian_group +

6888   
White_group +
6889   
disability_any +
6890   
genderidentity +
6891   
income +
6892   
edhi +
6893   
age,
6894   
data = datMeasles,family=binomial("logit")
6895   
)
6896   Anova(rlogM_ti_3, type = "III")
6897   summary(rlogM_ti_3)
6898   
6899   #No interaction with moderator to interpret
6900   
6901   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
6902   
6903   rlogM_ti_4 <- glm(Htrustinfo
~ studyarm * edhi, data =
datMeasles,family=binomial("logit"))
6904   Anova(rlogM_ti_4,type="III")
6905   summary(rlogM_ti_4)
6906   
6907   mmti_4_s <- emmeans(rlogM_ti_4,~studyarm|edhi,type = "response")
6908   mmti_4_s
6909   confint(pairs(mmti_4_s,reverse = TRUE))
6910   
6911   mmti_4_e <- emmeans(rlogM_ti_4,  ~ edhi|studyarm, type = "response")
6912   confint(pairs(mmti_4_e,reverse = TRUE))
6913   
6914   
6915   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
6916   
6917   rlogM_ti_5 <-
6918   
glm(Htrustinfo
~ studyarm*edhi +
6919   
mean_indivhorz +
6920   
mean_indivvertical +
6921   
mean_collhorz +
6922   
mean_collvertical +
6923   
bornincanada +
6924   
language_1 +
6925   
language_2 +
6926   
Asian_group +
6927   
White_group +
6928   
disability_any +
6929   
genderidentity +
6930   
income +
6931   
age,
6932   
data = datMeasles,family=binomial("logit")
6933   
)
6934   Anova(rlogM_ti_5, type = "III")
6935   summary(rlogM_ti_5)
6936   
6937   mmti_5_s <- emmeans(rlogM_ti_5,~studyarm|edhi,type = "response")
6938   mmti_5_s
6939   confint(pairs(mmti_5_s,reverse = TRUE))
6940   
6941   mmti_5_e <- emmeans(rlogM_ti_5,  ~ edhi|studyarm, type = "response")
6942   confint(pairs(mmti_5_e,reverse = TRUE))
6943   
6944   # Now running models on imputed data.
6945   #CHANGELOG ASJ: No missing data for htrustinfo in measles, no model with imputation 
performed, 21-09-20.
6946   
6947   
6948   
6949   #### ++ Flu ####
6950   
6951   #### + Model 1: Check for direct effects of factors without any covariates ####
6952   
6953   options(contrasts=c("contr.sum", "contr.poly"))
6954   rlogF_ti_1 <- glm(Htrustinfo
~ studyarm, data = datFlu,family=binomial("logit"))

6955   Anova(rlogF_ti_1,type="III")
6956   summary(rlogF_ti_1)
6957   
6958   mfti_1 <- emmeans(rlogF_ti_1,~studyarm,type = "response") #proportions
6959   mfti_1
6960   confint(pairs(mfti_1,reverse = TRUE)) #Odds ratios
6961   pairs(mfti_1,reverse = TRUE,type="response")
6962   
6963   # Model 2: Check for direct effects of factors with adjustment for other covariates
6964   rlogF_ti_2 <-
6965   
glm(Htrustinfo
~ studyarm +
6966   
mean_indivhorz +
6967   
mean_indivvertical +
6968   
mean_collhorz +
6969   
mean_collvertical +
6970   
bornincanada +
6971   
language_1 +
6972   
language_2 +
6973   
Asian_group +
6974   
White_group +
6975   
disability_any +
6976   
genderidentity +
6977   
income +
6978   
edhi +
6979   
age,
6980   
data = datFlu,family=binomial("logit")
6981   
)
6982   Anova(rlogF_ti_2, type = "III")
6983   summary(rlogF_ti_2)
6984   
6985   mfti_2 <- emmeans(rlogF_ti_2,~studyarm,type = "response")
6986   mfti_2
6987   confint(pairs(mfti_2,reverse = TRUE))
6988   pairs(mfti_2,reverse = TRUE,type="response")
6989   
6990   
6991   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
6992   rlogF_ti_3 <-
6993   
glm(Htrustinfo
~
6994   
studyarm * mean_indivhorz +
6995   
studyarm * mean_indivvertical +
6996   
studyarm * mean_collhorz +
6997   
studyarm * mean_collvertical +
6998   
bornincanada +
6999   
language_1 +
7000   
language_2 +
7001   
Asian_group +
7002   
White_group +
7003   
disability_any +
7004   
genderidentity +
7005   
income +
7006   
edhi +
7007   
age,
7008   
data = datFlu,family=binomial("logit")
7009   
)
7010   Anova(rlogF_ti_3, type = "III")
7011   summary(rlogF_ti_3)
7012   
7013   #No interaction with moderators to interpret
7014   
7015   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
7016   
7017   rlogF_ti_4 <- glm(Htrustinfo
~ studyarm * edhi, data = datFlu,family=binomial("logit"))
7018   Anova(rlogF_ti_4,type="III")
7019   summary(rlogF_ti_4)
7020   
7021   mfti_4_s <- emmeans(rlogF_ti_4,~studyarm|edhi,type = "response")
7022   mfti_4_s

7023   confint(pairs(mfti_4_s,reverse = TRUE))
7024   
7025   mfti_4_e <- emmeans(rlogF_ti_4,  ~ edhi|studyarm, type = "response")
7026   confint(pairs(mfti_4_e,reverse = TRUE))
7027   
7028   
7029   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
7030   
7031   rlogF_ti_5 <-
7032   
glm(Htrustinfo
~ studyarm*edhi +
7033   
mean_indivhorz +
7034   
mean_indivvertical +
7035   
mean_collhorz +
7036   
mean_collvertical +
7037   
bornincanada +
7038   
language_1 +
7039   
language_2 +
7040   
Asian_group +
7041   
White_group +
7042   
disability_any +
7043   
genderidentity +
7044   
income +
7045   
age,
7046   
data = datFlu,family=binomial("logit")
7047   
)
7048   Anova(rlogF_ti_5, type = "III")
7049   summary(rlogF_ti_5)
7050   
7051   mfti_5_s <- emmeans(rlogF_ti_5,~studyarm|edhi,type = "response")
7052   mfti_5_s
7053   confint(pairs(mfti_5_s,reverse = TRUE))
7054   
7055   mfti_5_e <- emmeans(rlogF_ti_5,  ~ edhi|studyarm, type = "response")
7056   confint(pairs(mfti_5_e,reverse = TRUE))
7057   
7058   # Now running models on imputed data.
7059   #CHANGELOG ASJ: No missing data for htrustinfo in flu, no model with imputation 
performed, 21-09-20.
7060   
7061   
7062   
7063   #### +++ Logistic regression for C5 Confidence ####
7064   
7065   #Create relevel before model to avoid problems with pairs function.
7066   datGeneric$mean_C5_conf2 <- relevel(as.factor(datGeneric$mean_C5_conf2),ref = "0")
7067   datMeasles$mean_C5_conf2 <- relevel(as.factor(datMeasles$mean_C5_conf2),ref = "0")
7068   datFlu$mean_C5_conf2 <- relevel(as.factor(datFlu$mean_C5_conf2),ref = "0")
7069   
7070   #### ++ Generic ####
7071   
7072   #### + Model 1: Check for direct effects of factors without any covariates ####
7073   
7074   options(contrasts=c("contr.sum", "contr.poly"))
7075   rlogG_C5conf_1 <- glm(mean_C5_conf2
~ studyarm, data =
datGeneric,family=binomial("logit"))
7076   Anova(rlogG_C5conf_1,type="III")
7077   summary(rlogG_C5conf_1)
7078   
7079   mgC5conf <- emmeans(rlogG_C5conf_1,~studyarm,type = "response") #proportions
7080   mgC5conf
7081   confint(pairs(mgC5conf,reverse = TRUE)) #Odds ratios
7082   
7083   # Model 2: Check for direct effects of factors with adjustment for other covariates
7084   rlogG_C5conf_2 <-
7085   
glm(mean_C5_conf2
~ studyarm +
7086   
mean_indivhorz +
7087   
mean_indivvertical +
7088   
mean_collhorz +
7089   
mean_collvertical +

7090   
bornincanada +
7091   
language_1 +
7092   
language_2 +
7093   
Asian_group +
7094   
White_group +
7095   
disability_any +
7096   
genderidentity +
7097   
income +
7098   
edhi +
7099   
age,
7100   
data = datGeneric,family=binomial("logit")
7101   
)
7102   Anova(rlogG_C5conf_2, type = "III")
7103   summary(rlogG_C5conf_2)
7104   
7105   mgC5conf_2 <- emmeans(rlogG_C5conf_2,~studyarm,type = "response")
7106   mgC5conf_2
7107   confint(pairs(mgC5conf_2,reverse = TRUE))
7108   
7109   
7110   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
7111   rlogG_C5conf_3 <-
7112   
glm(mean_C5_conf2
~
7113   
studyarm * mean_indivhorz +
7114   
studyarm * mean_indivvertical +
7115   
studyarm * mean_collhorz +
7116   
studyarm * mean_collvertical +
7117   
bornincanada +
7118   
language_1 +
7119   
language_2 +
7120   
Asian_group +
7121   
White_group +
7122   
disability_any +
7123   
genderidentity +
7124   
income +
7125   
edhi +
7126   
age,
7127   
data = datGeneric,family=binomial("logit")
7128   
)
7129   Anova(rlogG_C5conf_3, type = "III")
7130   summary(rlogG_C5conf_3)
7131   
7132   #No interaction with moderator to interpret
7133   
7134   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
7135   
7136   rlogG_C5conf_4 <- glm(mean_C5_conf2
~ studyarm * edhi, data =
datGeneric,family=binomial("logit"))
7137   Anova(rlogG_C5conf_4,type="III")
7138   summary(rlogG_C5conf_4)
7139   
7140   mgC5conf_4_s <- emmeans(rlogG_C5conf_4,~studyarm|edhi,type = "response")
7141   mgC5conf_4_s
7142   confint(pairs(mgC5conf_4_s,reverse = TRUE))
7143   
7144   mgC5conf_4_e <- emmeans(rlogG_C5conf_4,  ~ edhi|studyarm, type = "response")
7145   confint(pairs(mgC5conf_4_e,reverse = TRUE))
7146   
7147   
7148   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
7149   
7150   rlogG_C5conf_5 <-
7151   
glm(mean_C5_conf2
~ studyarm*edhi +
7152   
mean_indivhorz +
7153   
mean_indivvertical +
7154   
mean_collhorz +
7155   
mean_collvertical +
7156   
bornincanada +

7157   
language_1 +
7158   
language_2 +
7159   
Asian_group +
7160   
White_group +
7161   
disability_any +
7162   
genderidentity +
7163   
income +
7164   
age,
7165   
data = datGeneric,family=binomial("logit")
7166   
)
7167   Anova(rlogG_C5conf_5, type = "III")
7168   summary(rlogG_C5conf_5)
7169   
7170   mgC5conf_5_s <- emmeans(rlogG_C5conf_5,~studyarm|edhi,type = "response")
7171   mgC5conf_5_s
7172   confint(pairs(mgC5conf_5_s,reverse = TRUE))
7173   
7174   mgC5conf_5_e <- emmeans(rlogG_C5conf_5,  ~ edhi|studyarm, type = "response")
7175   confint(pairs(mgC5conf_5_e,reverse = TRUE))
7176   
7177   # Now running models on imputed data.
7178   #CHANGELOG ASJ: No missing data for c5conf, no model with imputation performed, 21-09-20.
7179   
7180   
7181   
7182   #### ++ Measles ####
7183   
7184   #### + Model 1: Check for direct effects of factors without any covariates ####
7185   
7186   options(contrasts=c("contr.sum", "contr.poly"))
7187   rlogM_C5conf_1 <- glm(mean_C5_conf2
~ studyarm, data =
datMeasles,family=binomial("logit"))
7188   Anova(rlogM_C5conf_1,type="III")
7189   summary(rlogM_C5conf_1)
7190   
7191   mmC5conf <- emmeans(rlogM_C5conf_1,~studyarm,type = "response") #proportions
7192   mmC5conf
7193   confint(pairs(mmC5conf,reverse = TRUE)) #Odds ratios
7194   
7195   # Model 2: Check for direct effects of factors with adjustment for other covariates
7196   rlogM_C5conf_2 <-
7197   
glm(mean_C5_conf2
~ studyarm +
7198   
mean_indivhorz +
7199   
mean_indivvertical +
7200   
mean_collhorz +
7201   
mean_collvertical +
7202   
bornincanada +
7203   
language_1 +
7204   
language_2 +
7205   
Asian_group +
7206   
White_group +
7207   
disability_any +
7208   
genderidentity +
7209   
income +
7210   
edhi +
7211   
age,
7212   
data = datMeasles,family=binomial("logit")
7213   
)
7214   Anova(rlogM_C5conf_2, type = "III")
7215   summary(rlogM_C5conf_2)
7216   
7217   mmC5conf_2 <- emmeans(rlogM_C5conf_2,~studyarm,type = "response")
7218   mmC5conf_2
7219   confint(pairs(mmC5conf_2,reverse = TRUE))
7220   
7221   
7222   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
7223   rlogM_C5conf_3 <-

7224   
glm(mean_C5_conf2
~
7225   
studyarm * mean_indivhorz +
7226   
studyarm * mean_indivvertical +
7227   
studyarm * mean_collhorz +
7228   
studyarm * mean_collvertical +
7229   
bornincanada +
7230   
language_1 +
7231   
language_2 +
7232   
Asian_group +
7233   
White_group +
7234   
disability_any +
7235   
genderidentity +
7236   
income +
7237   
edhi +
7238   
age,
7239   
data = datMeasles,family=binomial("logit")
7240   
)
7241   Anova(rlogM_C5conf_3, type = "III")
7242   summary(rlogM_C5conf_3)
7243   
7244   #No interaction with moderator to interpret
7245   
7246   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
7247   
7248   rlogM_C5conf_4 <- glm(mean_C5_conf2
~ studyarm * edhi, data =
datMeasles,family=binomial("logit"))
7249   Anova(rlogM_C5conf_4,type="III")
7250   summary(rlogM_C5conf_4)
7251   
7252   mmC5conf_4_s <- emmeans(rlogM_C5conf_4,~studyarm|edhi,type = "response")
7253   mmC5conf_4_s
7254   confint(pairs(mmC5conf_4_s,reverse = TRUE))
7255   
7256   mmC5conf_4_e <- emmeans(rlogM_C5conf_4,  ~ edhi|studyarm, type = "response")
7257   confint(pairs(mmC5conf_4_e,reverse = TRUE))
7258   
7259   
7260   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
7261   
7262   rlogM_C5conf_5 <-
7263   
glm(mean_C5_conf2
~ studyarm*edhi +
7264   
mean_indivhorz +
7265   
mean_indivvertical +
7266   
mean_collhorz +
7267   
mean_collvertical +
7268   
bornincanada +
7269   
language_1 +
7270   
language_2 +
7271   
Asian_group +
7272   
White_group +
7273   
disability_any +
7274   
genderidentity +
7275   
income +
7276   
age,
7277   
data = datMeasles,family=binomial("logit")
7278   
)
7279   Anova(rlogM_C5conf_5, type = "III")
7280   summary(rlogM_C5conf_5)
7281   
7282   mmC5conf_5_s <- emmeans(rlogM_C5conf_5,~studyarm|edhi,type = "response")
7283   mmC5conf_5_s
7284   confint(pairs(mmC5conf_5_s,reverse = TRUE))
7285   
7286   mmC5conf_5_e <- emmeans(rlogM_C5conf_5,  ~ edhi|studyarm, type = "response")
7287   confint(pairs(mmC5conf_5_e,reverse = TRUE))
7288   
7289   # Now running models on imputed data.
7290   #CHANGELOG ASJ: No missing data for c5conf, no model with imputation performed, 21-09-20.
7291   

7292   
7293   #### ++ Flu ####
7294   
7295   #### + Model 1: Check for direct effects of factors without any covariates ####
7296   
7297   options(contrasts=c("contr.sum", "contr.poly"))
7298   rlogF_C5conf_1 <- glm(mean_C5_conf2
~ studyarm, data = datFlu,family=binomial("logit"))
7299   Anova(rlogF_C5conf_1,type="III")
7300   summary(rlogF_C5conf_1)
7301   
7302   mfC5conf_1 <- emmeans(rlogF_C5conf_1,~studyarm,type = "response") #proportions
7303   mfC5conf_1
7304   confint(pairs(mfC5conf_1,reverse = TRUE)) #Odds ratios
7305   
7306   # Model 2: Check for direct effects of factors with adjustment for other covariates
7307   rlogF_C5conf_2 <-
7308   
glm(mean_C5_conf2
~ studyarm +
7309   
mean_indivhorz +
7310   
mean_indivvertical +
7311   
mean_collhorz +
7312   
mean_collvertical +
7313   
bornincanada +
7314   
language_1 +
7315   
language_2 +
7316   
Asian_group +
7317   
White_group +
7318   
disability_any +
7319   
genderidentity +
7320   
income +
7321   
edhi +
7322   
age,
7323   
data = datFlu,family=binomial("logit")
7324   
)
7325   Anova(rlogF_C5conf_2, type = "III")
7326   summary(rlogF_C5conf_2)
7327   
7328   mfC5conf_2 <- emmeans(rlogF_C5conf_2,~studyarm,type = "response")
7329   mfC5conf_2
7330   confint(pairs(mfC5conf_2,reverse = TRUE))
7331   
7332   
7333   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
7334   rlogF_C5conf_3 <-
7335   
glm(mean_C5_conf2
~
7336   
studyarm * mean_indivhorz +
7337   
studyarm * mean_indivvertical +
7338   
studyarm * mean_collhorz +
7339   
studyarm * mean_collvertical +
7340   
bornincanada +
7341   
language_1 +
7342   
language_2 +
7343   
Asian_group +
7344   
White_group +
7345   
disability_any +
7346   
genderidentity +
7347   
income +
7348   
edhi +
7349   
age,
7350   
data = datFlu,family=binomial("logit")
7351   
)
7352   Anova(rlogF_C5conf_3, type = "III")
7353   summary(rlogF_C5conf_3)
7354   
7355   emmip(rlogF_C5conf_3, studyarm ~ mean_indivvertical, cov.reduce = range, type =
"response")
7356   
7357   
7358   #### + Model 4: Check for interaction viz*edhi without any covariates  ####

7359   
7360   rlogF_C5conf_4 <- glm(mean_C5_conf2
~ studyarm * edhi, data =
datFlu,family=binomial("logit"))
7361   Anova(rlogF_C5conf_4,type="III")
7362   summary(rlogF_C5conf_4)
7363   
7364   mfC5conf_4_s <- emmeans(rlogF_C5conf_4,~studyarm|edhi,type = "response")
7365   mfC5conf_4_s
7366   confint(pairs(mfC5conf_4_s,reverse = TRUE))
7367   
7368   mfC5conf_4_e <- emmeans(rlogF_C5conf_4,  ~ edhi|studyarm, type = "response")
7369   confint(pairs(mfC5conf_4_e,reverse = TRUE))
7370   
7371   
7372   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
7373   
7374   rlogF_C5conf_5 <-
7375   
glm(mean_C5_conf2
~ studyarm*edhi +
7376   
mean_indivhorz +
7377   
mean_indivvertical +
7378   
mean_collhorz +
7379   
mean_collvertical +
7380   
bornincanada +
7381   
language_1 +
7382   
language_2 +
7383   
Asian_group +
7384   
White_group +
7385   
disability_any +
7386   
genderidentity +
7387   
income +
7388   
age,
7389   
data = datFlu,family=binomial("logit")
7390   
)
7391   Anova(rlogF_C5conf_5, type = "III")
7392   summary(rlogF_C5conf_5)
7393   
7394   mfC5conf_5_s <- emmeans(rlogF_C5conf_5,~studyarm|edhi,type = "response")
7395   mfC5conf_5_s
7396   confint(pairs(mfC5conf_5_s,reverse = TRUE))
7397   
7398   mfC5conf_5_e <- emmeans(rlogF_C5conf_5,  ~ edhi|studyarm, type = "response")
7399   confint(pairs(mfC5conf_5_e,reverse = TRUE))
7400   
7401   # Now running models on imputed data.
7402   #CHANGELOG ASJ: No missing data for c5conf, no model with imputation performed, 21-09-20.
7403   
7404   #### +++ Logistic regression for C5 Complacency ####
7405   
7406   #Create relevel before model to avoid problems with pairs function.
7407   datGeneric$mean_C5_comp2 <- relevel(as.factor(datGeneric$mean_C5_comp2),ref = "0")
7408   datMeasles$mean_C5_comp2 <- relevel(as.factor(datMeasles$mean_C5_comp2),ref = "0")
7409   datFlu$mean_C5_comp2 <- relevel(as.factor(datFlu$mean_C5_comp2),ref = "0")
7410   
7411   #### ++ Generic ####
7412   
7413   #### + Model 1: Check for direct effects of factors without any covariates ####
7414   
7415   options(contrasts=c("contr.sum", "contr.poly"))
7416   rlogG_C5comp_1 <- glm(mean_C5_comp2
~ studyarm, data =
datGeneric,family=binomial("logit"))
7417   Anova(rlogG_C5comp_1,type="III")
7418   summary(rlogG_C5comp_1)
7419   
7420   mgC5comp_1 <- emmeans(rlogG_C5comp_1,~studyarm,type = "response") #proportions
7421   mgC5comp_1
7422   confint(pairs(mgC5comp_1,reverse = TRUE)) #Odds ratios
7423   pairs(mgC5comp_1,reverse = TRUE)
7424   
7425   # Model 2: Check for direct effects of factors with adjustment for other covariates

7426   rlogG_C5comp_2 <-
7427   
glm(mean_C5_comp2
~ studyarm +
7428   
mean_indivhorz +
7429   
mean_indivvertical +
7430   
mean_collhorz +
7431   
mean_collvertical +
7432   
bornincanada +
7433   
language_1 +
7434   
language_2 +
7435   
Asian_group +
7436   
White_group +
7437   
disability_any +
7438   
genderidentity +
7439   
income +
7440   
edhi +
7441   
age,
7442   
data = datGeneric,family=binomial("logit")
7443   
)
7444   Anova(rlogG_C5comp_2, type = "III")
7445   summary(rlogG_C5comp_2)
7446   
7447   mgC5comp_2 <- emmeans(rlogG_C5comp_2,~studyarm,type = "response")
7448   mgC5comp_2
7449   confint(pairs(mgC5comp_2,reverse = TRUE))
7450   pairs(mgC5comp_2,reverse = TRUE)
7451   
7452   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
7453   rlogG_C5comp_3 <-
7454   
glm(mean_C5_comp2
~
7455   
studyarm * mean_indivhorz +
7456   
studyarm * mean_indivvertical +
7457   
studyarm * mean_collhorz +
7458   
studyarm * mean_collvertical +
7459   
bornincanada +
7460   
language_1 +
7461   
language_2 +
7462   
Asian_group +
7463   
White_group +
7464   
disability_any +
7465   
genderidentity +
7466   
income +
7467   
edhi +
7468   
age,
7469   
data = datGeneric,family=binomial("logit")
7470   
)
7471   Anova(rlogG_C5comp_3, type = "III")
7472   summary(rlogG_C5comp_3)
7473   
7474   #No interaction with moderator to interpret
7475   
7476   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
7477   
7478   rlogG_C5comp_4 <- glm(mean_C5_comp2
~ studyarm * edhi, data =
datGeneric,family=binomial("logit"))
7479   Anova(rlogG_C5comp_4,type="III")
7480   summary(rlogG_C5comp_4)
7481   
7482   mgC5comp_4_s <- emmeans(rlogG_C5comp_4,~studyarm|edhi,type = "response")
7483   mgC5comp_4_s
7484   confint(pairs(mgC5comp_4_s,reverse = TRUE))
7485   pairs(mgC5comp_4_s,reverse = TRUE)
7486   
7487   mgC5comp_4_e <- emmeans(rlogG_C5comp_4,  ~ edhi|studyarm, type = "response")
7488   confint(pairs(mgC5comp_4_e,reverse = TRUE))
7489   pairs(mgC5comp_4_e,reverse = TRUE)
7490   
7491   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
7492   

7493   rlogG_C5comp_5 <-
7494   
glm(mean_C5_comp2
~ studyarm*edhi +
7495   
mean_indivhorz +
7496   
mean_indivvertical +
7497   
mean_collhorz +
7498   
mean_collvertical +
7499   
bornincanada +
7500   
language_1 +
7501   
language_2 +
7502   
Asian_group +
7503   
White_group +
7504   
disability_any +
7505   
genderidentity +
7506   
income +
7507   
age,
7508   
data = datGeneric,family=binomial("logit")
7509   
)
7510   Anova(rlogG_C5comp_5, type = "III")
7511   summary(rlogG_C5comp_5)
7512   
7513   mgC5comp_5_s <- emmeans(rlogG_C5comp_5,~studyarm|edhi,type = "response")
7514   mgC5comp_5_s
7515   confint(pairs(mgC5comp_5_s,reverse = TRUE))
7516   
7517   mgC5comp_5_e <- emmeans(rlogG_C5comp_5,  ~ edhi|studyarm, type = "response")
7518   confint(pairs(mgC5comp_5_e,reverse = TRUE))
7519   
7520   # Now running models on imputed data.
7521   #CHANGELOG ASJ: No missing data for c5conf, no model with imputation performed, 21-09-20.
7522   
7523   
7524   #### ++ Measles ####
7525   
7526   #### + Model 1: Check for direct effects of factors without any covariates ####
7527   
7528   options(contrasts=c("contr.sum", "contr.poly"))
7529   rlogM_C5comp_1 <- glm(mean_C5_comp2
~ studyarm, data =
datMeasles,family=binomial("logit"))
7530   Anova(rlogM_C5comp_1,type="III")
7531   summary(rlogM_C5comp_1)
7532   
7533   mmC5comp_1 <- emmeans(rlogM_C5comp_1,~studyarm,type = "response") #proportions
7534   mmC5comp_1
7535   confint(pairs(mmC5comp_1,reverse = TRUE)) #Odds ratios
7536   
7537   # Model 2: Check for direct effects of factors with adjustment for other covariates
7538   rlogM_C5comp_2 <-
7539   
glm(mean_C5_comp2
~ studyarm +
7540   
mean_indivhorz +
7541   
mean_indivvertical +
7542   
mean_collhorz +
7543   
mean_collvertical +
7544   
bornincanada +
7545   
language_1 +
7546   
language_2 +
7547   
Asian_group +
7548   
White_group +
7549   
disability_any +
7550   
genderidentity +
7551   
income +
7552   
edhi +
7553   
age,
7554   
data = datMeasles,family=binomial("logit")
7555   
)
7556   Anova(rlogM_C5comp_2, type = "III")
7557   summary(rlogM_C5comp_2)
7558   
7559   mmC5comp_2 <- emmeans(rlogM_C5comp_2,~studyarm,type = "response")
7560   mmC5comp_2

7561   confint(pairs(mmC5comp_2,reverse = TRUE))
7562   
7563   
7564   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
7565   rlogM_C5comp_3 <-
7566   
glm(mean_C5_comp2
~
7567   
studyarm * mean_indivhorz +
7568   
studyarm * mean_indivvertical +
7569   
studyarm * mean_collhorz +
7570   
studyarm * mean_collvertical +
7571   
bornincanada +
7572   
language_1 +
7573   
language_2 +
7574   
Asian_group +
7575   
White_group +
7576   
disability_any +
7577   
genderidentity +
7578   
income +
7579   
edhi +
7580   
age,
7581   
data = datMeasles,family=binomial("logit")
7582   
)
7583   Anova(rlogM_C5comp_3, type = "III")
7584   summary(rlogM_C5comp_3)
7585   
7586   #No interaction with moderator to interpret
7587   
7588   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
7589   
7590   rlogM_C5comp_4 <- glm(mean_C5_comp2
~ studyarm * edhi, data =
datMeasles,family=binomial("logit"))
7591   Anova(rlogM_C5comp_4,type="III")
7592   summary(rlogM_C5comp_4)
7593   
7594   mmC5comp_4_s <- emmeans(rlogM_C5comp_4,~studyarm|edhi,type = "response")
7595   mmC5comp_4_s
7596   confint(pairs(mmC5comp_4_s,reverse = TRUE))
7597   
7598   mmC5comp_4_e <- emmeans(rlogM_C5comp_4,  ~ edhi|studyarm, type = "response")
7599   confint(pairs(mmC5comp_4_e,reverse = TRUE))
7600   
7601   
7602   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
7603   
7604   rlogM_C5comp_5 <-
7605   
glm(mean_C5_comp2
~ studyarm*edhi +
7606   
mean_indivhorz +
7607   
mean_indivvertical +
7608   
mean_collhorz +
7609   
mean_collvertical +
7610   
bornincanada +
7611   
language_1 +
7612   
language_2 +
7613   
Asian_group +
7614   
White_group +
7615   
disability_any +
7616   
genderidentity +
7617   
income +
7618   
age,
7619   
data = datMeasles,family=binomial("logit")
7620   
)
7621   Anova(rlogM_C5comp_5, type = "III")
7622   summary(rlogM_C5comp_5)
7623   
7624   mmC5comp_5_s <- emmeans(rlogM_C5comp_5,~studyarm|edhi,type = "response")
7625   mmC5comp_5_s
7626   confint(pairs(mmC5comp_5_s,reverse = TRUE))
7627   

7628   mmC5comp_5_e <- emmeans(rlogM_C5comp_5,  ~ edhi|studyarm, type = "response")
7629   confint(pairs(mmC5comp_5_e,reverse = TRUE))
7630   
7631   # Now running models on imputed data.
7632   #CHANGELOG ASJ: No missing data for c5conf, no model with imputation performed, 21-09-20.
7633   
7634   
7635   #### ++ Flu ####
7636   
7637   #### + Model 1: Check for direct effects of factors without any covariates ####
7638   
7639   options(contrasts=c("contr.sum", "contr.poly"))
7640   rlogF_C5comp_1 <- glm(mean_C5_comp2
~ studyarm, data = datFlu,family=binomial("logit"))
7641   Anova(rlogF_C5comp_1,type="III")
7642   summary(rlogF_C5comp_1)
7643   
7644   mfC5comp_1 <- emmeans(rlogF_C5comp_1,~studyarm,type = "response") #proportions
7645   mfC5comp_1
7646   confint(pairs(mfC5comp_1,reverse = TRUE)) #Odds ratios
7647   pairs(mfC5comp_1,reverse = TRUE)
7648   
7649   # Model 2: Check for direct effects of factors with adjustment for other covariates
7650   rlogF_C5comp_2 <-
7651   
glm(mean_C5_comp2
~ studyarm +
7652   
mean_indivhorz +
7653   
mean_indivvertical +
7654   
mean_collhorz +
7655   
mean_collvertical +
7656   
bornincanada +
7657   
language_1 +
7658   
language_2 +
7659   
Asian_group +
7660   
White_group +
7661   
disability_any +
7662   
genderidentity +
7663   
income +
7664   
edhi +
7665   
age,
7666   
data = datFlu,family=binomial("logit")
7667   
)
7668   Anova(rlogF_C5comp_2, type = "III")
7669   summary(rlogF_C5comp_2)
7670   
7671   mfC5comp_2 <- emmeans(rlogF_C5comp_2,~studyarm,type = "response")
7672   mfC5comp_2
7673   confint(pairs(mfC5comp_2,reverse = TRUE))
7674   pairs(mfC5comp_2,reverse = TRUE)
7675   
7676   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
7677   rlogF_C5comp_3 <-
7678   
glm(mean_C5_comp2
~
7679   
studyarm * mean_indivhorz +
7680   
studyarm * mean_indivvertical +
7681   
studyarm * mean_collhorz +
7682   
studyarm * mean_collvertical +
7683   
bornincanada +
7684   
language_1 +
7685   
language_2 +
7686   
Asian_group +
7687   
White_group +
7688   
disability_any +
7689   
genderidentity +
7690   
income +
7691   
edhi +
7692   
age,
7693   
data = datFlu,family=binomial("logit")
7694   
)
7695   Anova(rlogF_C5comp_3, type = "III")

7696   summary(rlogF_C5comp_3)
7697   
7698   emmip(rlogF_C5comp_3, studyarm ~ mean_collhorz, cov.reduce = range, type = "response")
7699   
7700   
7701   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
7702   
7703   rlogF_C5comp_4 <- glm(mean_C5_comp2
~ studyarm * edhi, data =
datFlu,family=binomial("logit"))
7704   Anova(rlogF_C5comp_4,type="III")
7705   summary(rlogF_C5comp_4)
7706   
7707   mfC5comp_4_s <- emmeans(rlogF_C5comp_4,~studyarm|edhi,type = "response")
7708   mfC5comp_4_s
7709   confint(pairs(mfC5comp_4_s,reverse = TRUE))
7710   
7711   mfC5comp_4_e <- emmeans(rlogF_C5comp_4,  ~ edhi|studyarm, type = "response")
7712   confint(pairs(mfC5comp_4_e,reverse = TRUE))
7713   
7714   
7715   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
7716   
7717   rlogF_C5comp_5 <-
7718   
glm(mean_C5_comp2
~ studyarm*edhi +
7719   
mean_indivhorz +
7720   
mean_indivvertical +
7721   
mean_collhorz +
7722   
mean_collvertical +
7723   
bornincanada +
7724   
language_1 +
7725   
language_2 +
7726   
Asian_group +
7727   
White_group +
7728   
disability_any +
7729   
genderidentity +
7730   
income +
7731   
age,
7732   
data = datFlu,family=binomial("logit")
7733   
)
7734   Anova(rlogF_C5comp_5, type = "III")
7735   summary(rlogF_C5comp_5)
7736   
7737   mfC5comp_5_s <- emmeans(rlogF_C5comp_5,~studyarm|edhi,type = "response")
7738   mfC5comp_5_s
7739   confint(pairs(mfC5comp_5_s,reverse = TRUE))
7740   
7741   mfC5comp_5_e <- emmeans(rlogF_C5comp_5,  ~ edhi|studyarm, type = "response")
7742   confint(pairs(mfC5comp_5_e,reverse = TRUE))
7743   
7744   # Now running models on imputed data.
7745   #CHANGELOG ASJ: No missing data for c5conf, no model with imputation performed, 21-09-20.
7746   
7747   
7748   #### +++ Logistic regression for C5 Constraints ####
7749   
7750   #Create relevel before model to avoid problems with pairs function.
7751   datGeneric$mean_C5_cons2 <- relevel(as.factor(datGeneric$mean_C5_cons2),ref = "0")
7752   datMeasles$mean_C5_cons2 <- relevel(as.factor(datMeasles$mean_C5_cons2),ref = "0")
7753   datFlu$mean_C5_cons2 <- relevel(as.factor(datFlu$mean_C5_cons2),ref = "0")
7754   
7755   #### ++ Generic ####
7756   
7757   #### + Model 1: Check for direct effects of factors without any covariates ####
7758   
7759   options(contrasts=c("contr.sum", "contr.poly"))
7760   rlogG_C5cons_1 <- glm(mean_C5_cons2
~ studyarm, data =
datGeneric,family=binomial("logit"))
7761   Anova(rlogG_C5cons_1,type="III")
7762   summary(rlogG_C5cons_1)

7763   
7764   mgC5cons_1 <- emmeans(rlogG_C5cons_1,~studyarm,type = "response") #proportions
7765   mgC5cons_1
7766   confint(pairs(mgC5cons_1,reverse = TRUE)) #Odds ratios
7767   pairs(mgC5cons_1,reverse = TRUE)
7768   
7769   # Model 2: Check for direct effects of factors with adjustment for other covariates
7770   rlogG_C5cons_2 <-
7771   
glm(mean_C5_cons2
~ studyarm +
7772   
mean_indivhorz +
7773   
mean_indivvertical +
7774   
mean_collhorz +
7775   
mean_collvertical +
7776   
bornincanada +
7777   
language_1 +
7778   
language_2 +
7779   
Asian_group +
7780   
White_group +
7781   
disability_any +
7782   
genderidentity +
7783   
income +
7784   
edhi +
7785   
age,
7786   
data = datGeneric,family=binomial("logit")
)
7787   Anova(rlogG_C5cons_2, type = "III")
7788   summary(rlogG_C5cons_2)
7789   
7790   mgC5cons_2 <- emmeans(rlogG_C5cons_2,~studyarm,type = "response")
7791   mgC5cons_2
7792   confint(pairs(mgC5cons_2,reverse = TRUE))
7793   pairs(mgC5cons_2,reverse = TRUE)
7794   
7795   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
7796   rlogG_C5cons_3 <-
7797   
glm(mean_C5_cons2
~
7798   
studyarm * mean_indivhorz +
7799   
studyarm * mean_indivvertical +
7800   
studyarm * mean_collhorz +
7801   
studyarm * mean_collvertical +
7802   
bornincanada +
7803   
language_1 +
7804   
language_2 +
7805   
Asian_group +
7806   
White_group +
7807   
disability_any +
7808   
genderidentity +
7809   
income +
7810   
edhi +
7811   
age,
7812   
data = datGeneric,family=binomial("logit")
7813   
)
7814   Anova(rlogG_C5cons_3, type = "III")
7815   summary(rlogG_C5cons_3)
7816   
7817   emmip(rlogG_C5cons_3, studyarm ~ mean_indivvertical, cov.reduce = range, type =
"response")
7818   
7819   
7820   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
7821   
7822   rlogG_C5cons_4 <- glm(mean_C5_cons2
~ studyarm * edhi, data =
datGeneric,family=binomial("logit"))
7823   Anova(rlogG_C5cons_4,type="III")
7824   summary(rlogG_C5cons_4)
7825   
7826   mgC5cons_4_s <- emmeans(rlogG_C5cons_4,~studyarm|edhi,type = "response")
7827   mgC5cons_4_s
7828   confint(pairs(mgC5cons_4_s,reverse = TRUE))

7829   
7830   mgC5cons_4_e <- emmeans(rlogG_C5cons_4,  ~ edhi|studyarm, type = "response")
7831   confint(pairs(mgC5cons_4_e,reverse = TRUE))
7832   
7833   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
7834   
7835   rlogG_C5cons_5 <-
7836   
glm(mean_C5_cons2
~ studyarm*edhi +
7837   
mean_indivhorz +
7838   
mean_indivvertical +
7839   
mean_collhorz +
7840   
mean_collvertical +
7841   
bornincanada +
7842   
language_1 +
7843   
language_2 +
7844   
Asian_group +
7845   
White_group +
7846   
disability_any +
7847   
genderidentity +
7848   
income +
7849   
age,
7850   
data = datGeneric,family=binomial("logit")
7851   
)
7852   Anova(rlogG_C5cons_5, type = "III")
7853   summary(rlogG_C5cons_5)
7854   
7855   mgC5cons_5_s <- emmeans(rlogG_C5cons_5,~studyarm|edhi,type = "response")
7856   mgC5cons_5_s
7857   confint(pairs(mgC5cons_5_s,reverse = TRUE))
7858   
7859   mgC5cons_5_e <- emmeans(rlogG_C5cons_5,  ~ edhi|studyarm, type = "response")
7860   confint(pairs(mgC5cons_5_e,reverse = TRUE))
7861   
7862   # Now running models on imputed data.
7863   #CHANGELOG ASJ: No missing data for c5conf, no model with imputation performed, 21-09-20.
7864   
7865   
7866   #### ++ Measles ####
7867   
7868   #### + Model 1: Check for direct effects of factors without any covariates ####
7869   
7870   options(contrasts=c("contr.sum", "contr.poly"))
7871   rlogM_C5cons_1 <- glm(mean_C5_cons2
~ studyarm, data =
datMeasles,family=binomial("logit"))
7872   Anova(rlogM_C5cons_1,type="III")
7873   summary(rlogM_C5cons_1)
7874   
7875   mmC5cons_1 <- emmeans(rlogM_C5cons_1,~studyarm,type = "response") #proportions
7876   mmC5cons_1
7877   confint(pairs(mmC5cons_1,reverse = TRUE)) #Odds ratios
7878   
7879   # Model 2: Check for direct effects of factors with adjustment for other covariates
7880   rlogM_C5cons_2 <-
7881   
glm(mean_C5_cons2
~ studyarm +
7882   
mean_indivhorz +
7883   
mean_indivvertical +
7884   
mean_collhorz +
7885   
mean_collvertical +
7886   
bornincanada +
7887   
language_1 +
7888   
language_2 +
7889   
Asian_group +
7890   
White_group +
7891   
disability_any +
7892   
genderidentity +
7893   
income +
7894   
edhi +
7895   
age,
7896   
data = datMeasles,family=binomial("logit")

7897   
)
7898   Anova(rlogM_C5cons_2, type = "III")
7899   summary(rlogM_C5cons_2)
7900   
7901   mmC5cons_2 <- emmeans(rlogM_C5cons_2,~studyarm,type = "response")
7902   mmC5cons_2
7903   confint(pairs(mmC5cons_2,reverse = TRUE))
7904   
7905   
7906   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
7907   rlogM_C5cons_3 <-
7908   
glm(mean_C5_cons2
~
7909   
studyarm * mean_indivhorz +
7910   
studyarm * mean_indivvertical +
7911   
studyarm * mean_collhorz +
7912   
studyarm * mean_collvertical +
7913   
bornincanada +
7914   
language_1 +
7915   
language_2 +
7916   
Asian_group +
7917   
White_group +
7918   
disability_any +
7919   
genderidentity +
7920   
income +
7921   
edhi +
7922   
age,
7923   
data = datMeasles,family=binomial("logit")
7924   
)
7925   Anova(rlogM_C5cons_3, type = "III")
7926   summary(rlogM_C5cons_3)
7927   
7928   emmip(rlogM_C5cons_3, studyarm ~ mean_indivvertical, cov.reduce = range, type =
"response")
7929   
7930   
7931   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
7932   
7933   rlogM_C5cons_4 <- glm(mean_C5_cons2
~ studyarm * edhi, data =
datMeasles,family=binomial("logit"))
7934   Anova(rlogM_C5cons_4,type="III")
7935   summary(rlogM_C5cons_4)
7936   
7937   mmC5cons_4_s <- emmeans(rlogM_C5cons_4,~studyarm|edhi,type = "response")
7938   mmC5cons_4_s
7939   confint(pairs(mmC5cons_4_s,reverse = TRUE))
7940   
7941   mmC5cons_4_e <- emmeans(rlogM_C5cons_4,  ~ edhi|studyarm, type = "response")
7942   confint(pairs(mmC5cons_4_e,reverse = TRUE))
7943   
7944   
7945   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
7946   
7947   rlogM_C5cons_5 <-
7948   
glm(mean_C5_cons2
~ studyarm*edhi +
7949   
mean_indivhorz +
7950   
mean_indivvertical +
7951   
mean_collhorz +
7952   
mean_collvertical +
7953   
bornincanada +
7954   
language_1 +
7955   
language_2 +
7956   
Asian_group +
7957   
White_group +
7958   
disability_any +
7959   
genderidentity +
7960   
income +
7961   
age,
7962   
data = datMeasles,family=binomial("logit")

7963   
)
7964   Anova(rlogM_C5cons_5, type = "III")
7965   summary(rlogM_C5cons_5)
7966   
7967   mmC5cons_5_s <- emmeans(rlogM_C5cons_5,~studyarm|edhi,type = "response")
7968   mmC5cons_5_s
7969   confint(pairs(mmC5cons_5_s,reverse = TRUE))
7970   
7971   mmC5cons_5_e <- emmeans(rlogM_C5cons_5,  ~ edhi|studyarm, type = "response")
7972   confint(pairs(mmC5cons_5_e,reverse = TRUE))
7973   
7974   # Now running models on imputed data.
7975   #CHANGELOG ASJ: No missing data for c5conf, no model with imputation performed, 21-09-20.
7976   
7977   
7978   #### ++ Flu ####
7979   
7980   #### + Model 1: Check for direct effects of factors without any covariates ####
7981   
7982   options(contrasts=c("contr.sum", "contr.poly"))
7983   rlogF_C5cons_1 <- glm(mean_C5_cons2
~ studyarm, data = datFlu,family=binomial("logit"))
7984   Anova(rlogF_C5cons_1,type="III")
7985   summary(rlogF_C5cons_1)
7986   
7987   mfC5cons_1 <- emmeans(rlogF_C5cons_1,~studyarm,type = "response") #proportions
7988   mfC5cons_1
7989   confint(pairs(mfC5cons_1,reverse = TRUE)) #Odds ratios
7990   
7991   # Model 2: Check for direct effects of factors with adjustment for other covariates
7992   rlogF_C5cons_2 <-
7993   
glm(mean_C5_cons2
~ studyarm +
7994   
mean_indivhorz +
7995   
mean_indivvertical +
7996   
mean_collhorz +
7997   
mean_collvertical +
7998   
bornincanada +
7999   
language_1 +
8000   
language_2 +
8001   
Asian_group +
8002   
White_group +
8003   
disability_any +
8004   
genderidentity +
8005   
income +
8006   
edhi +
8007   
age,
8008   
data = datFlu,family=binomial("logit")
8009   
)
8010   Anova(rlogF_C5cons_2, type = "III")
8011   summary(rlogF_C5cons_2)
8012   
8013   mfC5cons_2 <- emmeans(rlogF_C5cons_2,~studyarm,type = "response")
8014   mfC5cons_2
8015   confint(pairs(mfC5cons_2,reverse = TRUE))
8016   pairs(mfC5cons_2,reverse = TRUE)
8017   
8018   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
8019   rlogF_C5cons_3 <-
8020   
glm(mean_C5_cons2
~
8021   
studyarm * mean_indivhorz +
8022   
studyarm * mean_indivvertical +
8023   
studyarm * mean_collhorz +
8024   
studyarm * mean_collvertical +
8025   
bornincanada +
8026   
language_1 +
8027   
language_2 +
8028   
Asian_group +
8029   
White_group +
8030   
disability_any +

8031   
genderidentity +
8032   
income +
8033   
edhi +
8034   
age,
8035   
data = datFlu,family=binomial("logit")
8036   
)
8037   Anova(rlogF_C5cons_3, type = "III")
8038   summary(rlogF_C5cons_3)
8039   
8040   emmip(rlogF_C5cons_3, studyarm ~ mean_collhorz, cov.reduce = range, type = "response")
8041   
8042   
8043   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
8044   
8045   rlogF_C5cons_4 <- glm(mean_C5_cons2
~ studyarm * edhi, data =
datFlu,family=binomial("logit"))
8046   Anova(rlogF_C5cons_4,type="III")
8047   summary(rlogF_C5cons_4)
8048   
8049   mfC5cons_4_s <- emmeans(rlogF_C5cons_4,~studyarm|edhi,type = "response")
8050   mfC5cons_4_s
8051   confint(pairs(mfC5cons_4_s,reverse = TRUE))
8052   
8053   mfC5cons_4_e <- emmeans(rlogF_C5cons_4,  ~ edhi|studyarm, type = "response")
8054   confint(pairs(mfC5cons_4_e,reverse = TRUE))
8055   
8056   
8057   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
8058   
8059   rlogF_C5cons_5 <-
8060   
glm(mean_C5_cons2
~ studyarm*edhi +
8061   
mean_indivhorz +
8062   
mean_indivvertical +
8063   
mean_collhorz +
8064   
mean_collvertical +
8065   
bornincanada +
8066   
language_1 +
8067   
language_2 +
8068   
Asian_group +
8069   
White_group +
8070   
disability_any +
8071   
genderidentity +
8072   
income +
8073   
age,
8074   
data = datFlu,family=binomial("logit")
8075   
)
8076   Anova(rlogF_C5cons_5, type = "III")
8077   summary(rlogF_C5cons_5)
8078   
8079   mfC5cons_5_s <- emmeans(rlogF_C5cons_5,~studyarm|edhi,type = "response")
8080   mfC5cons_5_s
8081   confint(pairs(mfC5cons_5_s,reverse = TRUE))
8082   
8083   mfC5cons_5_e <- emmeans(rlogF_C5cons_5,  ~ edhi|studyarm, type = "response")
8084   confint(pairs(mfC5cons_5_e,reverse = TRUE))
8085   
8086   
8087   # Now running models on imputed data.
8088   #CHANGELOG ASJ: No missing data for c5conf, no model with imputation performed, 21-09-20.
8089   
8090   #### +++ Logistic regression for C5 Calculation ####
8091   
8092   #Create relevel before model to avoid problems with pairs function.
8093   datGeneric$mean_C5_calc2 <- relevel(as.factor(datGeneric$mean_C5_calc2),ref = "0")
8094   datMeasles$mean_C5_calc2 <- relevel(as.factor(datMeasles$mean_C5_calc2),ref = "0")
8095   datFlu$mean_C5_calc2 <- relevel(as.factor(datFlu$mean_C5_calc2),ref = "0")
8096   
8097   #### ++ Generic ####
8098   

8099   #### + Model 1: Check for direct effects of factors without any covariates ####
8100   
8101   options(contrasts=c("contr.sum", "contr.poly"))
8102   rlogG_C5calc_1 <- glm(mean_C5_calc2
~ studyarm, data =
datGeneric,family=binomial("logit"))
8103   Anova(rlogG_C5calc_1,type="III")
8104   summary(rlogG_C5calc_1)
8105   
8106   mgC5calc_1 <- emmeans(rlogG_C5calc_1,~studyarm,type = "response") #proportions
8107   mgC5calc_1
8108   confint(pairs(mgC5calc_1,reverse = TRUE)) #Odds ratios
8109   
8110   # Model 2: Check for direct effects of factors with adjustment for other covariates
8111   rlogG_C5calc_2 <-
8112   
glm(mean_C5_calc2
~ studyarm +
8113   
mean_indivhorz +
8114   
mean_indivvertical +
8115   
mean_collhorz +
8116   
mean_collvertical +
8117   
bornincanada +
8118   
language_1 +
8119   
language_2 +
8120   
Asian_group +
8121   
White_group +
8122   
disability_any +
8123   
genderidentity +
8124   
income +
8125   
edhi +
8126   
age,
8127   
data = datGeneric,family=binomial("logit")
)
8128   Anova(rlogG_C5calc_2, type = "III")
8129   summary(rlogG_C5calc_2)
8130   
8131   mgC5calc_2 <- emmeans(rlogG_C5calc_2,~studyarm,type = "response")
8132   mgC5calc_2
8133   confint(pairs(mgC5calc_2,reverse = TRUE))
8134   
8135   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
8136   rlogG_C5calc_3 <-
8137   
glm(mean_C5_calc2
~
8138   
studyarm * mean_indivhorz +
8139   
studyarm * mean_indivvertical +
8140   
studyarm * mean_collhorz +
8141   
studyarm * mean_collvertical +
8142   
bornincanada +
8143   
language_1 +
8144   
language_2 +
8145   
Asian_group +
8146   
White_group +
8147   
disability_any +
8148   
genderidentity +
8149   
income +
8150   
edhi +
8151   
age,
8152   
data = datGeneric,family=binomial("logit")
8153   
)
8154   Anova(rlogG_C5calc_3, type = "III")
8155   summary(rlogG_C5calc_3)
8156   
8157   #No interaction to interpret
8158   
8159   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
8160   
8161   rlogG_C5calc_4 <- glm(mean_C5_calc2
~ studyarm * edhi, data =
datGeneric,family=binomial("logit"))
8162   Anova(rlogG_C5calc_4,type="III")
8163   summary(rlogG_C5calc_4)
8164   

8165   mgC5calc_4_s <- emmeans(rlogG_C5calc_4,~studyarm|edhi,type = "response")
8166   mgC5calc_4_s
8167   confint(pairs(mgC5calc_4_s,reverse = TRUE))
8168   
8169   mgC5calc_4_e <- emmeans(rlogG_C5calc_4,  ~ edhi|studyarm, type = "response")
8170   confint(pairs(mgC5calc_4_e,reverse = TRUE))
8171   
8172   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
8173   
8174   rlogG_C5calc_5 <-
8175   
glm(mean_C5_calc2
~ studyarm*edhi +
8176   
mean_indivhorz +
8177   
mean_indivvertical +
8178   
mean_collhorz +
8179   
mean_collvertical +
8180   
bornincanada +
8181   
language_1 +
8182   
language_2 +
8183   
Asian_group +
8184   
White_group +
8185   
disability_any +
8186   
genderidentity +
8187   
income +
8188   
age,
8189   
data = datGeneric,family=binomial("logit")
8190   
)
8191   Anova(rlogG_C5calc_5, type = "III")
8192   summary(rlogG_C5calc_5)
8193   
8194   mgC5calc_5_s <- emmeans(rlogG_C5calc_5,~studyarm|edhi,type = "response")
8195   mgC5calc_5_s
8196   confint(pairs(mgC5calc_5_s,reverse = TRUE))
8197   
8198   mgC5calc_5_e <- emmeans(rlogG_C5calc_5,  ~ edhi|studyarm, type = "response")
8199   confint(pairs(mgC5calc_5_e,reverse = TRUE))
8200   
8201   # Now running models on imputed data.
8202   #CHANGELOG ASJ: No missing data for c5conf, no model with imputation performed, 21-09-20.
8203   
8204   
8205   #### ++ Measles ####
8206   
8207   #### + Model 1: Check for direct effects of factors without any covariates ####
8208   
8209   options(contrasts=c("contr.sum", "contr.poly"))
8210   rlogM_C5calc_1 <- glm(mean_C5_calc2
~ studyarm, data =
datMeasles,family=binomial("logit"))
8211   Anova(rlogM_C5calc_1,type="III")
8212   summary(rlogM_C5calc_1)
8213   
8214   mmC5calc_1 <- emmeans(rlogM_C5calc_1,~studyarm,type = "response") #proportions
8215   mmC5calc_1
8216   confint(pairs(mmC5calc_1,reverse = TRUE)) #Odds ratios
8217   pairs(mmC5calc_1,reverse = TRUE)
8218   
8219   # Model 2: Check for direct effects of factors with adjustment for other covariates
8220   rlogM_C5calc_2 <-
8221   
glm(mean_C5_calc2
~ studyarm +
8222   
mean_indivhorz +
8223   
mean_indivvertical +
8224   
mean_collhorz +
8225   
mean_collvertical +
8226   
bornincanada +
8227   
language_1 +
8228   
language_2 +
8229   
Asian_group +
8230   
White_group +
8231   
disability_any +
8232   
genderidentity +

8233   
income +
8234   
edhi +
8235   
age,
8236   
data = datMeasles,family=binomial("logit")
8237   
)
8238   Anova(rlogM_C5calc_2, type = "III")
8239   summary(rlogM_C5calc_2)
8240   
8241   mmC5calc_2 <- emmeans(rlogM_C5calc_2,~studyarm,type = "response")
8242   mmC5calc_2
8243   confint(pairs(mmC5calc_2,reverse = TRUE))
8244   
8245   
8246   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
8247   rlogM_C5calc_3 <-
8248   
glm(mean_C5_calc2
~
8249   
studyarm * mean_indivhorz +
8250   
studyarm * mean_indivvertical +
8251   
studyarm * mean_collhorz +
8252   
studyarm * mean_collvertical +
8253   
bornincanada +
8254   
language_1 +
8255   
language_2 +
8256   
Asian_group +
8257   
White_group +
8258   
disability_any +
8259   
genderidentity +
8260   
income +
8261   
edhi +
8262   
age,
8263   
data = datMeasles,family=binomial("logit")
8264   
)
8265   Anova(rlogM_C5calc_3, type = "III")
8266   summary(rlogM_C5calc_3)
8267   
8268   #No interaction to interpret
8269   
8270   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
8271   
8272   rlogM_C5calc_4 <- glm(mean_C5_calc2
~ studyarm * edhi, data =
datMeasles,family=binomial("logit"))
8273   Anova(rlogM_C5calc_4,type="III")
8274   summary(rlogM_C5calc_4)
8275   
8276   mmC5calc_4_s <- emmeans(rlogM_C5calc_4,~studyarm|edhi,type = "response")
8277   mmC5calc_4_s
8278   confint(pairs(mmC5calc_4_s,reverse = TRUE))
8279   
8280   mmC5calc_4_e <- emmeans(rlogM_C5calc_4,  ~ edhi|studyarm, type = "response")
8281   confint(pairs(mmC5calc_4_e,reverse = TRUE))
8282   
8283   
8284   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
8285   
8286   rlogM_C5calc_5 <-
8287   
glm(mean_C5_calc2
~ studyarm*edhi +
8288   
mean_indivhorz +
8289   
mean_indivvertical +
8290   
mean_collhorz +
8291   
mean_collvertical +
8292   
bornincanada +
8293   
language_1 +
8294   
language_2 +
8295   
Asian_group +
8296   
White_group +
8297   
disability_any +
8298   
genderidentity +
8299   
income +

8300   
age,
8301   
data = datMeasles,family=binomial("logit")
8302   
)
8303   Anova(rlogM_C5calc_5, type = "III")
8304   summary(rlogM_C5calc_5)
8305   
8306   mmC5calc_5_s <- emmeans(rlogM_C5calc_5,~studyarm|edhi,type = "response")
8307   mmC5calc_5_s
8308   confint(pairs(mmC5calc_5_s,reverse = TRUE))
8309   
8310   mmC5calc_5_e <- emmeans(rlogM_C5calc_5,  ~ edhi|studyarm, type = "response")
8311   confint(pairs(mmC5calc_5_e,reverse = TRUE))
8312   
8313   # Now running models on imputed data.
8314   #CHANGELOG ASJ: No missing data for c5conf, no model with imputation performed, 21-09-20.
8315   
8316   
8317   #### ++ Flu ####
8318   
8319   #### + Model 1: Check for direct effects of factors without any covariates ####
8320   
8321   options(contrasts=c("contr.sum", "contr.poly"))
8322   rlogF_C5calc_1 <- glm(mean_C5_calc2
~ studyarm, data = datFlu,family=binomial("logit"))
8323   Anova(rlogF_C5calc_1,type="III")
8324   summary(rlogF_C5calc_1)
8325   
8326   mfC5calc_1 <- emmeans(rlogF_C5calc_1,~studyarm,type = "response") #proportions
8327   mfC5calc_1
8328   confint(pairs(mfC5calc_1,reverse = TRUE)) #Odds ratios
8329   
8330   # Model 2: Check for direct effects of factors with adjustment for other covariates
8331   rlogF_C5calc_2 <-
8332   
glm(mean_C5_calc2
~ studyarm +
8333   
mean_indivhorz +
8334   
mean_indivvertical +
8335   
mean_collhorz +
8336   
mean_collvertical +
8337   
bornincanada +
8338   
language_1 +
8339   
language_2 +
8340   
Asian_group +
8341   
White_group +
8342   
disability_any +
8343   
genderidentity +
8344   
income +
8345   
edhi +
8346   
age,
8347   
data = datFlu,family=binomial("logit")
8348   
)
8349   Anova(rlogF_C5calc_2, type = "III")
8350   summary(rlogF_C5calc_2)
8351   
8352   mfC5calc_2 <- emmeans(rlogF_C5calc_2,~studyarm,type = "response")
8353   mfC5calc_2
8354   confint(pairs(mfC5calc_2,reverse = TRUE))
8355   
8356   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
8357   rlogF_C5calc_3 <-
8358   
glm(mean_C5_calc2
~
8359   
studyarm * mean_indivhorz +
8360   
studyarm * mean_indivvertical +
8361   
studyarm * mean_collhorz +
8362   
studyarm * mean_collvertical +
8363   
bornincanada +
8364   
language_1 +
8365   
language_2 +
8366   
Asian_group +
8367   
White_group +

8368   
disability_any +
8369   
genderidentity +
8370   
income +
8371   
edhi +
8372   
age,
8373   
data = datFlu,family=binomial("logit")
8374   
)
8375   Anova(rlogF_C5calc_3, type = "III")
8376   summary(rlogF_C5calc_3)
8377   
8378   #No interaction to interpret
8379   
8380   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
8381   
8382   rlogF_C5calc_4 <- glm(mean_C5_calc2
~ studyarm * edhi, data =
datFlu,family=binomial("logit"))
8383   Anova(rlogF_C5calc_4,type="III")
8384   summary(rlogF_C5calc_4)
8385   
8386   mfC5calc_4_s <- emmeans(rlogF_C5calc_4,~studyarm|edhi,type = "response")
8387   mfC5calc_4_s
8388   confint(pairs(mfC5calc_4_s,reverse = TRUE))
8389   
8390   mfC5calc_4_e <- emmeans(rlogF_C5calc_4,  ~ edhi|studyarm, type = "response")
8391   confint(pairs(mfC5calc_4_e,reverse = TRUE))
8392   
8393   
8394   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
8395   
8396   rlogF_C5calc_5 <-
8397   
glm(mean_C5_calc2
~ studyarm*edhi +
8398   
mean_indivhorz +
8399   
mean_indivvertical +
8400   
mean_collhorz +
8401   
mean_collvertical +
8402   
bornincanada +
8403   
language_1 +
8404   
language_2 +
8405   
Asian_group +
8406   
White_group +
8407   
disability_any +
8408   
genderidentity +
8409   
income +
8410   
age,
8411   
data = datFlu,family=binomial("logit")
8412   
)
8413   Anova(rlogF_C5calc_5, type = "III")
8414   summary(rlogF_C5calc_5)
8415   
8416   mfC5calc_5_s <- emmeans(rlogF_C5calc_5,~studyarm|edhi,type = "response")
8417   mfC5calc_5_s
8418   confint(pairs(mfC5calc_5_s,reverse = TRUE))
8419   
8420   mfC5calc_5_e <- emmeans(rlogF_C5calc_5,  ~ edhi|studyarm, type = "response")
8421   confint(pairs(mfC5calc_5_e,reverse = TRUE))
8422   
8423   # Now running models on imputed data.
8424   #CHANGELOG ASJ: No missing data for c5conf, no model with imputation performed, 21-09-20.
8425   
8426   
8427   
8428   #### +++ Logistic regression for C5 Collective Response ####
8429   
8430   #Create relevel before model to avoid problems with pairs function.
8431   datGeneric$mean_C5_coll2 <- relevel(as.factor(datGeneric$mean_C5_coll2),ref = "0")
8432   datMeasles$mean_C5_coll2 <- relevel(as.factor(datMeasles$mean_C5_coll2),ref = "0")
8433   datFlu$mean_C5_coll2 <- relevel(as.factor(datFlu$mean_C5_coll2),ref = "0")
8434   
8435   #### ++ Generic ####

8436   
8437   #### + Model 1: Check for direct effects of factors without any covariates ####
8438   
8439   options(contrasts=c("contr.sum", "contr.poly"))
8440   rlogG_C5coll_1 <- glm(mean_C5_coll2
~ studyarm, data =
datGeneric,family=binomial("logit"))
8441   Anova(rlogG_C5coll_1,type="III")
8442   summary(rlogG_C5coll_1)
8443   
8444   mgC5coll_1 <- emmeans(rlogG_C5coll_1,~studyarm,type = "response") #proportions
8445   mgC5coll_1
8446   confint(pairs(mgC5coll_1,reverse = TRUE)) #Odds ratios
8447   pairs(mgC5coll_1,reverse = TRUE)
8448   
8449   
8450   # Model 2: Check for direct effects of factors with adjustment for other covariates
8451   rlogG_C5coll_2 <-
8452   
glm(mean_C5_coll2
~ studyarm +
8453   
mean_indivhorz +
8454   
mean_indivvertical +
8455   
mean_collhorz +
8456   
mean_collvertical +
8457   
bornincanada +
8458   
language_1 +
8459   
language_2 +
8460   
Asian_group +
8461   
White_group +
8462   
disability_any +
8463   
genderidentity +
8464   
income +
8465   
edhi +
8466   
age,
8467   
data = datGeneric,family=binomial("logit")
)
8468   Anova(rlogG_C5coll_2, type = "III")
8469   summary(rlogG_C5coll_2)
8470   
8471   mgC5coll_2 <- emmeans(rlogG_C5coll_2,~studyarm,type = "response")
8472   mgC5coll_2
8473   confint(pairs(mgC5coll_2,reverse = TRUE))
8474   pairs(mgC5coll_2,reverse = TRUE)
8475   
8476   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
8477   rlogG_C5coll_3 <-
8478   
glm(mean_C5_coll2
~
8479   
studyarm * mean_indivhorz +
8480   
studyarm * mean_indivvertical +
8481   
studyarm * mean_collhorz +
8482   
studyarm * mean_collvertical +
8483   
bornincanada +
8484   
language_1 +
8485   
language_2 +
8486   
Asian_group +
8487   
White_group +
8488   
disability_any +
8489   
genderidentity +
8490   
income +
8491   
edhi +
8492   
age,
8493   
data = datGeneric,family=binomial("logit")
8494   
)
8495   Anova(rlogG_C5coll_3, type = "III")
8496   summary(rlogG_C5coll_3)
8497   
8498   emmip(rlogG_C5coll_3, studyarm ~ mean_indivvertical, cov.reduce = range, type =
"response")
8499   emmip(rlogG_C5coll_3, studyarm ~ mean_collhorz, cov.reduce = range, type = "response")
8500   
8501   #### + Model 4: Check for interaction viz*edhi without any covariates  ####

8502   
8503   rlogG_C5coll_4 <- glm(mean_C5_coll2
~ studyarm * edhi, data =
datGeneric,family=binomial("logit"))
8504   Anova(rlogG_C5coll_4,type="III")
8505   summary(rlogG_C5coll_4)
8506   
8507   mgC5coll_4_s <- emmeans(rlogG_C5coll_4,~studyarm|edhi,type = "response")
8508   mgC5coll_4_s
8509   confint(pairs(mgC5coll_4_s,reverse = TRUE))
8510   pairs(mgC5coll_4_s,reverse = TRUE)
8511   
8512   mgC5coll_4_e <- emmeans(rlogG_C5coll_4,  ~ edhi|studyarm, type = "response")
8513   confint(pairs(mgC5coll_4_e,reverse = TRUE))
8514   pairs(mgC5coll_4_e,reverse = TRUE)
8515   
8516   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
8517   
8518   rlogG_C5coll_5 <-
8519   
glm(mean_C5_coll2
~ studyarm*edhi +
8520   
mean_indivhorz +
8521   
mean_indivvertical +
8522   
mean_collhorz +
8523   
mean_collvertical +
8524   
bornincanada +
8525   
language_1 +
8526   
language_2 +
8527   
Asian_group +
8528   
White_group +
8529   
disability_any +
8530   
genderidentity +
8531   
income +
8532   
age,
8533   
data = datGeneric,family=binomial("logit")
8534   
)
8535   Anova(rlogG_C5coll_5, type = "III")
8536   summary(rlogG_C5coll_5)
8537   
8538   mgC5coll_5_s <- emmeans(rlogG_C5coll_5,~studyarm|edhi,type = "response")
8539   mgC5coll_5_s
8540   confint(pairs(mgC5coll_5_s,reverse = TRUE))
8541   
8542   mgC5coll_5_e <- emmeans(rlogG_C5coll_5,  ~ edhi|studyarm, type = "response")
8543   confint(pairs(mgC5coll_5_e,reverse = TRUE))
8544   
8545   # Now running models on imputed data.
8546   #CHANGELOG ASJ: No missing data for c5conf, no model with imputation performed, 21-09-20.
8547   
8548   
8549   #### ++ Measles ####
8550   
8551   #### + Model 1: Check for direct effects of factors without any covariates ####
8552   
8553   options(contrasts=c("contr.sum", "contr.poly"))
8554   rlogM_C5coll_1 <- glm(mean_C5_coll2
~ studyarm, data =
datMeasles,family=binomial("logit"))
8555   Anova(rlogM_C5coll_1,type="III")
8556   summary(rlogM_C5coll_1)
8557   
8558   mmC5coll_1 <- emmeans(rlogM_C5coll_1,~studyarm,type = "response") #proportions
8559   mmC5coll_1
8560   confint(pairs(mmC5coll_1,reverse = TRUE)) #Odds ratios
8561   
8562   # Model 2: Check for direct effects of factors with adjustment for other covariates
8563   rlogM_C5coll_2 <-
8564   
glm(mean_C5_coll2
~ studyarm +
8565   
mean_indivhorz +
8566   
mean_indivvertical +
8567   
mean_collhorz +
8568   
mean_collvertical +

8569   
bornincanada +
8570   
language_1 +
8571   
language_2 +
8572   
Asian_group +
8573   
White_group +
8574   
disability_any +
8575   
genderidentity +
8576   
income +
8577   
edhi +
8578   
age,
8579   
data = datMeasles,family=binomial("logit")
8580   
)
8581   Anova(rlogM_C5coll_2, type = "III")
8582   summary(rlogM_C5coll_2)
8583   
8584   mmC5coll_2 <- emmeans(rlogM_C5coll_2,~studyarm,type = "response")
8585   mmC5coll_2
8586   confint(pairs(mmC5coll_2,reverse = TRUE))
8587   
8588   
8589   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
8590   rlogM_C5coll_3 <-
8591   
glm(mean_C5_coll2
~
8592   
studyarm * mean_indivhorz +
8593   
studyarm * mean_indivvertical +
8594   
studyarm * mean_collhorz +
8595   
studyarm * mean_collvertical +
8596   
bornincanada +
8597   
language_1 +
8598   
language_2 +
8599   
Asian_group +
8600   
White_group +
8601   
disability_any +
8602   
genderidentity +
8603   
income +
8604   
edhi +
8605   
age,
8606   
data = datMeasles,family=binomial("logit")
8607   
)
8608   Anova(rlogM_C5coll_3, type = "III")
8609   summary(rlogM_C5coll_3)
8610   
8611   #No interaction to interpret
8612   
8613   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
8614   
8615   rlogM_C5coll_4 <- glm(mean_C5_coll2
~ studyarm * edhi, data =
datMeasles,family=binomial("logit"))
8616   Anova(rlogM_C5coll_4,type="III")
8617   summary(rlogM_C5coll_4)
8618   
8619   mmC5coll_4_s <- emmeans(rlogM_C5coll_4,~studyarm|edhi,type = "response")
8620   mmC5coll_4_s
8621   confint(pairs(mmC5coll_4_s,reverse = TRUE))
8622   
8623   mmC5coll_4_e <- emmeans(rlogM_C5coll_4,  ~ edhi|studyarm, type = "response")
8624   confint(pairs(mmC5coll_4_e,reverse = TRUE))
8625   
8626   
8627   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
8628   
8629   rlogM_C5coll_5 <-
8630   
glm(mean_C5_coll2
~ studyarm*edhi +
8631   
mean_indivhorz +
8632   
mean_indivvertical +
8633   
mean_collhorz +
8634   
mean_collvertical +
8635   
bornincanada +

8636   
language_1 +
8637   
language_2 +
8638   
Asian_group +
8639   
White_group +
8640   
disability_any +
8641   
genderidentity +
8642   
income +
8643   
age,
8644   
data = datMeasles,family=binomial("logit")
8645   
)
8646   Anova(rlogM_C5coll_5, type = "III")
8647   summary(rlogM_C5coll_5)
8648   
8649   mmC5coll_5_s <- emmeans(rlogM_C5coll_5,~studyarm|edhi,type = "response")
8650   mmC5coll_5_s
8651   confint(pairs(mmC5coll_5_s,reverse = TRUE))
8652   
8653   mmC5coll_5_e <- emmeans(rlogM_C5coll_5,  ~ edhi|studyarm, type = "response")
8654   confint(pairs(mmC5coll_5_e,reverse = TRUE))
8655   
8656   # Now running models on imputed data.
8657   #CHANGELOG ASJ: No missing data for c5conf, no model with imputation performed, 21-09-20.
8658   
8659   
8660   #### ++ Flu ####
8661   
8662   #### + Model 1: Check for direct effects of factors without any covariates ####
8663   
8664   options(contrasts=c("contr.sum", "contr.poly"))
8665   rlogF_C5coll_1 <- glm(mean_C5_coll2
~ studyarm, data = datFlu,family=binomial("logit"))
8666   Anova(rlogF_C5coll_1,type="III")
8667   summary(rlogF_C5coll_1)
8668   
8669   mfC5coll_1 <- emmeans(rlogF_C5coll_1,~studyarm,type = "response") #proportions
8670   mfC5coll_1
8671   confint(pairs(mfC5coll_1,reverse = TRUE)) #Odds ratios
8672   
8673   # Model 2: Check for direct effects of factors with adjustment for other covariates
8674   rlogF_C5coll_2 <-
8675   
glm(mean_C5_coll2
~ studyarm +
8676   
mean_indivhorz +
8677   
mean_indivvertical +
8678   
mean_collhorz +
8679   
mean_collvertical +
8680   
bornincanada +
8681   
language_1 +
8682   
language_2 +
8683   
Asian_group +
8684   
White_group +
8685   
disability_any +
8686   
genderidentity +
8687   
income +
8688   
edhi +
8689   
age,
8690   
data = datFlu,family=binomial("logit")
8691   
)
8692   Anova(rlogF_C5coll_2, type = "III")
8693   summary(rlogF_C5coll_2)
8694   
8695   mfC5coll_2 <- emmeans(rlogF_C5coll_2,~studyarm,type = "response")
8696   mfC5coll_2
8697   confint(pairs(mfC5coll_2,reverse = TRUE))
8698   
8699   # Model 3: Check for moderating effects of individualism & collectivism with adjustment 
for other covariates
8700   rlogF_C5coll_3 <-
8701   
glm(mean_C5_coll2
~
8702   
studyarm * mean_indivhorz +
8703   
studyarm * mean_indivvertical +

8704   
studyarm * mean_collhorz +
8705   
studyarm * mean_collvertical +
8706   
bornincanada +
8707   
language_1 +
8708   
language_2 +
8709   
Asian_group +
8710   
White_group +
8711   
disability_any +
8712   
genderidentity +
8713   
income +
8714   
edhi +
8715   
age,
8716   
data = datFlu,family=binomial("logit")
8717   
)
8718   Anova(rlogF_C5coll_3, type = "III")
8719   summary(rlogF_C5coll_3)
8720   
8721   emmip(rlogF_C5coll_3, studyarm ~ mean_collhorz, cov.reduce = range, type = "response")
8722   
8723   
8724   #### + Model 4: Check for interaction viz*edhi without any covariates  ####
8725   
8726   rlogF_C5coll_4 <- glm(mean_C5_coll2
~ studyarm * edhi, data =
datFlu,family=binomial("logit"))
8727   Anova(rlogF_C5coll_4,type="III")
8728   summary(rlogF_C5coll_4)
8729   
8730   mfC5coll_4_s <- emmeans(rlogF_C5coll_4,~studyarm|edhi,type = "response")
8731   mfC5coll_4_s
8732   confint(pairs(mfC5coll_4_s,reverse = TRUE))
8733   
8734   mfC5coll_4_e <- emmeans(rlogF_C5coll_4,  ~ edhi|studyarm, type = "response")
8735   confint(pairs(mfC5coll_4_e,reverse = TRUE))
8736   
8737   
8738   # Model 5: Check for interaction viz*edhi with adjustment for other covariates
8739   
8740   rlogF_C5coll_5 <-
8741   
glm(mean_C5_coll2
~ studyarm*edhi +
8742   
mean_indivhorz +
8743   
mean_indivvertical +
8744   
mean_collhorz +
8745   
mean_collvertical +
8746   
bornincanada +
8747   
language_1 +
8748   
language_2 +
8749   
Asian_group +
8750   
White_group +
8751   
disability_any +
8752   
genderidentity +
8753   
income +
8754   
age,
8755   
data = datFlu,family=binomial("logit")
8756   
)
8757   Anova(rlogF_C5coll_5, type = "III")
8758   summary(rlogF_C5coll_5)
8759   
8760   mfC5coll_5_s <- emmeans(rlogF_C5coll_5,~studyarm|edhi,type = "response")
8761   mfC5coll_5_s
8762   confint(pairs(mfC5coll_5_s,reverse = TRUE))
8763   
8764   mfC5coll_5_e <- emmeans(rlogF_C5coll_5,  ~ edhi|studyarm, type = "response")
8765   confint(pairs(mfC5coll_5_e,reverse = TRUE))
8766   
8767   # Now running models on imputed data.
8768   #CHANGELOG ASJ: No missing data for c5conf, no model with imputation performed, 21-09-20.
8769   
8770   
8771   #### COMPLETES VS INCOMPLETES ####

8772   
8773   # Here we test for differences between people who finished the survey (completes) and 
those who 
8774   # started but did not finish  (incompletes) to explore potential issues or limitations 
introduced by
8775   # imputing missing data. To do this, we run Chi-squared tests on categorical variables 
and Wilcoxon 
8776   # tests on continuous variables, comparing people who did and did not complete the 
survey. We ran 
8777   # the sociodemographic panel of questions first to maximally enable this comparison but 
we won't be
8778   # able to compare with people who never clicked on the survey or who started to read 
and didn't
8779   # answer anything.
8780   
8781   #CHANGELOG ASJ: Compare people analysed who finished with quality answer  VS (did not 
finished or finished with poor quality), 2021-08-06.
8782   table(datConsent$used) #CHANGELOG ASJ: changed finished to used, and everywhere below 
2021-08-06
8783   prop.table(table(datConsent$used))*100
8784   
8785   #CHANGELOG ASJ: Apply the same changes to the variables as in the dataset dat, 2021-09-01
8786   datConsent$yearofbirth <- as.numeric(datConsent$yearofbirth)
8787   datConsent$yearofbirth[datConsent$yearofbirth==888] <- NA
8788   datConsent$age <- 2021 - datConsent$yearofbirth
8789   
8790   
8791   cols.num <-
8792   
c(
8793   
"bornincanada",
8794   
"language_1",
8795   
"language_2",
8796   
"language_3",
8797   
"language_888",
8798   
"ethnicity_1",
8799   
"ethnicity_2",
8800   
"ethnicity_3",
8801   
"ethnicity_4",
8802   
"ethnicity_5",
8803   
"ethnicity_6",
8804   
"ethnicity_7",
8805   
"ethnicity_8",
8806   
"ethnicity_9",
8807   
"ethnicity_10",
8808   
"ethnicity_11",
8809   
"ethnicity_12",
8810   
"ethnicity_13",
8811   
"ethnicity_14",
8812   
"ethnicity_15",
8813   
"ethnicity_16",
8814   
"ethnicity_17",
8815   
"ethnicity_888",
8816   
"disability",
8817   
"techdisability",
8818   
"sexatbirth",
8819   
"genderidentity",
8820   
"supportedbyincome",
8821   
"educationlevel",
8822   
"studyarm",
8823   
"viz",
8824   
"disease",
8825   
"immune",
8826   
"c19vax"
8827   
)
8828   datConsent[cols.num] <- lapply(datConsent[cols.num],as.numeric)
8829   
8830   datConsent$language_1[is.na(datConsent$language_1)] <- 0
8831   datConsent$language_2[is.na(datConsent$language_2)] <- 0
8832   datConsent$language_3[is.na(datConsent$language_3)] <- 0

8833   
8834   datConsent$language_1[datConsent$language_888==1&datConsent$language_1==0&datConsent$lang
uage_2==0&datConsent$language_3==0] <- NA
8835   datConsent$language_2[datConsent$language_888==1&datConsent$language_1==0&datConsent$lang
uage_2==0&datConsent$language_3==0] <- NA
8836   datConsent$language_3[datConsent$language_888==1&datConsent$language_1==0&datConsent$lang
uage_2==0&datConsent$language_3==0] <- NA
8837   
8838   datConsent$ethnicity_1[is.na(datConsent$ethnicity_1)] <- 0
8839   datConsent$ethnicity_2[is.na(datConsent$ethnicity_2)] <- 0
8840   datConsent$ethnicity_3[is.na(datConsent$ethnicity_3)] <- 0
8841   datConsent$ethnicity_4[is.na(datConsent$ethnicity_4)] <- 0
8842   datConsent$ethnicity_5[is.na(datConsent$ethnicity_5)] <- 0
8843   datConsent$ethnicity_6[is.na(datConsent$ethnicity_6)] <- 0
8844   datConsent$ethnicity_7[is.na(datConsent$ethnicity_7)] <- 0
8845   datConsent$ethnicity_8[is.na(datConsent$ethnicity_8)] <- 0
8846   datConsent$ethnicity_9[is.na(datConsent$ethnicity_9)] <- 0
8847   datConsent$ethnicity_10[is.na(datConsent$ethnicity_10)] <- 0
8848   datConsent$ethnicity_11[is.na(datConsent$ethnicity_11)] <- 0
8849   datConsent$ethnicity_12[is.na(datConsent$ethnicity_12)] <- 0
8850   datConsent$ethnicity_13[is.na(datConsent$ethnicity_13)] <- 0
8851   datConsent$ethnicity_14[is.na(datConsent$ethnicity_14)] <- 0
8852   datConsent$ethnicity_15[is.na(datConsent$ethnicity_15)] <- 0
8853   datConsent$ethnicity_16[is.na(datConsent$ethnicity_16)] <- 0
8854   datConsent$ethnicity_17[is.na(datConsent$ethnicity_17)] <- 0
8855   
8856   
8857   datConsent_ethnicity <-
8858   
subset(
8859   
datConsent,
8860   
select = c(
8861   
ethnicity_1,
8862   
ethnicity_2,
8863   
ethnicity_3,
8864   
ethnicity_4,
8865   
ethnicity_5,
8866   
ethnicity_6,
8867   
ethnicity_7,
8868   
ethnicity_8,
8869   
ethnicity_9,
8870   
ethnicity_10,
8871   
ethnicity_11,
8872   
ethnicity_12,
8873   
ethnicity_13,
8874   
ethnicity_14,
8875   
ethnicity_15,
8876   
ethnicity_16,
8877   
ethnicity_17
8878   
)
8879   
)
8880   
8881   datConsent$sum_ethnicity <-rowSums(datConsent_ethnicity,na.rm=T)
8882   
8883   datConsent$ethnicity_1[datConsent$ethnicity_888==1&datConsent$sum_ethnicity==0] <- NA
8884   datConsent$ethnicity_2[datConsent$ethnicity_888==1&datConsent$sum_ethnicity==0] <- NA
8885   datConsent$ethnicity_3[datConsent$ethnicity_888==1&datConsent$sum_ethnicity==0] <- NA
8886   datConsent$ethnicity_4[datConsent$ethnicity_888==1&datConsent$sum_ethnicity==0] <- NA
8887   datConsent$ethnicity_5[datConsent$ethnicity_888==1&datConsent$sum_ethnicity==0] <- NA
8888   datConsent$ethnicity_6[datConsent$ethnicity_888==1&datConsent$sum_ethnicity==0] <- NA
8889   datConsent$ethnicity_7[datConsent$ethnicity_888==1&datConsent$sum_ethnicity==0] <- NA
8890   datConsent$ethnicity_8[datConsent$ethnicity_888==1&datConsent$sum_ethnicity==0] <- NA
8891   datConsent$ethnicity_9[datConsent$ethnicity_888==1&datConsent$sum_ethnicity==0] <- NA
8892   datConsent$ethnicity_10[datConsent$ethnicity_888==1&datConsent$sum_ethnicity==0] <- NA
8893   datConsent$ethnicity_11[datConsent$ethnicity_888==1&datConsent$sum_ethnicity==0] <- NA
8894   datConsent$ethnicity_12[datConsent$ethnicity_888==1&datConsent$sum_ethnicity==0] <- NA
8895   datConsent$ethnicity_13[datConsent$ethnicity_888==1&datConsent$sum_ethnicity==0] <- NA
8896   datConsent$ethnicity_14[datConsent$ethnicity_888==1&datConsent$sum_ethnicity==0] <- NA
8897   datConsent$ethnicity_15[datConsent$ethnicity_888==1&datConsent$sum_ethnicity==0] <- NA
8898   datConsent$ethnicity_16[datConsent$ethnicity_888==1&datConsent$sum_ethnicity==0] <- NA

8899   datConsent$ethnicity_17[datConsent$ethnicity_888==1&datConsent$sum_ethnicity==0] <- NA
8900   
8901   datConsent$Asian_group <-
8902   
ifelse(
8903   
datConsent$ethnicity_1 == 1 |
8904   
datConsent$ethnicity_2 == 1 |
8905   
datConsent$ethnicity_3 == 1 |
8906   
datConsent$ethnicity_4 == 1,
8907   
1,
8908   
0
8909   
)
8910   
8911   
8912   datConsent$White_group <-
8913   
ifelse(
8914   
datConsent$ethnicity_6 == 1 |
8915   
datConsent$ethnicity_7 == 1,
8916   
1,
8917   
0
8918   
)
8919   
8920   datConsent$edhi <- ifelse(datConsent$educationlevel == 4 |
8921   
datConsent$educationlevel == 5|
8922   
datConsent$educationlevel == 6|
8923   
datConsent$educationlevel == 7, TRUE, 
8924   
ifelse(datConsent$educationlevel == 8 |
datConsent$educationlevel == 888, NA,FALSE))
8925   
8926   
8927   datConsent$bornincanada[datConsent$bornincanada==888] <- NA
8928   datConsent$disability[datConsent$disability==888] <- NA
8929   datConsent$techdisability[datConsent$techdisability==888] <- NA
8930   datConsent$sexatbirth[datConsent$sexatbirth==888] <- NA
8931   datConsent$genderidentity[datConsent$genderidentity==888] <- NA
8932   datConsent$income[datConsent$income==888] <- NA
8933   datConsent$income[datConsent$income==5] <- NA
8934   datConsent$supportedbyincome[datConsent$supportedbyincome==888] <- NA
8935   datConsent$educationlevel[datConsent$educationlevel==888] <- NA
8936   datConsent$educationlevel[datConsent$educationlevel==8] <- NA
8937   
8938   datConsent$agecat[datConsent$agecat==888 | datConsent$agecat==1] <- NA
8939   
8940   
8941   datConsent$bornincanada <-
8942   
factor(datConsent$bornincanada,
8943   
levels = c(1, 0),
8944   
labels = c("Yes", "No"))
8945   
8946   datConsent$language_1 <-
8947   
factor(datConsent$language_1,
8948   
levels = c(1, 0),
8949   
labels = c("Yes", "No"))
8950   
8951   datConsent$language_2 <-
8952   
factor(datConsent$language_2,
8953   
levels = c(1, 0),
8954   
labels = c("Yes", "No"))
8955   
8956   datConsent$Asian_group <-
8957   
factor(datConsent$Asian_group,
8958   
levels = c(1, 0),
8959   
labels = c("Yes", "No"))
8960   
8961   
8962   datConsent$White_group <-
8963   
factor(datConsent$White_group,
8964   
levels = c(1, 0),
8965   
labels = c("Yes", "No"))
8966   

8967   
8968   datConsent$disability <-
8969   
factor(
8970   
datConsent$disability,
8971   
levels = c(0, 1),
8972   
labels = c("No disability", "yes,at least one")
8973   
)
8974   
8975   datConsent$techdisability <-
8976   
factor(datConsent$techdisability,
8977   
levels = c(0, 1),
8978   
labels = c("No", "Yes"))
8979   
8980   datConsent$sexatbirth <-
8981   
factor(datConsent$sexatbirth,
8982   
levels = c(1, 2),
8983   
labels = c("Female", "Male"))
8984   
8985   datConsent$genderidentity <- factor(
8986   
datConsent$genderidentity,
8987   
levels = c(1, 2, 3, 4),
8988   
labels = c(
8989   
"Female",
8990   
"Male",
8991   
"Indigenous or other cultural gender minority identity",
8992   
"Something else"
8993   
)
8994   )
8995   
8996   datConsent$income <-
8997   
factor(
8998   
datConsent$income,
8999   
levels = c(1, 2, 3, 4),
9000   
labels = c("24 999 or less", "25 000 to 49 999",
9001   
"50 000 to 99 999", "100 000 or more")
9002   
)
9003   
9004   datConsent$educationlevel <- factor(
9005   
datConsent$educationlevel,
9006   
levels = c(1, 2, 3, 4, 5, 6, 7),
9007   
labels = c(
9008   
"Some Elementary School",
9009   
"High School Diploma",
9010   
"Apprenticeship or trade certificate or diploma",
9011   
"College or polytechnical school certificate or diploma",
9012   
"University degree bachelor level or below",
9013   
"University graduate degree Master level",
9014   
"University graduate degree Doctorate level"
9015   
)
9016   )
9017   
9018   datConsent$agecat<-
9019   
factor(
9020   
datConsent$agecat,
9021   
levels = c(2, 3, 4),
9022   
labels = c("18-34 years", "35-49 years", "50 years and more")
9023   
)
9024   
9025   datConsent$UserLanguage <- as.factor(datConsent$UserLanguage)
9026   
9027   datConsent$studyarm <-
9028   
factor (
9029   
datConsent$studyarm,
9030   
levels = c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13),
9031   
labels = c(
9032   
"controlgeneric",
9033   
"controlmeasles",
9034   
"controlpertussis",
9035   
"controlflu",

9036   
"herdimmgeneric",
9037   
"herdimmmeasles",
9038   
"herdimmpertussis",
9039   
"herdimmflu",
9040   
"robertkochgeneric",
9041   
"sbsnewsgeneric",
9042   
"guardianmeasles",
9043   
"theotheredmundmeasles",
9044   
"publichealthagencycanadaflu"
9045   
)
9046   
)
9047   
9048   datConsent$viz <- factor (
9049   
datConsent$viz,
9050   
levels = c(0, 1, 2, 3, 5, 6, 7),
9051   
labels = c(
9052   
"no visualization",
9053   
"herdimm",
9054   
"robertkoch",
9055   
"sbsnews",
9056   
"guardian",
9057   
"theotheredmund",
9058   
"publichealthagencycanada"
9059   
)
9060   )
9061   
9062   datConsent$disease <-
9063   
factor (
9064   
datConsent$disease,
9065   
levels = c(0, 1, 2, 3),
9066   
labels = c("Generic", "Measles", "Pertussis", "Flu")
9067   
)
9068   
9069   
9070   datConsent$genderidentity[datConsent$genderidentity == "Something else" |
9071   
datConsent$genderidentity == "Indigenous or other cultural 
gender minority identity"] <- NA
9072   datConsent$genderidentity <- droplevels(datConsent$genderidentity)
9073   
9074   
9075   datConsent$disability_any <-ifelse(datConsent$disability =="yes,at least one" |
datConsent$techdisability == "Yes", 1, 0)
9076   datConsent$disability_any <-
9077   
factor(
9078   
datConsent$disability_any,
9079   
levels = c(1, 0),
9080   
labels = c("Yes", "No")
9081   
)
9082   
9083   datConsent$agecat <- as.numeric(datConsent$agecat)
9084   
9085   datConsent$used <-
9086   
factor(
9087   
datConsent$used,
9088   
levels = c(1, 0),
9089   
labels = c("Yes", "No")
9090   
)
9091   
9092   # For each categorical demographic to do along with the next step of chi square
9093   #CHANGELOG ASJ: Add table for other demographic variables 21-08-31
9094   t1<-data.frame(datConsent$used,datConsent$studyarm)
9095   table(t1)
9096   prop.table(table(t1), 1) * 100
9097   
9098   t1<-data.frame(datConsent$used,datConsent$viz)
9099   table(t1)
9100   prop.table(table(t1), 1) * 100
9101   
9102   t1<-data.frame(datConsent$used,datConsent$disease)

9103   table(t1)
9104   prop.table(table(t1), 1) * 100
9105   
9106   t1<-data.frame(datConsent$used,datConsent$bornincanada)
9107   table(t1)
9108   prop.table(table(t1), 1) * 100
9109   
9110   t1<-data.frame(datConsent$used,datConsent$language_1)
9111   table(t1)
9112   prop.table(table(t1), 1) * 100
9113   
9114   t1<-data.frame(datConsent$used,datConsent$language_2)
9115   table(t1)
9116   prop.table(table(t1), 1) * 100
9117   
9118   t1<-data.frame(datConsent$used,datConsent$White_group)
9119   table(t1)
9120   prop.table(table(t1), 1) * 100
9121   
9122   t1<-data.frame(datConsent$used,datConsent$Asian_group)
9123   table(t1)
9124   prop.table(table(t1), 1) * 100
9125   
9126   t1<-data.frame(datConsent$used,datConsent$disability)
9127   table(t1)
9128   prop.table(table(t1), 1) * 100
9129   
9130   t1<-data.frame(datConsent$used,datConsent$techdisability)
9131   table(t1)
9132   prop.table(table(t1), 1) * 100
9133   
9134   t1<-data.frame(datConsent$used,datConsent$disability_any)
9135   table(t1)
9136   prop.table(table(t1), 1) * 100
9137   
9138   t1<-data.frame(datConsent$used,datConsent$sexatbirth)
9139   table(t1)
9140   prop.table(table(t1), 1) * 100
9141   
9142   t1<-data.frame(datConsent$used,datConsent$genderidentity)
9143   table(t1)
9144   prop.table(table(t1), 1) * 100
9145   
9146   t1<-data.frame(datConsent$used,datConsent$income)
9147   table(t1)
9148   prop.table(table(t1), 1) * 100
9149   
9150   t1<-data.frame(datConsent$used,datConsent$educationlevel)
9151   table(t1)
9152   prop.table(table(t1), 1) * 100
9153   
9154   t1<-data.frame(datConsent$used,datConsent$edhi)
9155   table(t1)
9156   prop.table(table(t1), 1) * 100
9157   
9158   #Comparison for continuous demographics
9159   describeBy(datConsent$age,datConsent$used)
9160   wilcox.test(datConsent$age~datConsent$used)
9161   
9162   #CHANGELOG ASJ: Only keep variables analysed with >5% and dichotomous versions 2021-08-06
9163   chisq.test(datConsent$used,datConsent$studyarm, correct=FALSE)
9164   chisq.test(datConsent$used,datConsent$viz, correct=FALSE)
9165   chisq.test(datConsent$used,datConsent$disease, correct=FALSE)
9166   chisq.test(datConsent$used,datConsent$bornincanada, correct=FALSE)
9167   chisq.test(datConsent$used,datConsent$language_1, correct=FALSE)
9168   chisq.test(datConsent$used,datConsent$language_2, correct=FALSE)
9169   chisq.test(datConsent$used,datConsent$Asian_group, correct=FALSE)
9170   chisq.test(datConsent$used,datConsent$White_group, correct=FALSE)
9171   chisq.test(datConsent$used,datConsent$disability, correct=FALSE)

9172   chisq.test(datConsent$used,datConsent$techdisability, correct=FALSE)
9173   chisq.test(datConsent$used,datConsent$disability_any, correct=FALSE)
9174   chisq.test(datConsent$used,datConsent$sexatbirth, correct=FALSE)
9175   chisq.test(datConsent$used,datConsent$genderidentity, correct=FALSE)
9176   chisq.test(datConsent$used,datConsent$income, correct=FALSE)
9177   chisq.test(datConsent$used,datConsent$educationlevel, correct=FALSE)
9178   chisq.test(datConsent$used,datConsent$edhi, correct=FALSE)
9179   
9180   
9181   #### RESEARCH QUESTION 4: Effects of male vs female voice ####
9182   
9183   # Recall: Research question 4 (add-on, may be reported separately from Hina Hakim's 
thesis): Are the
9184   # effects of the herdimm intervention different when the narration uses a female or 
male voice?
9185   
9186   # Force this variable to be read as a factor and define the labels (this could be up in 
the data
9187   # cleaning section but we are keeping it separate in case we don't include this in 
Hina's thesis.)
9188   
9189   dat$voice <- factor(dat$voice,levels = c(1,2),labels = c("Male", "Female"))
9190   
9191   # Create 2 new variables combining voice and study arm to facilitate analyses
9192   
9193   dat$viz_voice <- as.factor(paste(dat$viz,dat$voice,sep="_"))
9194   dat$studyarm_voice <- as.factor(paste(dat$studyarm,dat$voice,sep="_"))
9195   
9196   # Effect of male versus female voice in herdimm narration
9197   
9198   datHerdimm <-
9199   
subset(
9200   
dat,
9201   
dat$studyarm == "herdimmgeneric" |
9202   
dat$studyarm == "herdimmmeasles" |
9203   
dat$studyarm == "herdimmpertussis" |
9204   
dat$studyarm == "herdimmflu"
9205   
)
9206   
9207   # Analysis for risk perception, adjusted for covariates and moderators, with 
interaction of gender
9208   # of respondents
9209   options(contrasts=c("contr.sum", "contr.poly")) # CHANGELOG: Added to calculate 
properly the type III sum of squares with lm 2021-07-27
9210   mHV_RP <- lm(
9211   
mean_riskperception2_6 ~
9212   
studyarm * voice * genderidentity +
9213   
mean_indivhorz +
9214   
mean_indivvertical +
9215   
mean_collhorz +
9216   
mean_collvertical +
9217   
bornincanada + #CHANGELOG ASJ: covariate list shortened 2021-08-04 
9218   
language_1 +
9219   
language_2 +
9220   
Asian_group +
9221   
White_group +
9222   
disability_any +
9223   
income +
9224   
edhi +
9225   
age,
9226   
data = datHerdimm
9227   )
9228   Anova(mHV_RP,type="III")
9229   summary(mHV_RP)
9230   
9231   
9232   # The same analysis will be done for the other outcomes, and the model will be 
validated as for the 
9233   # main analyses. If there is an effect of voice in the above model, the 2-way ANOVA 

model 
9234   # (viz*disease) and one-way anova model (studyarm) per disease will be done again. In 
these new 
9235   # models, Herdimm technique will be divided according to the voice gender. The factors 
for the 
9236   # two-way anova will be viz_voice and disease. The factor for the one-way anova will be 
9237   # studyarm_voice.
9238   
9239   #CHANGELOG ASJ: Add this model for other continuous outcomes, 2021-08-05.
9240   
9241   mHV_emot <- lm(
9242   
mean_emotion ~
9243   
studyarm * voice * genderidentity +
9244   
mean_indivhorz +
9245   
mean_indivvertical +
9246   
mean_collhorz +
9247   
mean_collvertical +
9248   
bornincanada +
9249   
language_1 +
9250   
language_2 +
9251   
Asian_group +
9252   
White_group +
9253   
disability_any +
9254   
income +
9255   
edhi +
9256   
age,
9257   
data = datHerdimm
9258   )
9259   Anova(mHV_emot,type="III")
9260   
9261   mHV_know <- lm(
9262   
sum_knowledge ~
9263   
studyarm * voice * genderidentity +
9264   
mean_indivhorz +
9265   
mean_indivvertical +
9266   
mean_collhorz +
9267   
mean_collvertical +
9268   
bornincanada +
9269   
language_1 +
9270   
language_2 +
9271   
Asian_group +
9272   
White_group +
9273   
disability_any +
9274   
income +
9275   
edhi +
9276   
age,
9277   
data = datHerdimm
9278   )
9279   Anova(mHV_know,type="III")
9280   
9281   #Logistic regressions
9282   rlHV_RP1 <- glm(
9283   
relevel(RP1_dicho,ref="Low") ~
9284   
studyarm * voice * genderidentity +
9285   
mean_indivhorz +
9286   
mean_indivvertical +
9287   
mean_collhorz +
9288   
mean_collvertical +
9289   
bornincanada +
9290   
language_1 +
9291   
language_2 +
9292   
Asian_group +
9293   
White_group +
9294   
disability_any +
9295   
income +
9296   
edhi +
9297   
age,
9298   
data = datHerdimm,family=binomial("logit")
9299   )

9300   Anova(rlHV_RP1,type="III")
9301   
9302   rlHV_c19vi <- glm(
9303   
relevel(c19vaxintent,ref="Low") ~
9304   
studyarm * voice * genderidentity +
9305   
mean_indivhorz +
9306   
mean_indivvertical +
9307   
mean_collhorz +
9308   
mean_collvertical +
9309   
bornincanada +
9310   
language_1 +
9311   
language_2 +
9312   
Asian_group +
9313   
White_group +
9314   
disability_any +
9315   
income +
9316   
edhi +
9317   
age,
9318   
data = datHerdimm,family=binomial("logit")
9319   )
9320   Anova(rlHV_c19vi,type="III")
9321   
9322   
9323   rlHV_vi <- glm(
9324   
relevel(vaxintent,ref="Low") ~
9325   
studyarm * voice * genderidentity +
9326   
mean_indivhorz +
9327   
mean_indivvertical +
9328   
mean_collhorz +
9329   
mean_collvertical +
9330   
bornincanada +
9331   
language_1 +
9332   
language_2 +
9333   
Asian_group +
9334   
White_group +
9335   
disability_any +
9336   
income +
9337   
edhi +
9338   
age,
9339   
data = datHerdimm,family=binomial("logit")
9340   )
9341   Anova(rlHV_vi,type="III")
9342   
9343   rlHV_Hti <- glm(
9344   
relevel(Htrustinfo,ref="No") ~
9345   
studyarm * voice * genderidentity +
9346   
mean_indivhorz +
9347   
mean_indivvertical +
9348   
mean_collhorz +
9349   
mean_collvertical +
9350   
bornincanada +
9351   
language_1 +
9352   
language_2 +
9353   
Asian_group +
9354   
White_group +
9355   
disability_any +
9356   
income +
9357   
edhi +
9358   
age,
9359   
data = datHerdimm,family=binomial("logit")
9360   )
9361   Anova(rlHV_Hti,type="III")
9362   
9363   #CHANGELOG ASJ: Add same analysis for C5 subscales, 21-09-20.
9364   rlHV_C5conf <- glm(
9365   
relevel(as.factor(mean_C5_conf2),ref="0") ~
9366   
studyarm * voice * genderidentity +
9367   
mean_indivhorz +
9368   
mean_indivvertical +

9369   
mean_collhorz +
9370   
mean_collvertical +
9371   
bornincanada +
9372   
language_1 +
9373   
language_2 +
9374   
Asian_group +
9375   
White_group +
9376   
disability_any +
9377   
income +
9378   
edhi +
9379   
age,
9380   
data = datHerdimm,family=binomial("logit")
9381   )
9382   Anova(rlHV_C5conf,type="III")
9383   
9384   rlHV_C5cons <- glm(
9385   
relevel(as.factor(mean_C5_cons2),ref="0") ~
9386   
studyarm * voice * genderidentity +
9387   
mean_indivhorz +
9388   
mean_indivvertical +
9389   
mean_collhorz +
9390   
mean_collvertical +
9391   
bornincanada +
9392   
language_1 +
9393   
language_2 +
9394   
Asian_group +
9395   
White_group +
9396   
disability_any +
9397   
income +
9398   
edhi +
9399   
age,
9400   
data = datHerdimm,family=binomial("logit")
9401   )
9402   Anova(rlHV_C5cons,type="III")
9403   
9404   rlHV_C5comp <- glm(
9405   
relevel(as.factor(mean_C5_comp2),ref="0") ~
9406   
studyarm * voice * genderidentity +
9407   
mean_indivhorz +
9408   
mean_indivvertical +
9409   
mean_collhorz +
9410   
mean_collvertical +
9411   
bornincanada +
9412   
language_1 +
9413   
language_2 +
9414   
Asian_group +
9415   
White_group +
9416   
disability_any +
9417   
income +
9418   
edhi +
9419   
age,
9420   
data = datHerdimm,family=binomial("logit")
9421   )
9422   Anova(rlHV_C5comp,type="III")
9423   
9424   
9425   rlHV_C5calc <- glm(
9426   
relevel(as.factor(mean_C5_calc2),ref="0") ~
9427   
studyarm * voice * genderidentity +
9428   
mean_indivhorz +
9429   
mean_indivvertical +
9430   
mean_collhorz +
9431   
mean_collvertical +
9432   
bornincanada +
9433   
language_1 +
9434   
language_2 +
9435   
Asian_group +
9436   
White_group +
9437   
disability_any +

9438   
income +
9439   
edhi +
9440   
age,
9441   
data = datHerdimm,family=binomial("logit")
9442   )
9443   Anova(rlHV_C5calc,type="III")
9444   
9445   
9446   rlHV_C5coll <- glm(
9447   
relevel(as.factor(mean_C5_coll2),ref="0") ~
9448   
studyarm * voice * genderidentity +
9449   
mean_indivhorz +
9450   
mean_indivvertical +
9451   
mean_collhorz +
9452   
mean_collvertical +
9453   
bornincanada +
9454   
language_1 +
9455   
language_2 +
9456   
Asian_group +
9457   
White_group +
9458   
disability_any +
9459   
income +
9460   
edhi +
9461   
age,
9462   
data = datHerdimm,family=binomial("logit")
9463   )
9464   Anova(rlHV_C5coll,type="III")
9465   
9466   
9467   #### END ####
9468   
9469