STATE OF THE PANDEMIC
FIGURE 1: CASES, DEATHS, AND KEY POLICY DECISIONS BY DATE.
#NOW = as.Date( Sys.time(), format = 'Y%-%m-%d')
NOW = as.Date('2020-06-18')
START = as.Date( '2020-01-19' )
TWN = WorldCOVIDdata('Taiwan',
StartDate = START, EndDate = NOW) %>%
select(cases, deaths, date, country) %>%
melt(id = c('date','country'))
# Allocated Data to dataframes for Key dates, Waves, and Taiwan Cases & Deaths.
Dates = data.frame( date = as.Date( c("2020-01-21", "2020-02-23",
"2020-01-26", "2020-01-28",
'2020-01-30', "2020-02-03",
'2020-02-07', '2020-02-11',
'2020-03-18', '2020-04-09',
'2020-04-11', '2020-04-19',
'2020-05-10', '2020-05-20'
),
'%Y-%m-%d'),
text = c('1st case in Taiwan.', 'Wuhan flight ban.',
'Chinese students & tourists denied entry.',
'Monitoring devices enforce quarantine.',
'Mask factories expropriated.',
'School & University opening postponed.',
'Chinese travel ban.',
'Mask output increases to 1.7M per day.',
'Foreigners travel ban. Arrivals must quarantine.',
'Public gatherings & clubs banned.',
'Google/Apple API announced.',
'22 infected navy officers.\nSMS notify public to isolate.',
'Risk of infection deemed low by CECC.',
'Google/Apple API launched.'
))
Waves = data.frame( start = as.Date( c("2020-05-14", "2020-05-25", "2020-06-04", "2020-06-16")),
text = c('Wave 1','Wave 2','Wave 3', 'Wave 4'))
ft = 3.8
p = 0
c = 'sienna1'
# Plot Cases & Deaths in TWN
TWNPlot = ggplot(TWN) +
geom_col(aes(date, value, group = variable, fill = variable), width = .8) + PltTheme +
scale_fill_manual(values = alpha(c('dodgerblue','red'), c(.35,1)),
labels = c('Cases','Deaths')) +
scale_y_continuous( expand = c(0, .1), limits = c(0,max(TWN$value)) ) +
scale_x_date(expand = c(0.0, 0), labels = date_format("%d-%b"), date_breaks = "14 days",
limits = c(START, NOW+1)) +
theme( legend.direction = 'vertical',
legend.position = c(.1,.9),
axis.text.x = element_text(angle=45, hjust = 1)) +
labs(title = 'Daily COVID-19 cases, deaths and key dates in Taiwan', y = 'Frequency', x = 'Date')
# Add Data collectiond dates.
for (d in 1:nrow(Waves)){
TWNPlot = TWNPlot +
annotate("rect", xmin = Waves$start[d], xmax = Waves$start[d]+.7, ymin = 0, ymax = Inf, fill = 'green', alpha = .25) +
annotate("text", x = Waves$start[d], y = Inf, label = Waves$text[d], angle=90, color = 'darkgreen', size=4.5, vjust=-.4, hjust='right', fontface = "bold")
}
# Add key dates
for (d in 1:nrow(Dates)){
TWNPlot = TWNPlot +
annotate("text", x = Dates$date[d], y = p+2, label = Dates$text[d], angle=90, color = 'black', size=ft, vjust=0+.25, hjust='left', fontface = "bold") +
geom_segment(x = Dates$date[d], y = 1+TWN$value[(TWN$date == Dates$date[d] & TWN$variable == 'deaths')], yend = p, xend = Dates$date[d], color = 'gray10', size = 1, alpha = 0.5 )
}
TWNPlot = TWNPlot + annotate("text", x = as.Date('2020-05-28'), y = 10, label = 'Cases remain < 10\nas of October, 2020',, color = 'black', size=ft+1, vjust=0+.25, hjust='left', fontface = "bold")
ggsave(plot = TWNPlot, filename = 'Figures//Cases.pdf', dpi = 5000, width = 13, height = 6)
TWNPlot
Description of the data sample
complyM = mean(W$COVID_comply_percent)
complySD = sd(W$COVID_comply_percent)
Phoneuse = Per(W$PhoneUse,1,2)
COVIDpos = Per(W$COVID_pos, 1, 2)
COVIDposOth = Per(W$COVID_pos_others, 1, 2)
LockdownM = mean(W$COVID_ndays_4)
LockdownSD = sd(W$COVID_ndays_4)
JobLost = Per(W$COVID_lost_job, 1, 2)
SocialDist = 'moderately' # Looked at the mean & median distribution of the likert responses.
GovSat_Policy = 'moderately' # Looked at the mean & median distribution of the likert responses.
GovSat_Govern = 'moderately' # Looked at the mean & median distribution of the likert responses.
GovSat_PubService = 'moderately' # Looked at the mean & median distribution of the likert responses.
TotalP = nrow(Data$Raw)
CleanP = nrow(W)
Wave1P = nrow(W %>% filter(WaveN == 'Wave 1'))
Wave2P = nrow(W %>% filter(WaveN == 'Wave 2'))
Wave3P = nrow(W %>% filter(WaveN == 'Wave 3'))
Wave4P = nrow(W %>% filter(WaveN == 'Wave 4'))
Removed = TotalP - CleanP
InitialWaveP = TotalP / 4
6000 nationally representative Taiwanese participants were sampled in four waves of 1500 space roughly one week apart between the dates of May 14th 2020 and June 16th 2020. Participants were exlcuded from analysis if they did not pass a scenario comprehension check. In total, 3825 participants passed the comprehension check (participants who passed comprehension checks in each wave were Wave 1 = 971, Wave 2 = 1018, Wave 3 = 939, Wave 4 = 897). In total, 2175 participants were removed from the analysis.
The following statistics and subsiquent analyses relate only to those participants who passed the attention checks:
- 99.69% of participants reported they used a mobile phone
- 2.61% of participants knew someone who had tested positive with COVID-19
- 0.44% of participants had tested positive with COVID-19
- Participants had spent a mean of 0.6224837 (SD = 3.05249) of the previous days in lockdown.
- 7.35% of participants had lost their job as a direct effect of COVID-19
- On average, particianpnts thought 59.2901961% (SD = 25.3928438) of the population were complying with COVID-19 policies
- Participants reported that they thought people were moderately complying with Social Distancing guidelines
- Participants were moderately satisfied with i) Government COVID-19 policies, ii) Governance during the pandemic, and iii) public services’ during the pandemic.
Demographics: Figures and Tables
Summary Figures
ggplot(W) +
geom_bar(aes(y = ..prop.., state, fill = WaveN, group = WaveN), position = 'dodge', color = 'white', size = .5, width = .82) + PltTheme +
scale_fill_manual(values = WaveCols ) +
scale_y_continuous( expand = c(0, 0), limits = c(0,.3), breaks = c(0, .1, .2, .3), labels = c('0','10','20','30') ) +
theme( legend.position = 'none',
axis.text.x = element_text(angle=45, hjust = 1)) +
labs(title = 'City of Residence', y = 'Percent (%)', x = '')
ggplot(W) +
geom_bar(aes(y = ..prop.., Agebins, fill = WaveN, group = WaveN), position = 'dodge', color = 'white', size = .5, width = .82) + PltTheme +
scale_fill_manual(values = WaveCols ) +
scale_y_continuous( expand = c(0, 0), limits = c(0,.3), breaks = c(0, .1, .2, .3), labels = c('0','10','20','30') ) +
theme( legend.position = 'none',
axis.text.x = element_text(angle=45, hjust = 1)) +
labs(title = 'Age Distribution', y = 'Percent (%)', x = '')
ggplot(W) +
geom_bar(aes(y = ..prop.., education, fill = WaveN, group = WaveN), position = 'dodge', color = 'white', size = .5, width = .82) + PltTheme +
scale_fill_manual(values = WaveCols ) +
scale_y_continuous( expand = c(0, 0), limits = c(0,1), breaks = c(0, .2, .4, .6, .8, 1), labels = c('0','20','40','60','80','100') ) +
theme( legend.position = 'none',
axis.text.x = element_text(angle=45, hjust = 1)) +
labs(title = 'Education Distribution', y = 'Percent (%)', x = '')
ggplot(W) +
geom_bar(aes(y = ..prop.., gender, fill = WaveN, group = WaveN), position = 'dodge', color = 'white', size = .5, width = .82) + PltTheme +
scale_fill_manual(values = WaveCols ) +
scale_y_continuous( expand = c(0, 0), limits = c(0,.6), breaks = c(0, .2, .4, .6), labels = c('0','20','40','60') ) +
theme( legend.position = 'none',
axis.text.x = element_text(angle=45, hjust = 1)) +
labs(title = 'Gender Distribution', y = 'Percent (%)', x = '') +
xlim(c('Man','Woman'))
Descriptive Summary Tables
Education
cro_tpct(W$education, row_vars=W$WaveN) %>% set_caption("Level of education by wave: Percentages") %>% rename(Percent = `#Total`)
Level of education by wave: Percentages
|
|
|
|
 PercentÂ
