Data Center Opinion Project - Study 2: Investment framing

Research question:

Do developer investments in local communities increase support for a local data center? And if so, which increase support the most?

Pre-IV Qs

How often would you say you use AI tools such as Chat GPT and Claude, in your day-to-day life? [Never / Less than once a month / A few times a month / Daily]

Overall, would you favor or oppose the construction of more data centers in your local community to support artificial intelligence, or AI, technology in the U.S.? [Strongly oppose / Somewhat oppose / Neither favor nor oppose / Somewhat favor / Strongly favor]

[Demographics items from survey platform]

IV

Participants were randomly assigned to view one of four propositions for a local data center build.

Control condition

  • A technology company has proposed building a data center for AI applications in your local community.
  • The technology company would operate under a sales tax exemption, as is the standard for most previous data center projects.

Taxes condition

  • A technology company has proposed building a data center for AI applications in your local community.
  • Under a negotiated agreement, the company would provide a $240 million investment in your local community, distributed as a $10,000 payment to each household.

Pro-environmental efforts condition

  • A technology company has proposed building a data center for AI applications in your local community.
  • Under a negotiated agreement, the company would provide a $240 million investment in your local community, distributed to environmental initiatives.

Social capital condition

  • A technology company has proposed building a data center for AI applications in your local community.
  • Under a negotiated agreement, the company would provide a $240 million investment in your local community, distributed as a schools, libraries, and community centers.

Post-IV measures

How many data centers are currently in your local community? [None, 1-2, 2+, I don’t know]

Considering the negotiated terms, would you favor or oppose the construction of this data center in your local community? [Strongly oppose / Somewhat oppose / Neither favor nor oppose / Somewhat favor / Strongly favor]

show code
dcOpinion_study2 = readRDS('study 2/data-centers2-cleaned.rds') %>% 
  filter(`U.s. political affiliation` != 'CONSENT_REVOKED') %>% 
  mutate(condition=as.factor(condition),
         support = post_support -3,
         ai_use = factor(ai_use, levels=c('Never','Less than once a month','A few times a month','Daily')),
         income = factor(verasight_income, levels=c('Less than $15,000','$15,000 to under $50,0000','$50,000 to under $75,000','$75,000 to under $100,000','$100,000 to under $150,000','$150,000 to under $200,000','More than $200,000')),
         dataCenterDensity = factor(number_data_centers, levels=c('None',"I don't know", '2-Jan','2+'), labels=c('None',"I don't know", '1-2','2+')),
         pre_support = factor(support_local, levels=c('Strongly oppose','Somewhat oppose','Neither favor nor oppose','Somewhat favor','Strongly favor'))) %>% 
  mutate(support_difference = post_support - as.numeric(pre_support),
         pre_support = as.numeric(pre_support) -3) %>% 
  mutate(poli_id = factor(`U.s. political affiliation`),
         dataCenterDensity_binned = factor(ifelse(as.numeric(dataCenterDensity) < 3, 'None', '1+'), levels=c('None', '1+')),
         pre_supporter = factor(ifelse(pre_support >0, 'Supporter','Non-Supporter'), levels=c('Non-Supporter','Supporter')),
         income_buckets = ifelse(as.numeric(income) < 4, "lower income",
                                                    ifelse(as.numeric(income) ==4 | as.numeric(income) ==5, "middle income",
                                                           ifelse(as.numeric(income) >5, "upper income", NA))),
         age_buckets = factor(ifelse(as.numeric(Age)<30, '18-29',
                                                ifelse(as.numeric(Age)>29 & as.numeric(Age)<50, '30-49',
                                                       ifelse(as.numeric(Age) >49 & as.numeric(Age) <65, '50-64', '65+'))), levels=c('18-29','30-49','50-64','65+')))

nice_table(dcOpinion_study2 %>% group_by(condition)  %>%    count(), title = 'N per condition')

N per condition

condition

n

control

495

environment

502

social-cap

498

taxes

496