|
 W$WaveNÂ
|
   Wave 1Â
|
 W$educationÂ
|
 < H.SchÂ
|
1
|
 Â
|
|
 > H.SchÂ
|
12.3
|
 Â
|
|
 UniÂ
|
86.7
|
 Â
|
|
 #Total casesÂ
|
971
|
   Wave 2Â
|
 W$educationÂ
|
 < H.SchÂ
|
0.7
|
 Â
|
|
 > H.SchÂ
|
13.8
|
 Â
|
|
 UniÂ
|
85.6
|
 Â
|
|
 #Total casesÂ
|
1018
|
   Wave 3Â
|
 W$educationÂ
|
 < H.SchÂ
|
0.7
|
 Â
|
|
 > H.SchÂ
|
12.9
|
 Â
|
|
 UniÂ
|
86.4
|
 Â
|
|
 #Total casesÂ
|
939
|
   Wave 4Â
|
 W$educationÂ
|
 < H.SchÂ
|
0.9
|
 Â
|
|
 > H.SchÂ
|
12.9
|
 Â
|
|
 UniÂ
|
86.2
|
 Â
|
|
 #Total casesÂ
|
897
|
cro_tpct(W$education) %>% set_caption("Level of education: Percentages") %>% rename(Percent = `#Total`)
Level of education: Percentages
|
|
 PercentÂ
|
 W$educationÂ
|
   < H.SchÂ
|
0.8
|
   > H.SchÂ
|
13
|
   UniÂ
|
86.2
|
   #Total casesÂ
|
3825
|
Gender
cro_tpct(W$gender, row_vars=W$WaveN) %>% set_caption("Gender by wave: Percentages") %>% rename(Percent = `#Total`)
Gender by wave: Percentages
|
|
|
|
 PercentÂ