show code
ggcorrplot(round(cor(dcOpinion_study2 %>%  
                       mutate(income=as.numeric(income), poli_id=as.numeric(poli_id), dataCenterDensity_binned = as.numeric(dataCenterDensity), ai_use = as.numeric(ai_use), Age = as.numeric(Age)) %>%  
                       select(ai_use, income, poli_id, dataCenterDensity_binned, social_capital, taxes, environment, Age, pre_support, support),
                     use='complete.obs'), 3),
           hc.order = TRUE, type = "upper", outline.color = "white", ggtheme = ggplot2::theme_gray, colors = c("#E46726", "white","#6D9EC1" ), lab=TRUE, digits=2)

Total of N = 1991

Overall pre-support

show code
nice_table(dcOpinion_study2 %>% group_by(pre_support) %>% tally() %>% mutate(percent = n/sum(n)*100))

pre_support

n

percent

-2.00

776

38.98

-1.00

410

20.59

0.00

348

17.48

1.00

338

16.98

2.00

119

5.98

Support by condition

show code
# nice_table(dcOpinion_study2 %>% group_by(condition, support) %>% tally() %>% mutate(percent = n/sum(n)*100))

supportByconditionPlot = dcOpinion_study2 %>% group_by(condition, support) %>% tally() %>% mutate(percent = n/sum(n)*100) %>% mutate(support = fct_rev(factor(support))) %>% 
  ggplot(aes(x = .5, y=percent, fill = support))+
  geom_bar(stat = "identity", color='white') +
  theme_void(base_size=15)+
  labs(fill="", x='') +
  theme(legend.position='top')+
  scale_fill_manual(values=c('#232D4B','#C8CBD2','#FDDA24','#F9DCBF','#E57200'))+
  coord_flip()+
  facet_wrap(~condition, ncol = 1)

supportByconditionPlot

show code
# ggsave(supportByconditionPlot, filename='study 2/supportByCondition_pieBarPlot.png', dpi = 300, width=12, height = 12)

supportByconditionErrorPlot = ggerrorplot(data=dcOpinion_study2, x='condition',y='support', color='condition', ylim=c(-2,0.15))+
  scale_color_manual(values=c('#232d4b','#ef3f6b','#62BB46','#25CAD3'))

# ggsave(supportByconditionErrorPlot, filename='study 2/supportByCondition_plot.png', dpi = 300, width=5, height = 7)

supportByconditionErrorPlot

show code
nice_table(tidy(lm(data=dcOpinion_study2, support ~ fct_rev(condition))))

Term

estimate

std.error

statistic

p

(Intercept)

-0.08

0.06

-1.38

.168

fct_rev(condition)social-cap

-0.24

0.09

-2.82

.005**

fct_rev(condition)environment

-0.19

0.09

-2.20

.028*

fct_rev(condition)control

-0.73

0.09

-8.35

< .001***

Any type of investment by the tech company increases support. However, individual payouts increase support the most. The effects of investments in public goods and in pro-environmental efforts were indistinguishable from each other.

Other options for visualizations.

show code
oppositionVsupportSplitTable = dcOpinion_study2 |> 
  mutate(supporter = factor(ifelse(support==0, 0, post_supporter+1), labels=c('Neither','Opposer','Supporter'))) %>% 
  group_by(condition, supporter) %>% tally() %>% mutate(percent = n/sum(n)*100) |> 
  rbind(dcOpinion_study2 |> 
  mutate(supporter = factor(ifelse(pre_support==0, 0, as.numeric(pre_supporter)), labels=c('Neither','Opposer','Supporter'))) %>%  group_by(supporter)  %>% tally() %>%
  mutate(percent = n/sum(n)*100,
         condition = 'baseline')) |> 
  select(-n)

oppositionVsupportSplitTable_wide = pivot_wider(oppositionVsupportSplitTable, names_from = supporter, values_from = percent) |> 
  mutate(netFavor = Supporter-Opposer, 
         pre_post = factor(ifelse(condition == 'baseline', 'pre', 'post'), levels=c('pre','post')))


netFavorByConditionPlot = ggplot(oppositionVsupportSplitTable_wide |> filter(condition!='baseline') |> mutate(condition = factor(condition, levels=c('taxes','social-cap','environment','control'))) , y = condition, x = netFavor)+
 geom_segment(aes(x= -42.6, xend = netFavor, y= condition), color='#232D4B',linewidth=1, arrow = arrow(length = unit(0.25,"cm"), type = "closed"))+
  theme_classic()+
  xlim(c(-45, 10))

# ggsave(netFavorByConditionPlot, filename='study 2/netFavorByConditionPlot.png', dpi = 300, width=7, height = 4)

pre_postOpposer_plot = ggplot(oppositionVsupportSplitTable_wide |> filter(condition!='control'), aes(x = pre_post, y = Opposer, color=condition))+
  geom_segment(data=oppositionVsupportSplitTable_wide |> filter(condition!='control' & pre_post =='post'), aes(x = 'pre', xend = 'post', y = 59.6, yend = Opposer), linewidth = 1) +
  geom_point(stat='identity', size=3)+
  ylim(c(20, 70))+
  theme_minimal()+
  scale_color_manual(values=c('#737373','#009fdf','#009fdf','#009fdf'))

# ggsave(pre_postOpposer_plot, filename='study 2/pre_postOpposer_plot.png', dpi = 300, width=7, height = 6)

pre_postSupporter_plot = ggplot(oppositionVsupportSplitTable_wide |> filter(condition!='control'), aes(x = pre_post, y = Supporter, color=condition))+
  geom_segment(data=oppositionVsupportSplitTable_wide |> filter(condition!='control' & pre_post =='post'), aes(x = 'pre', xend = 'post', y = 23, yend = Supporter), linewidth = 1) +
  geom_point(stat='identity', size=3)+
  ylim(c(20, 70))+
  theme_minimal()+
  scale_color_manual(values=c('#737373','#63bb47','#63bb47','#63bb47'))

# ggsave(pre_postSupporter_plot, filename='study 2/pre_postSupporter_plot.png', dpi = 300, width=7, height = 6)

Pre- post- and difference score analysis

Participants reported their support for a local data center build both pre- and post-IV.

show code
dcOpinion_study2_long = dcOpinion_study2 %>% select(condition, support, pre_support, poli_id, dataCenterDensity_binned) %>% rename(pre = 'pre_support', post = 'support') %>% mutate(PID = 1:nrow(.)) %>% 
pivot_longer(., 2:3, names_to = "time", values_to="support") %>% mutate(time = factor(time, levels=c('pre', 'post'))) 

ggerrorplot(data=dcOpinion_study2_long,x = 'time', y = 'support', color='condition',  alpha=0.05, position = position_dodge(0)) +
  geom_line(alpha=0.15, aes(group = PID, color=condition), position=position_jitter()) +
  labs(color='Condition',y = 'Support',x='')+
  coord_cartesian(ylim=c(-1,0))

show code
ggscatter(data=dcOpinion_study2, x = 'pre_support', y = 'support', color='condition', add = "loess", conf.int = TRUE, position= position_jitter(width=0.2), alpha=.25)

Mixed effects model

show code
nice_table(tidy(lmer(data = dcOpinion_study2_long, support ~ time * condition + (1 | PID))) %>% filter(effect=='fixed') %>% select(-effect, -group, -statistic), title='Mixed effects model: Support ~ Time * Condition ')

Mixed effects model: Support ~ Time * Condition

Term

estimate

std.error

df

p

(Intercept)

-0.66

0.06

2,620.33

< .001***

timepost

-0.15

0.04

1,987.00

.001***

conditionenvironment

-0.04

0.08

2,620.33

.665

conditionsocial-cap

-0.07

0.08

2,620.33

.406

conditiontaxes

-0.05

0.08

2,620.33

.547

timepost × conditionenvironment

0.57

0.06

1,987.00

< .001***

timepost × conditionsocial-cap