|
 W$WaveNÂ
|
   Wave 1Â
|
 W$genderÂ
|
 ManÂ
|
47.9
|
 Â
|
|
 WomanÂ
|
52.1
|
 Â
|
|
 OtherÂ
|
|
 Â
|
|
 Prefer not to sayÂ
|
|
 Â
|
|
 #Total casesÂ
|
971
|
   Wave 2Â
|
 W$genderÂ
|
 ManÂ
|
47.2
|
 Â
|
|
 WomanÂ
|
52.6
|
 Â
|
|
 OtherÂ
|
0.2
|
 Â
|
|
 Prefer not to sayÂ
|
|
 Â
|
|
 #Total casesÂ
|
1018
|
   Wave 3Â
|
 W$genderÂ
|
 ManÂ
|
48
|
 Â
|
|
 WomanÂ
|
51.8
|
 Â
|
|
 OtherÂ
|
0.1
|
 Â
|
|
 Prefer not to sayÂ
|
0.1
|
 Â
|
|
 #Total casesÂ
|
939
|
   Wave 4Â
|
 W$genderÂ
|
 ManÂ
|
50.1
|
 Â
|
|
 WomanÂ
|
49.7
|
 Â
|
|
 OtherÂ
|
|
 Â
|
|
 Prefer not to sayÂ
|
0.2
|
 Â
|
|
 #Total casesÂ
|
897
|
cro_tpct(W$gender) %>% set_caption("Gender: Percentages") %>% rename(Percent = `#Total`)
Gender: Percentages
|
|
 PercentÂ
|
 W$genderÂ
|
   ManÂ
|
48.3
|
   WomanÂ
|
51.6
|
   OtherÂ
|
0.1
|
   Prefer not to sayÂ
|
0.1
|
   #Total casesÂ
|
3825
|
City of residence
cro_tpct(W$state, row_vars=W$WaveN) %>% set_caption("City by wave: Percentages") %>% rename(Percent = `#Total`)
City by wave: Percentages
|
|
|
|
 PercentÂ
|
 W$WaveNÂ
|
   Wave 1Â
|
 W$stateÂ
|
 ChanghuaÂ
|
4.4
|
 Â
|
|
 ChiayiÂ
|
1.2
|
 Â
|
|
 Chiayi cityÂ
|
1.6
|
 Â
|
|
 Hsinchu cityÂ
|
1.9
|
 Â
|
|
 Hsinchu countyÂ
|
0.7
|
 Â
|
|
 HualienÂ
|
1.6
|
 Â
|
|
 KaohsiungÂ
|
18.4
|
 Â
|
|
 KeelungÂ
|
0.7
|
 Â
|
|
 MiaoliÂ
|
2.6
|
 Â
|
|
 NantouÂ
|
1.6
|
 Â
|
|
 New TaipeiÂ
|
13.4
|
 Â
|
|
 PingtungÂ
|
1.4
|
 Â
|
|
 TaichungÂ
|
22.6
|
 Â
|
|
 TainanÂ
|
10.7
|
 Â
|
|
 TaipeiÂ
|
11
|
 Â
|
|
 TaitungÂ
|
0.3
|
 Â
|
|
 TaoyuanÂ
|
4.1
|
 Â
|
|
 YilanÂ
|
0.3
|
 Â
|
|
 YunlinÂ
|
1.2
|
 Â
|
|
 #Total casesÂ
|
971
|
   Wave 2Â
|
 W$stateÂ
|
 ChanghuaÂ
|
4
|
 Â
|
|
 ChiayiÂ
|
1.4
|
 Â
|
|
 Chiayi cityÂ
|
1.4
|
 Â
|
|
 Hsinchu cityÂ
|
2.1
|
 Â
|
|
 Hsinchu countyÂ
|
0.8
|
 Â
|
|
 HualienÂ
|
1.9
|
 Â
|
|
 KaohsiungÂ
|
19.1
|
 Â
|
|
 KeelungÂ
|
0.5
|
 Â
|
|
 MiaoliÂ
|
2.8
|
 Â
|
|
 NantouÂ
|
1.4
|
 Â
|
|
 New TaipeiÂ
|
13
|
 Â
|
|
 PingtungÂ
|
2.4
|
 Â
|
|
 TaichungÂ
|
19.6
|
 Â
|
|
 TainanÂ
|
11.3
|
 Â
|
|
 TaipeiÂ
|
12
|
 Â
|
|
 TaitungÂ
|
0.6
|
 Â
|
|
 TaoyuanÂ
|
4.3
|
 Â
|
|
 YilanÂ
|
0.3
|
 Â
|
|
 YunlinÂ
|
1.4
|
 Â
|
|
 #Total casesÂ
|
1018
|
   Wave 3Â
|
 W$stateÂ
|
 ChanghuaÂ
|
3.2
|
 Â
|
|
 ChiayiÂ
|
1.2
|
 Â
|
|
 Chiayi cityÂ
|
0.5
|
 Â
|
|
 Hsinchu cityÂ
|
2.2
|
 Â
|
|
 Hsinchu countyÂ
|
1.3
|
 Â
|
|
 HualienÂ
|
2.1
|
 Â
|
|
 KaohsiungÂ
|
19.4
|
 Â
|
|
 KeelungÂ
|
1.1
|
 Â
|
|
 MiaoliÂ
|
1.8
|
 Â
|
|
 NantouÂ
|
0.9
|
 Â
|
|
 New TaipeiÂ
|
11.4
|
 Â