0.55

0.06

1,987.00

< .001***

timepost × conditiontaxes

0.78

0.06

1,987.00

< .001***

Difference score plot

show code
study2_differencePlot = ggerrorplot(data=dcOpinion_study2, x='condition',y='support_difference', color='condition')+
  scale_color_manual(values=c('#232d4b','#ef3f6b','#62BB46','#25CAD3'))+
  coord_flip()

study2_differencePlot

show code
# ggsave(study2_differencePlot, filename='study 2/supportByCondition_differencePlot.png', dpi = 300, width=5, height = 3)

Moderation by political ID

show code
ggerrorplot(data=dcOpinion_study2, x='condition',y='support_difference', color='poli_id')+
  scale_color_manual(values=c('blue','#62BB46','red'))+
  coord_flip()

show code
nice_table(tidy(lmer(data = dcOpinion_study2_long, support ~ time * condition * poli_id + (1 | PID))) %>% filter(effect=='fixed') %>% select(-effect, -group, -statistic), title='Mixed effects model: Support ~ Time * Condition * Political ID')

Mixed effects model: Support ~ Time * Condition * Political ID

Term

estimate

std.error

df

p

(Intercept)

-0.87

0.11

2,643.54

< .001***

timepost

-0.18

0.08

1,979.00

.028*

conditionenvironment

-0.12

0.15

2,643.54

.438

conditionsocial-cap

-0.15

0.15

2,643.54

.339

conditiontaxes

-0.07

0.15

2,643.54

.613

poli_idIndependent

-0.02

0.14

2,643.54

.859

poli_idRepublican

0.80

0.15

2,643.54

< .001***

timepost × conditionenvironment

0.72

0.12

1,979.00

< .001***

timepost × conditionsocial-cap

0.64

0.12

1,979.00

< .001***

timepost × conditiontaxes

0.85

0.11

1,979.00

< .001***

timepost × poli_idIndependent

0.07

0.11

1,979.00

.537

timepost × poli_idRepublican

-0.01

0.12

1,979.00

.918

conditionenvironment × poli_idIndependent

0.08

0.20

2,643.54

.688

conditionsocial-cap × poli_idIndependent

0.21

0.20

2,643.54

.299

conditiontaxes × poli_idIndependent

0.11

0.20

2,643.54

.567

conditionenvironment × poli_idRepublican

0.16

0.22

2,643.54

.457

conditionsocial-cap × poli_idRepublican

-0.05

0.22

2,643.54

.835

conditiontaxes × poli_idRepublican

-0.08

0.22

2,643.54

.715

timepost × conditionenvironment × poli_idIndependent

-0.12

0.15

1,979.00

.409

timepost × conditionsocial-cap × poli_idIndependent

-0.08

0.15

1,979.00

.607

timepost × conditiontaxes × poli_idIndependent

-0.07

0.15

1,979.00

.658

timepost × conditionenvironment × poli_idRepublican

-0.33

0.17

1,979.00

.051

timepost × conditionsocial-cap × poli_idRepublican

-0.20

0.17

1,979.00

.239

timepost × conditiontaxes × poli_idRepublican

-0.18

0.17

1,979.00

.268

Moderation by income

show code
ggerrorplot(data=dcOpinion_study2, x='condition',y='support_difference', color='verasight_income')+
  coord_flip()

moderation by current data center density

show code
supportPredicteByDataCenterDensity_plot= dcOpinion_study2 %>% group_by(dataCenterDensity_binned, pre_support) %>% tally() %>% mutate(percent = n/sum(n)*100) %>% mutate(pre_support = fct_rev(factor( pre_support))) %>% 
  ggplot(aes(x = .5, y=percent, fill = pre_support))+
  geom_bar(stat = "identity", color='white') +
  theme_void(base_size=15)+
  labs(fill="", x='', title='Pretest Support predicted by Data Center Density') +
  theme(legend.position='top')+
  scale_fill_manual(values=c('#232D4B','#C8CBD2','#FDDA24','#F9DCBF','#E57200'))+
  coord_flip()+
  facet_wrap(~dataCenterDensity_binned, ncol = 1)

#ggsave(supportPredicteByDataCenterDensity_plot, filename='study 2/supportPredicteByDataCenterDensity_plot.png', dpi = 500, width=6, height = 4)

dcOpinion_study2 %>% group_by(condition,dataCenterDensity_binned, support) %>% tally() %>% mutate(percent = n/sum(n)*100) %>% mutate(support = fct_rev(factor(support))) %>% 
  ggplot(aes(x = .5, y=percent, fill = support))+
  geom_bar(stat = "identity", color='white') +
  theme_void(base_size=15)+
  labs(fill="", x='', title='Support predicted by Condition * Data Center Density') +
  theme(legend.position='top')+
  scale_fill_manual(values=c('#232D4B','#C8CBD2','#FDDA24','#F9DCBF','#E57200'))+
  coord_flip()+
  facet_wrap(~condition*dataCenterDensity_binned, ncol = 1)

show code
ggerrorplot(data=dcOpinion_study2, x='condition',y='support_difference', color='dataCenterDensity_binned')+
  scale_color_manual(values=c('blue','#62BB46'))+
  coord_flip()

show code
supportPlot_farResident = 
  dcOpinion_study2 %>% filter(dataCenterDensity_binned =='None') %>% 
  mutate(pre_support_binned = factor(ifelse(pre_support<0, 'Oppose',ifelse(pre_support>0, 'Support','Neither/Unsure')), levels=c('Oppose','Neither/Unsure','Support'))) |> 
  group_by(pre_support_binned) %>%  
  tally() %>% mutate(percent = n/sum(n)*100) %>% 
  ggplot(aes(x=pre_support_binned, y=percent, fill=as.factor(pre_support_binned))) +
  geom_bar(stat='identity')+
  theme_classic() +
  theme(legend.position='none')+
  coord_flip() +
  ylim(c(0,75))+
  scale_fill_manual(values=rev(c('#232D4B','#C8CBD2','#FDDA24','#F9DCBF','#E57200')))

supportPlot_nearResident = dcOpinion_study2 %>% filter(dataCenterDensity_binned =='1+') %>% 
  mutate(pre_support_binned = factor(ifelse(pre_support<0, 'Oppose',ifelse(pre_support>0, 'Support','Neither/Unsure')), levels=c('Oppose','Neither/Unsure','Support'))) |>
  group_by(pre_support_binned) %>% 
  tally() %>% mutate(percent = n/sum(n)*100) %>% 
  ggplot(aes(x=pre_support_binned, y=percent, fill=as.factor(pre_support_binned))) +
  geom_bar(stat='identity')+
  theme_classic() +
  theme(legend.position='none')+
  scale_fill_manual(values=rev(c('#232D4B','#C8CBD2','#FDDA24','#F9DCBF','#E57200')))+
  coord_flip() +
  ylim(c(0,75))

#ggsave(supportPlot_farResident, filename='study 2/supportPlot_farResident.png', dpi = 500, width=4, height = 4)
#ggsave(supportPlot_nearResident, filename='study 2/supportPlot_nearResident.png', dpi = 500, width=4, height = 4)


prePost_socialCap_plot = dcOpinion_study2_long |> filter(condition == 'social-cap') |> 
  ggplot(aes(y = support, x = dataCenterDensity_binned, fill=time)) +
  stat_summary(aes(fill = time), fun = "mean", geom = "point", size = 4, shape = 21, stroke = 0.5) +
  coord_flip(ylim=c(-1,0))+
  theme_classic(base_size=15)+
  scale_fill_manual(values=c('#009fe0','#e67202'))+
    theme(legend.position='none')

table(dcOpinion_study2_long |> filter(condition == 'social-cap' & dataCenterDensity_binned =='1+') |> group_by(time) |> summarise(mean = mean(support, na.rm=TRUE)))
      mean
time   -0.3 -0.0909090909090912
  pre     1                   0
  post    0                   1