|
|
 PingtungÂ
|
1.9
|
 Â
|
|
 TaichungÂ
|
23.5
|
 Â
|
|
 TainanÂ
|
10.6
|
 Â
|
|
 TaipeiÂ
|
13.1
|
 Â
|
|
 TaitungÂ
|
0.7
|
 Â
|
|
 TaoyuanÂ
|
4.2
|
 Â
|
|
 YilanÂ
|
0.2
|
 Â
|
|
 YunlinÂ
|
0.6
|
 Â
|
|
 #Total casesÂ
|
939
|
   Wave 4Â
|
 W$stateÂ
|
 ChanghuaÂ
|
6.1
|
 Â
|
|
 ChiayiÂ
|
1.1
|
 Â
|
|
 Chiayi cityÂ
|
1.2
|
 Â
|
|
 Hsinchu cityÂ
|
2.1
|
 Â
|
|
 Hsinchu countyÂ
|
1.3
|
 Â
|
|
 HualienÂ
|
1.6
|
 Â
|
|
 KaohsiungÂ
|
15.4
|
 Â
|
|
 KeelungÂ
|
0.6
|
 Â
|
|
 MiaoliÂ
|
3.5
|
 Â
|
|
 NantouÂ
|
1.4
|
 Â
|
|
 New TaipeiÂ
|
14.4
|
 Â
|
|
 PingtungÂ
|
2.6
|
 Â
|
|
 TaichungÂ
|
18.7
|
 Â
|
|
 TainanÂ
|
11.5
|
 Â
|
|
 TaipeiÂ
|
10.7
|
 Â
|
|
 TaitungÂ
|
0.4
|
 Â
|
|
 TaoyuanÂ
|
5.4
|
 Â
|
|
 YilanÂ
|
0.2
|
 Â
|
|
 YunlinÂ
|
1.8
|
 Â
|
|
 #Total casesÂ
|
897
|
cro_tpct(W$state) %>% set_caption("City: Percentages") %>% rename(Percent = `#Total`)
City: Percentages
|
|
 PercentÂ
|
 W$stateÂ
|
   ChanghuaÂ
|
4.4
|
   ChiayiÂ
|
1.2
|
   Chiayi cityÂ
|
1.2
|
   Hsinchu cityÂ
|
2.1
|
   Hsinchu countyÂ
|
1
|
   HualienÂ
|
1.8
|
   KaohsiungÂ
|
18.1
|
   KeelungÂ
|
0.7
|
   MiaoliÂ
|
2.6
|
   NantouÂ
|
1.3
|
   New TaipeiÂ
|
13
|
   PingtungÂ
|
2.1
|
   TaichungÂ
|
21.1
|
   TainanÂ
|
11
|
   TaipeiÂ
|
11.7
|
   TaitungÂ
|
0.5
|
   TaoyuanÂ
|
4.5
|
   YilanÂ
|
0.3
|
   YunlinÂ
|
1.3
|
   #Total casesÂ
|
3825
|
Age Bins
cro_tpct(W$Agebins, row_vars=W$WaveN) %>% set_caption("Age bins by wave: Percentages") %>% rename(Percent = `#Total`)
Age bins by wave: Percentages
|
|
|
|
 PercentÂ
|
 W$WaveNÂ
|
   Wave 1Â
|
 W$AgebinsÂ
|
 20-29Â
|
25.6
|
 Â
|
|
 30-39Â
|
24.1
|
 Â
|
|
 40-49Â
|
25.2
|
 Â
|
|
 50-59Â
|
18.8
|
 Â
|
|
 60-69Â
|
5.8
|
 Â
|
|
 70-79Â
|
0.3
|
 Â
|
|
 80+Â
|
0.1
|
 Â
|
|
 #Total casesÂ
|
971
|
   Wave 2Â
|
 W$AgebinsÂ
|
 20-29Â
|
26.9
|
 Â
|
|
 30-39Â
|
24.1
|
 Â
|
|
 40-49Â
|
25
|
 Â
|
|
 50-59Â
|
16.8
|
 Â
|
|
 60-69Â
|
6.5
|
 Â
|
|
 70-79Â
|
0.8
|
 Â
|
|
 80+Â
|
|
 Â
|
|
 #Total casesÂ
|
1018
|
   Wave 3Â
|
 W$AgebinsÂ
|
 20-29Â
|
23.5
|
 Â
|
|
 30-39Â
|
24.9
|
 Â
|
|
 40-49Â
|
26.3
|
 Â
|
|
 50-59Â
|
20.4
|
 Â
|
|
 60-69Â
|
4.7
|
 Â
|
|
 70-79Â
|
|
 Â
|
|
 80+Â
|
0.1
|
 Â
|
|
 #Total casesÂ
|
939
|
   Wave 4Â
|
 W$AgebinsÂ
|
 20-29Â
|
24.2
|
 Â
|
|
 30-39Â
|
24.7
|
 Â
|
|
 40-49Â
|
25.6
|
 Â
|
|
 50-59Â
|
17.7
|
 Â
|
|
 60-69Â
|
6.2
|
 Â
|
|
 70-79Â
|
1.3
|
 Â
|
|
 80+Â
|
0.1
|
 Â
|
|
 #Total casesÂ
|
897
|
cro_tpct(W$Agebins) %>% set_caption("Age bins: Percentages") %>% rename(Percent = `#Total`)
Age bins: Percentages
|
|
 PercentÂ
|
 W$AgebinsÂ
|
   20-29Â