show code
# far residents: -0.85, -0.4 = 0.45
# near residents: -0.3, -.1 = 0.2

#ggsave(prePost_socialCap_plot, filename='study 2/supportPlot_prePost_nearFar.png', dpi = 500, width=4, height = 3)

support_opposition_by_dataCenterDensity_plot = dcOpinion_study2 %>% 
  mutate(pre_support_binned = factor(ifelse(pre_support<0, 'Oppose', 
                                            ifelse(pre_support>0, 'Support','Neither/Unsure')))) |>
  group_by(dataCenterDensity_binned, pre_support_binned) %>% tally() %>% mutate(percent = n/sum(n)*100) |> 
      filter(pre_support_binned !='Neither/Unsure') |> 
  ggplot(aes(x = dataCenterDensity_binned, y = percent, color=pre_support_binned, group=pre_support_binned)) +
    geom_point(stat='identity', size=3)+
  geom_line()+
  theme_minimal()+
  scale_color_manual(values=c('#e67202','#232D4B'))+
  theme(legend.position='none')
  

#ggsave(support_opposition_by_dataCenterDensity_plot, filename='study 2/support_opposition_by_dataCenterDensity_plot.png', dpi = 500, width=4, height = 5)

characterizing the supporters

show code
dcOpinion_study2 %>% group_by(pre_supporter, dataCenterDensity_binned) %>% tally() %>% mutate(percent = n/sum(n)*100)  %>%
  ggplot(aes(x = .5, y=percent, fill = dataCenterDensity_binned))+
  geom_bar(stat = "identity", color='white') +
  theme_void(base_size=15)+
  labs(fill="", x='', title = "Pre-supporters predicted by data center density") +
  theme(legend.position='top')+
  scale_fill_manual(values=c('#232D4B','#C8CBD2','#FDDA24','#F9DCBF','#E57200'))+
  coord_flip()+
  facet_wrap(~pre_supporter, ncol = 1) 

show code
dcOpinion_study2 %>% group_by(pre_supporter, ai_use) %>% tally() %>% mutate(percent = n/sum(n)*100)  %>%
  ggplot(aes(x = .5, y=percent, fill = ai_use))+
  geom_bar(stat = "identity", color='white') +
  theme_void(base_size=15)+
  labs(fill="", x='', title = "Pre-supporters predicted by AI use") +
  theme(legend.position='top')+
  scale_fill_manual(values=c('#232D4B','#C8CBD2','#FDDA24','#F9DCBF','#E57200'))+
  coord_flip()+
  facet_wrap(~pre_supporter, ncol = 1) 

show code
dcOpinion_study2 %>% group_by(pre_supporter, age_buckets) %>% tally() %>% mutate(percent = n/sum(n)*100)  %>%
  ggplot(aes(x = .5, y=percent, fill = age_buckets))+
  geom_bar(stat = "identity", color='white') +
  theme_void(base_size=15)+
  labs(fill="", x='', title = "Pre-supporters predicted by age") +
  theme(legend.position='top')+
  scale_fill_manual(values=c('#232D4B','#C8CBD2','#FDDA24','#F9DCBF','#E57200'))+
  coord_flip()+
  facet_wrap(~pre_supporter, ncol = 1) 

show code
dcOpinion_study2 %>% group_by(pre_supporter, income_buckets) %>% tally() %>% mutate(percent = n/sum(n)*100)  %>%
  ggplot(aes(x = .5, y=percent, fill = income_buckets))+
  geom_bar(stat = "identity", color='white') +
  theme_void(base_size=15)+
  labs(fill="", x='', title = "Pre-supporters predicted by income") +
  theme(legend.position='top')+
  scale_fill_manual(values=c('#232D4B','#C8CBD2','#FDDA24','#F9DCBF','#E57200'))+
  coord_flip()+
  facet_wrap(~pre_supporter, ncol = 1) 

ai use

show code
dcOpinion_study2 = dcOpinion_study2 |> 
  mutate(predicted_supporter = ifelse(age_buckets !='18-29' & poli_id =='Republican' & income_buckets =='middle income' & dataCenterDensity_binned =='1+' & ai_use =='Daily', 1, 0),
         Republican = ifelse(poli_id =='Republican', 1, 0),
         middle_income = ifelse(income_buckets =='middle income', 1, 0),
         dailyUsers = ifelse(ai_use =='Daily', 1, 0),
         thirtyPlus = ifelse(age_buckets !='18-29', 1, 0))


supportPlot_dailyAIusers = 
  dcOpinion_study2 %>% filter(dailyUsers ==1) %>% 
  group_by(pre_support) %>%  
  tally() %>% mutate(percent = n/sum(n)*100) %>% 
  ggplot(aes(x=pre_support, y=percent, fill=as.factor(pre_support))) +
  geom_bar(stat='identity')+
  theme_classic() +
  theme(legend.position='none')+
  coord_flip() +
  ylim(c(0,60))+
  scale_fill_manual(values=rev(c('#232D4B','#C8CBD2','#FDDA24','#F9DCBF','#E57200')))

supportPlot_nondailyAIusers = 
  dcOpinion_study2 %>% filter(dailyUsers ==0) %>% 
  group_by(pre_support) %>%  
  tally() %>% mutate(percent = n/sum(n)*100) %>% 
  ggplot(aes(x=pre_support, y=percent, fill=as.factor(pre_support))) +
  geom_bar(stat='identity')+
  theme_classic() +
  theme(legend.position='none')+
  coord_flip() +
  ylim(c(0,60))+
  scale_fill_manual(values=rev(c('#232D4B','#C8CBD2','#FDDA24','#F9DCBF','#E57200')))

#ggsave(supportPlot_dailyAIusers, filename='study 2/supportPlot_dailyAIusers.png', dpi = 500, width=4, height = 4)
#ggsave(supportPlot_nondailyAIusers, filename='study 2/supportPlot_nondailyAIusers.png', dpi = 500, width=4, height = 4)

library('marginaleffects')

Attaching package: 'marginaleffects'
The following object is masked from 'package:lme4':

    refit
show code
logit_mod <- glm(post_supporter ~ Republican + dataCenterDensity_binned + dailyUsers + taxes,
                 data = dcOpinion_study2, family = binomial)
summary(logit_mod)

Call:
glm(formula = post_supporter ~ Republican + dataCenterDensity_binned + 
    dailyUsers + taxes, family = binomial, data = dcOpinion_study2)

Coefficients:
                           Estimate Std. Error z value Pr(>|z|)    
(Intercept)                -1.61420    0.09281 -17.393  < 2e-16 ***
Republican                  0.73396    0.10738   6.835 8.21e-12 ***
dataCenterDensity_binned1+  0.72878    0.11364   6.413 1.43e-10 ***
dailyUsers                  0.85783    0.09973   8.601  < 2e-16 ***
taxes                       0.62815    0.11143   5.637 1.73e-08 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 2584.5  on 1990  degrees of freedom
Residual deviance: 2375.7  on 1986  degrees of freedom
AIC: 2385.7

Number of Fisher Scoring iterations: 4

Rendering an image of a ‘supporter’

show code
dcOpinion_study2 %>% group_by(predicted_supporter, support) %>% tally() %>% mutate(percent = n/sum(n)*100) %>% mutate(support = fct_rev(factor(support))) %>% 
  ggplot(aes(x = .5, y=percent, fill = support))+
  geom_bar(stat = "identity", color='white') +
  theme_void(base_size=15)+
  labs(fill="", x='', title='Support amongst those that are 30+, Republican, Middle Income earners, have a data center near them, and use AI daily') +
  theme(legend.position='top')+
  scale_fill_manual(values=c('#232D4B','#C8CBD2','#FDDA24','#F9DCBF','#E57200'))+
  coord_flip()+
  facet_wrap(~predicted_supporter, ncol = 1)