|
25.1
|
   30-39Â
|
24.4
|
   40-49Â
|
25.5
|
   50-59Â
|
18.4
|
   60-69Â
|
5.8
|
   70-79Â
|
0.6
|
   80+Â
|
0.1
|
   #Total casesÂ
|
3825
|
Figures for the national paper
FIGURE: RISKS FROM COVID-19
Var = c('COVID_gen_harm','COVID_pers_harm','COVID_pers_concern','COVID_concern_oth')
CoVars = gather(W %>% select(WaveN, Var), key = 'key', value = 'value', Var, -WaveN )
CoVars$key = factor(CoVars$key,labels=c("General\nharm","Personal\nharm","Concern\nself","Concern\nothers"))
MCMCd_risk = MCMCpack::MCMCoprobit(as.formula('value ~ 1 + WaveN * key'), data = CoVars, tune = 0.3, mcmc = 20000)
MCMCs = HDIsummary(MCMCd_risk, levels(CoVars$WaveN), levels(CoVars$key))
Lines = Siglines(MCMCs)
tsize = 3.8
Plt = ggplot(MCMCs$Means, aes(x = Factor2, y = .value, group = Factor1, fill = Factor1, color = Factor1)) +
geom_errorbar(aes(ymin = .lower, ymax = .upper, x = Factor2, group = Factor1),
position = position_dodge(.75), width = .5, size = 1.25, color = rep(WaveCols,each=4, alpha=1)) +
geom_point(size = 2, shape = 21, stroke = 0, position = position_dodge(.75), alpha = 1) +
PltTheme +
scale_fill_manual(values = rep('black',4) ) + PltTheme +
scale_color_manual(values = WaveCols, labels = c("Wave 1", "Wave 2", "Wave 3", "Wave 4") ) +
ylab('Posterior means') + xlab('') +
scale_y_continuous(expand = c(.0, .1), breaks = 0:5, limits = c(-.7, 3.7),
labels = c('0','1','2','3','4','5')) +
theme( legend.direction = 'horizontal',
legend.position = c(.47,-.19),
plot.margin=unit(c(0,.5,0.4,.5),"cm"),
legend.text=element_text(size=14, face = 'bold'),
legend.key.size = unit(2,"line"),
legend.key = element_rect(fill = "white")) +
annotate('segment', x = 0.5, xend = 4.5, y = MCMCs$Cutpoints[1], yend = MCMCs$Cutpoints[1], alpha = .2, linetype = 'dashed') +
annotate('segment', x = 0.5, xend = 4.5, y = MCMCs$Cutpoints[2], yend = MCMCs$Cutpoints[2], alpha = .2, linetype = 'dashed') +
annotate('segment', x = 0.5, xend = 4.5, y = MCMCs$Cutpoints[3], yend = MCMCs$Cutpoints[3], alpha = .2, linetype = 'dashed') +
annotate('segment', x = 0.5, xend = 4.5, y = MCMCs$Cutpoints[4], yend = MCMCs$Cutpoints[4], alpha = .2, linetype = 'dashed') +
annotate('text', x = 4.5, y = MCMCs$Cutpoints[1] - MCMCs$Cutpoints[2]*.5, label = 'None', angle = 90, alpha = .5, size = tsize) +
annotate('text', x = 4.5, y = MCMCs$Cutpoints[1] + MCMCs$Cutpoints[2]*.5, label = 'Slight', angle = 90, alpha = .5, size = tsize) +
annotate('text', x = 4.5, y = MCMCs$Cutpoints[2] + (MCMCs$Cutpoints[3] - MCMCs$Cutpoints[2])*.5, label = 'Some', angle = 90, alpha = .5, size = tsize) +
annotate('text', x = 4.5, y = MCMCs$Cutpoints[3] + (MCMCs$Cutpoints[4] - MCMCs$Cutpoints[3])*.5, label = 'Very', angle = 90, alpha = .5, size = tsize) +
annotate('text', x = 4.5, y = MCMCs$Cutpoints[4] + (MCMCs$Cutpoints[4] - MCMCs$Cutpoints[3])*.4, label = 'Ext', angle = 90, alpha = .5, size = tsize) +
labs(title = 'Perceived risk from COVID-19') +
guides(colour = guide_legend(override.aes = list(shape = 15, size = 5)))
#for (ii in 1:length(Lines$y)){
# Plt = Plt + annotate('segment', x = Lines$xi[ii], xend = Lines$xe[ii], y = Lines$y[ii], yend = Lines$y[ii] )
#}
ggsave(filename = 'Figures\\CovidRisks.pdf', plot = Plt, dpi = 5000, units = 'cm', height = 12.5, width = 18)
Plt
FIGURE: BENEFITS FROM TRACKING
Var = c('Reduce_Likelihood','Reduce_Spread','Return_Activity')
D = gather(W %>% select(Scenario, Var), key = 'key', value = 'value', Var, -Scenario )
D$key = factor(D$key,labels=c("Reduce contraction","Reduce spread", "Resume activities"))
MCMCd_benefits = MCMCpack::MCMCoprobit(as.formula('value ~ 1 + Scenario * key'), data = D, tune = 0.3, mcmc = 20000)
MCMCs = HDIsummary(MCMCd_benefits, levels(D$Scenario), levels(D$key))
Lines = Siglines(MCMCs, pos = c(-2, 0, 2), yoffset = .075 )
tsize = 3.8
Plt = ggplot(MCMCs$Means, aes(x = Factor2, y = .value, group = Factor1, fill = Factor1, color = Factor1)) +
geom_errorbar(aes(ymin = .lower, ymax = .upper, x = Factor2, group = Factor1),
position = position_dodge(.75), width = .4, size = 1.25, color = rep(PrimeCols[c(1,2,3)],each=3, alpha=1)) +
geom_point(size = 2, shape = 21, stroke = 0, position = position_dodge(.75), alpha = 1) +
PltTheme +
scale_fill_manual(values = rep('black',4), guide = FALSE ) + PltTheme +
scale_color_manual(values = PrimeCols, labels = c("Telecommunication", "Bluetooth", "Gov App", "COVIDSafe") ) +
ylab('Posterior means') + xlab('') +
scale_y_continuous(expand = c(.0, .1), breaks = 0:5, limits = c(-.8, 4.7),
labels = c('0','1','2','3','4','5')) +
theme( legend.direction = 'horizontal',
legend.position = c(.44,-.13),
plot.margin=unit(c(0,.5,0.5,.5),"cm"),
legend.text=element_text(size=14, face = 'bold'),
legend.key.size = unit(2,"line"),
legend.key = element_rect(fill = "white")) +
annotate('segment', x = 0.5, xend = 3.5, y = MCMCs$Cutpoints[1], yend = MCMCs$Cutpoints[1], alpha = .2, linetype = 'dashed') +
annotate('segment', x = 0.5, xend = 3.5, y = MCMCs$Cutpoints[2], yend = MCMCs$Cutpoints[2], alpha = .2, linetype = 'dashed') +
annotate('segment', x = 0.5, xend = 3.5, y = MCMCs$Cutpoints[3], yend = MCMCs$Cutpoints[3], alpha = .2, linetype = 'dashed') +
annotate('segment', x = 0.5, xend = 3.5, y = MCMCs$Cutpoints[4], yend = MCMCs$Cutpoints[4], alpha = .2, linetype = 'dashed') +
annotate('segment', x = 0.5, xend = 3.5, y = MCMCs$Cutpoints[5], yend = MCMCs$Cutpoints[5], alpha = .2, linetype = 'dashed') +
annotate('text', x = 3.5, y = MCMCs$Cutpoints[1] - MCMCs$Cutpoints[2]*.5, label = 'None', angle = 90, alpha = .5, size = tsize) +
annotate('text', x = 3.5, y = MCMCs$Cutpoints[1] + MCMCs$Cutpoints[2]*.5, label = 'Slight', angle = 90, alpha = .5, size = tsize) +
annotate('text', x = 3.5, y = MCMCs$Cutpoints[2] + (MCMCs$Cutpoints[3] - MCMCs$Cutpoints[2])*.5, label = 'A bit', angle = 90, alpha = .5, size = tsize) +
annotate('text', x = 3.5, y = MCMCs$Cutpoints[3] + (MCMCs$Cutpoints[4] - MCMCs$Cutpoints[3])*.5, label = 'Mod', angle = 90, alpha = .5, size = tsize) +
annotate('text', x = 3.5, y = MCMCs$Cutpoints[4] + (MCMCs$Cutpoints[5] - MCMCs$Cutpoints[4])*.5, label = 'A lot', angle = 90, alpha = .5, size = tsize) +
annotate('text', x = 3.5, y = MCMCs$Cutpoints[5] + (MCMCs$Cutpoints[5] - MCMCs$Cutpoints[4])*.3, label = 'Extr', angle = 90, alpha = .5, size = tsize) +
labs(title = 'Perceived benefits from tracking technologies') +
guides(colour = guide_legend(override.aes = list(shape = 15, size = 5)))
for (ii in 1:length(Lines$y)){
Plt = Plt + annotate('segment', x = Lines$xi[ii], xend = Lines$xe[ii], y = Lines$y[ii], yend = Lines$y[ii] )
}
ggsave(filename = 'Figures\\TrackingBenefits.pdf', plot = Plt, dpi = 5000, units = 'cm', height = 12.5, width = 18)
Plt
FIGURE: RISKS FROM TRACKING
Var = c('Decline', 'Necessary', 'Sensitive', 'Risk', 'TrustIntentions', 'TrustPrivacy', 'Security', 'ongoing_control')
D = gather(W %>% select(Scenario, Var), key = 'key', value = 'value', Var, -Scenario )
D$key = factor(D$key,labels=c('Difficult\nDecline','Necessary\nData','Sensitive\nData','Risk','Trust\nIntentions','Trust\nPrivacy','Data\nsecurity','Ongoing\ncontrol'))
D$key = factor(D$key, c('Difficult\nDecline','Necessary\nData','Sensitive\nData','Risk','Trust\nIntentions','Trust\nPrivacy','Data\nsecurity','Ongoing\ncontrol'))
#D$value[D$key == 'Difficult\nDecline'] = revscore(D$value[D$key == 'Difficult\nDecline'], 6)
MCMCd_percepts = MCMCpack::MCMCoprobit(as.formula('value ~ 1 + Scenario * key'), data = D, tune = 0.3, mcmc = 20000)
MCMCs = HDIsummary(MCMCd_percepts, levels(D$Scenario), levels(D$key))
Lines = Siglines(MCMCs, pos = c(-2, 0, 2), yoffset = .075)
tsize = 3.8
Plt = ggplot(MCMCs$Means, aes(x = Factor2, y = .value, group = Factor1, fill = Factor1, color = Factor1)) +
geom_errorbar(aes(ymin = .lower, ymax = .upper, x = Factor2, group = Factor1),
position = position_dodge(.75), width = .5, size = 1.25, color = rep(PrimeCols[c(1,2,3)],each=8, alpha=1)) +
geom_point(size = 2, shape = 21, stroke = 0, position = position_dodge(.75), alpha = 1) +
PltTheme +
scale_fill_manual(values = rep('black',4), guide = FALSE ) + PltTheme +
scale_color_manual(values = PrimeCols, labels = c("Telecommunication", "Bluetooth", "Gov App", "COVIDSafe") ) +
ylab('Posterior means') + xlab('') +
scale_y_continuous(expand = c(.0, .1), breaks = 0:7, limits = c(3, 7),
labels = c('0','1','2','3','4','5','6','7')) +
theme( legend.direction = 'horizontal',
legend.position = c(.47,-.2),
plot.margin=unit(c(0,.5,0.8,.5),"cm"),
legend.text=element_text(size=14, face = 'bold'),
legend.key.size = unit(2,"line"),
legend.key = element_rect(fill = "white")) +
annotate('segment', x = 0.5, xend = 8.5, y = MCMCs$Cutpoints[1], yend = MCMCs$Cutpoints[1], alpha = .2, linetype = 'dashed') +
annotate('segment', x = 0.5, xend = 8.5, y = MCMCs$Cutpoints[2], yend = MCMCs$Cutpoints[2], alpha = .2, linetype = 'dashed') +
annotate('segment', x = 0.5, xend = 8.5, y = MCMCs$Cutpoints[3], yend = MCMCs$Cutpoints[3], alpha = .2, linetype = 'dashed') +
annotate('segment', x = 0.5, xend = 8.5, y = MCMCs$Cutpoints[4], yend = MCMCs$Cutpoints[4], alpha = .2, linetype = 'dashed') +
annotate('segment', x = 0.5, xend = 8.5, y = MCMCs$Cutpoints[5], yend = MCMCs$Cutpoints[5], alpha = .2, linetype = 'dashed') +
annotate('text', x = 8.5, y = MCMCs$Cutpoints[1] - MCMCs$Cutpoints[2]*.5, label = 'None', angle = 90, alpha = .5, size = tsize) +
annotate('text', x = 8.5, y = MCMCs$Cutpoints[1] + MCMCs$Cutpoints[2]*.5, label = 'Slight', angle = 90, alpha = .5, size = tsize) +
annotate('text', x = 8.5, y = MCMCs$Cutpoints[2] + (MCMCs$Cutpoints[3] - MCMCs$Cutpoints[2])*.5, label = 'A bit', angle = 90, alpha = .5, size = tsize) +
annotate('text', x = 8.5, y = MCMCs$Cutpoints[3] + (MCMCs$Cutpoints[4] - MCMCs$Cutpoints[3])*.5, label = 'Mod', angle = 90, alpha = .5, size = tsize) +
annotate('text', x = 8.5, y = MCMCs$Cutpoints[4] + (MCMCs$Cutpoints[5] - MCMCs$Cutpoints[4])*.5, label = 'A lot', angle = 90, alpha = .5, size = tsize) +
annotate('text', x = 8.5, y = MCMCs$Cutpoints[5] + (MCMCs$Cutpoints[5] - MCMCs$Cutpoints[4])*.5, label = 'Extr', angle = 90, alpha = .5, size = tsize) +
labs(title = 'Perceived risks from tracking technologies') +
guides(colour = guide_legend(override.aes = list(shape = 15, size = 5)))
for (ii in 1:length(Lines$y)){
Plt = Plt + annotate('segment', x = Lines$xi[ii], xend = Lines$xe[ii], y = Lines$y[ii], yend = Lines$y[ii] )
}
ggsave(filename = 'Figures\\TrackingRisks.pdf', plot = Plt, dpi = 5000, units = 'cm', height = 13, width = 22)
Plt
FIGURE: ACCEPTABILITY OF TRACKING TECHNOLOGIES
D = W %>% select(Scenario, Accept2, Sunset, ChangeOther) %>% split(W$Scenario)
D$Telecommunication$ChangeOther = rowSums(cbind(D$Telecommunication$ChangeOther, D$Telecommunication$Accept2), na.rm=T)
D$`Government App`$ChangeOther = rowSums(cbind(D$`Government App`$ChangeOther, D$`Government App`$Accept2), na.rm=T)
CI = matrix(0, 9, 3)
count = 0
for (ii in 1:3){
for (kk in 2:4){
count = count + 1
x = bayes.prop.test( as.integer(round(mean(D[[ii]][[kk]],na.rm=T) * 100)), nrow(D[[ii]]), n.iter = 20000 )
CI[count,1] = x$stats[1,5] * 100
CI[count,2] = x$stats[1,6] * 100
CI[count,3] = mean(D[[ii]][[kk]],na.rm=T) * 100
}
}
d = data.frame(Scenario = rep(levels(W$Scenario),each=3), key = c('Accept','Sunset','Opt Out', 'Accept', 'Sunset', 'NA','Accept', 'Sunset', 'Local Storage'), M = CI[,3], Low = CI[,1], High = CI[,2], color = c(1,.6,.4,1,.6,.4,1,.6,.4))
d = d[d$key != 'NA',]
d$Scenario = factor(d$Scenario, levels = c('Telecommunication', 'Bluetooth', 'Government App'))
d$key = factor(d$key, levels = c('Accept', 'Sunset', 'Opt Out', 'Local Storage'))
d$X = c(.1, .19, .28, .43, .57, .73, .82, .91)
Plt = ggplot(d) +
geom_col(aes(y = M, x = Scenario, group = key, fill = Scenario), alpha = d$color,
position = 'dodge') +
geom_errorbar( aes(y = M, x = Scenario, group = key, fill = Scenario, ymin=M-Low, ymax=M+High), width=.2, position=position_dodge(.9)) +
scale_fill_manual(values = PrimeCols ) +
PltTheme +
scale_y_continuous( expand = c(0, 0), limits = c(0,100) ) +
labs(title = 'Tracking Acceptability', y = 'Percent (%)', x = '') +
theme( legend.direction = 'vertical',
plot.title = element_text(size = 16),
axis.title = element_text(size=14),
legend.key = element_rect(fill = "white"),
legend.position = c(.5,-.23),
legend.text = element_text(size = 14),
#plot.margin=unit(c(0,0,1.7,0),"cm"),
plot.margin=unit(c(0,0,2.5,0),"cm"),
axis.text.x = element_text(angle=45, hjust = 1, color = 'white',size=0)) +
guides(fill=guide_legend(ncol=4))
for (p in 1:8){
Plt = Plt + annotation_custom(grob = textGrob(d$key[p], x = d$X[p], y = -.04, rot = 45, just = 1, gp = gpar(fontsize = 14) ))
}
gt <- ggplot_gtable(ggplot_build(Plt))
gt$layout$clip[gt$layout$name == "panel"] = "off"
#grid.arrange(gt)
ggsave(filename = 'Figures\\TrackingAcceptability.pdf', plot = gt, dpi = 5000, units = 'cm', height = 15, width = 24)
grid.arrange(gt)
Modelling
Examination of which items correlate with one-another
CorData = W %>% select(Education, Resilience, libertarianism, Accept2, ongoing_control, Security, TrustIntentions, TrustPrivacy, Risk, Sensitive, Necessary, Decline, Reduce_Spread, Return_Activity, Reduce_Likelihood)
CorData %>%
mutate(across(as.numeric())) %>%
cor(use = "pairwise.complete.obs") %>%
corrplot::corrplot(type = "upper", method = "number",
tl.col = "black", tl.srt = 45,
sig.level = 0.01, insig = "blank", number.cex = .70)
Frequentist Modelling for Tracking Acceptance
ModelData = W %>% select(Scenario, Age, education, gender, Resilience, libertarianism, Accept2, Sunset, ongoing_control, Security, TrustIntentions, TrustPrivacy, Risk, Sensitive, Necessary, Decline, Reduce_Spread, Return_Activity, Reduce_Likelihood)
### Check missing data
#nrow(ModelData)
#ModelData %>% drop_na() %>% nrow()
Equ = 'Accept2 ~ Age + education + gender + Resilience + libertarianism + ongoing_control + Security + TrustIntentions + TrustPrivacy + Risk + Sensitive + Necessary + Decline + Reduce_Spread + Return_Activity + Reduce_Likelihood + (1|Scenario)'
Model <- glmer(Equ, data = ModelData, family = binomial(link = "logit"),
control = glmerControl(optCtrl = list(maxfun=2e8)))
summary(Model)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: Accept2 ~ Age + education + gender + Resilience + libertarianism +
## ongoing_control + Security + TrustIntentions + TrustPrivacy +
## Risk + Sensitive + Necessary + Decline + Reduce_Spread +
## Return_Activity + Reduce_Likelihood + (1 | Scenario)
## Data: ModelData
## Control: glmerControl(optCtrl = list(maxfun = 2e+08))
##
## AIC BIC logLik deviance df.resid
## 3250.2 3381.4 -1604.1 3208.2 3804
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -25.5831 -0.3359 0.2611 0.4903 7.7013
##
## Random effects:
## Groups Name Variance Std.Dev.
## Scenario (Intercept) 0.01193 0.1092
## Number of obs: 3825, groups: Scenario, 3
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -6.5082887 0.7020246 -9.271 < 2e-16 ***
## Age 0.0004474 0.0040579 0.110 0.91220
## education> H.Sch 1.4375455 0.4494683 3.198 0.00138 **
## educationUni 1.3459466 0.4348571 3.095 0.00197 **
## genderWoman -0.0453171 0.0920121 -0.493 0.62236
## genderOther -1.3653107 2.1610705 -0.632 0.52753
## genderPrefer not to say 0.4589739 1.5442879 0.297 0.76631
## Resilience 0.0066280 0.0032025 2.070 0.03849 *
## libertarianism -0.0836711 0.0587116 -1.425 0.15412
## ongoing_control 0.2004871 0.0443216 4.523 6.08e-06 ***
## Security 0.3662773 0.0672739 5.445 5.19e-08 ***
## TrustIntentions 0.1766553 0.0641416 2.754 0.00588 **
## TrustPrivacy 0.0651845 0.0702797 0.928 0.35367
## Risk 0.1059795 0.0584247 1.814 0.06969 .
## Sensitive -0.1942931 0.0602529 -3.225 0.00126 **
## Necessary 0.1131544 0.0525466 2.153 0.03129 *
## Decline -0.0177261 0.0445057 -0.398 0.69042
## Reduce_Spread 0.2245020 0.0826170 2.717 0.00658 **
## Return_Activity 0.2035556 0.0855548 2.379 0.01735 *
## Reduce_Likelihood 0.4796450 0.0791146 6.063 1.34e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1