show code
nice_table(tidy(lm(data=dcOpinion_study2, post_supporter ~ Republican + dataCenterDensity_binned + dailyUsers + taxes)))

Term

estimate

std.error

statistic

p

(Intercept)

0.15

0.02

8.91

< .001***

Republican

0.16

0.02

7.01

< .001***

dataCenterDensity_binned1+

0.16

0.02

6.56

< .001***

dailyUsers

0.18

0.02

8.84

< .001***

taxes

0.13

0.02

5.70

< .001***

show code
nice_table(tidy(lm(data=dcOpinion_study2, pre_supporter ~ dataCenterDensity_binned)))

Term

estimate

std.error

statistic

p

(Intercept)

1.19

dataCenterDensity_binned1+

0.19

show code
dcOpinion_study2 |> mutate(pre_supporter = as.numeric(pre_supporter)-1) |> filter(dailyUsers == 0) |> summarise(mean = mean(pre_supporter, na.rm=TRUE), n = n())
# A tibble: 1 × 2
   mean     n
  <dbl> <int>
1 0.125  1025
show code
dcOpinion_study2 |> filter(Republican == 1 & dataCenterDensity_binned == "1+" & dailyUsers ==1) |> summarise(mean = mean(post_supporter, na.rm=TRUE), n = n())
# A tibble: 1 × 2
   mean     n
  <dbl> <int>
1 0.774    84
show code
dcOpinion_study2 |> filter(Republican == 0 & dataCenterDensity_binned == "None" & dailyUsers ==0 & taxes == 0) |> summarise(mean = mean(post_supporter, na.rm=TRUE))
# A tibble: 1 × 1
   mean
  <dbl>
1 0.154
show code
dcOpinion_study2 |> filter(condition == 'control') |> summarise(mean = mean(post_supporter, na.rm=TRUE))
# A tibble: 1 × 1
   mean
  <dbl>
1 0.196
show code
dcOpinion_study2 |> filter(condition == 'taxes') |> summarise(mean = mean(post_supporter, na.rm=TRUE))
# A tibble: 1 × 1
   mean
  <dbl>
1 0.454
show code
supporter_model = data.frame(tidy(lm(data=dcOpinion_study2, post_supporter ~ Republican + dataCenterDensity_binned + dailyUsers + taxes))) |> 
  mutate(term = factor(term, levels=c('(Intercept)', 'Republican', 'dataCenterDensity_binned1+', 'dailyUsers', 'taxes'), labels=c('Baseline', 'Republican', 'Near a data center','Daily AI user', 'Offered personal payout')),
         supportBegin = NA,
         supportIncrease = round(estimate*100, 1),
         supportYield = NA)

runningYield = supporter_model$supportIncrease[1]
 
for (i in 1:5) {
  supporter_model$supportYield[i] = runningYield;
  supporter_model$supportBegin[i] = runningYield - supporter_model$supportIncrease[i];
  runningYield = runningYield + supporter_model$supportIncrease[i+1];
}



#   scale_color_manual(values=c('#c8cbd2','#009fdf','#e57200','#62bb46','#ef3f6b'))+
supporterPredictor_plot = 
  ggplot(supporter_model, aes(y=fct_rev(term))) +
  geom_segment(aes(x=0, xend=supportYield, yend=term), color='#7c8295', linewidth=10)+
  geom_segment(aes(x= supportBegin, xend = supportYield, yend= term), color='white',linewidth=10)+
  geom_segment(aes(x= supportYield, xend=100, yend=term), color='#3d4661',linewidth=10)+
  theme_classic()+
  theme(legend.position='none')+
    theme(
    plot.background = element_rect(fill = "#232d4b"), 
    panel.background = element_rect(fill = "#232d4b", colour="#232d4b"),
    axis.line.x = element_line(color = "white"),
    axis.ticks = element_line(color='white'))+
    xlim(c(0,100))

# ggsave(supporterPredictor_plot, filename='study 2/supporterPredictor_plot.png', dpi = 500, width=6, height = 3.5)