Chapter 11 Main effects

This chapter explores the first hypothesis in the pre-registration of the experiment: Individuals that receive an unfavorable outcome express lower fairness perception than individuals that receive a favorable outcome. The estimation of the Average Marginal Component Effects is based on the function developed by Mikael P. Johannesson, and available on Github.

if(!require("broom")){install.packages("broom");  library(broom)}
if(!require("haven")){install.packages("haven");  library(haven)}
if(!require("here")){install.packages("here");  library(here)}
if(!require("knitr")){install.packages("knitr");  library(knitr)}
if(!require("kableExtra")){install.packages("kableExtra");  library(kableExtra)}
if(!require("naniar")){install.packages("naniar");  library(naniar)}
if(!require("tidyverse")){install.packages("tidyverse");  library(tidyverse)}
# The analysis uses custom functions included in the compendium. Install the included pkg with `devtools::install()` or just install from github with:
if (!require(wiggle)) {  devtools::install_github("mikajoh/wiggle")}

set.seed(2016)
## Utils. 
source("goodloser-utils.R")

d <- read_sav("Data/Goodloser-exp2.sav")

knitr::opts_chunk$set(echo = TRUE, knitr.kable.NA = "", cache = FALSE, warning = FALSE)

11.1 Prepare data

d <- d %>%
  mutate(treatment = lvls_reorder(treatment, c(3, 2, 1, 4, 5)) 
  )

11.2 Fairness

res_main <-  lm(fairness ~ treatment, data = d) 
res_main <- broom::tidy(res_main)

labels <- data.frame(
  term = c(
    "treatmentLamenting politician",
    "treatmentGeneral Prime",
    "treatmentSpecific prime",
    "treatmentWinner"
    
  ),
  label = c( "Lamenting politician",
             "General prime",
             "Specific prime",
             "Winner")
)
#Figure
fig <-   res_main %>%
  filter(term != "(Intercept)") %>% 
  left_join(labels, by = "term") %>% 
  
  ggplot(aes(x = estimate, y = label,
             xmin = estimate - (2 * std.error),
             xmax = estimate + (2 * std.error))) +
   geom_errorbarh(height = 0) +
  geom_point() +
  geom_vline(aes(xintercept = 0), linetype = "dotted") +
  scale_x_continuous(limits = c(-1, 1),
                     breaks = round(seq(-1, 1, .25), 2),
                     expand = c(0, 0)) +
  labs(x = "Change in fairness perception",
       y = "Decision process attributes") +
  theme_bw() +
  theme(plot.margin = unit(c(2, 2, 2, 2), "mm"), axis.text.x=element_text(size=rel(0.7))) +
  theme(panel.spacing = unit(0.5, "lines"))
fig

ggsave(
  here("output", "novig", "figs", "pngs", "exp2-fairness-mainfig.png"),
  plot = fig,
  width = 5.5, height = 2.75
)

ggsave(
  here("output", "novig", "figs", "pdfs", "exp2-fairness-mainfig.pdf"),
  plot = fig,
  width = 5.5, height = 2.75
)


#Table
table <- res_main %>% 
  select(term, estimate, std.error, statistic, p.value) %>% 
  mutate(term = case_when( term == "(Intercept)" ~ "Not shown",
                    term == "treatmentLamenting politician" ~ "Lamenting politician",
                   term == "treatmentGeneral Prime" ~ "General prime", 
                   term == "treatmentSpecific prime" ~ "Specific prime",
                   term == "treatmentWinner" ~ "Winner"))

kable(table, booktabs = TRUE, caption = "Treatment effects on fairness perceptions of decision, Study 2 -- Norwegian vignette", col.names = linebreak(c("Treatment value", "Estimate", "Std. Error", "t-statistic", "p value"))) %>% 
  kable_styling(bootstrap_options = c("striped", "hover", "responsive")) 
(#tab:204_post_fairness)Treatment effects on fairness perceptions of decision, Study 2 – Norwegian vignette
Treatment value Estimate Std. Error t-statistic p value
Not shown 3.7433155 0.0545529 68.6181124 0.0000000
Lamenting politician 0.0623988 0.0784608 0.7952857 0.4266397
General prime 0.3455734 0.0738202 4.6812870 0.0000033
Specific prime 0.2520549 0.0745149 3.3826087 0.0007464
Winner 0.3004003 0.0775699 3.8726427 0.0001148

11.3 Willingnes to accept

res_main <-  lm(accept ~ treatment, data = d) 
res_main <- broom::tidy(res_main)

labels <- data.frame(
  term = c(
    "treatmentLamenting politician",
    "treatmentGeneral Prime",
    "treatmentSpecific prime",
    "treatmentWinner"
    
  ),
  label = c( "Lamenting politician",
             "General prime",
             "Specific prime",
             "Winner")
)
#Figure
fig <-   res_main %>%
  filter(term != "(Intercept)") %>% 
  left_join(labels, by = "term") %>% 
  
  ggplot(aes(x = estimate, y = label,
             xmin = estimate - (2 * std.error),
             xmax = estimate + (2 * std.error))) +
   geom_errorbarh(height = 0) +
  geom_point() +
  geom_vline(aes(xintercept = 0), linetype = "dotted") +
  scale_x_continuous(limits = c(-1, 1),
                     breaks = round(seq(-1, 1, .25), 2),
                     expand = c(0, 0)) +
  labs(x = "Change in willingness to accept outcome",
       y = "Decision process attributes") +
  theme_bw() +
  theme(plot.margin = unit(c(2, 2, 2, 2), "mm"), axis.text.x=element_text(size=rel(0.7))) +
  theme(panel.spacing = unit(0.5, "lines"))
fig

ggsave(
  here("output", "novig", "figs", "pngs", "exp2-accept-mainfig.png"),
  plot = fig,
  width = 5.5, height = 2.75
)

ggsave(
  here("output", "novig", "figs", "pdfs", "exp2-accept-mainfig.pdf"),
  plot = fig,
  width = 5.5, height = 2.75
)


#Table
table <- res_main %>% 
  select(term, estimate, std.error, statistic, p.value) %>% 
  mutate(term = case_when( term == "(Intercept)" ~ "Not shown",
                    term == "treatmentLamenting politician" ~ "Lamenting politician",
                   term == "treatmentGeneral Prime" ~ "General prime", 
                   term == "treatmentSpecific prime" ~ "Specific prime",
                   term == "treatmentWinner" ~ "Winner"))

kable(table, booktabs = TRUE, caption = "Treatment effects on willingness to accept decision, Study 2 -- Norwegian vignette", col.names = linebreak(c("Treatment value", "Estimate", "Std. Error", "t-statistic", "p value"))) %>% 
  kable_styling(bootstrap_options = c("striped", "hover", "responsive")) 
(#tab:204_post_accept)Treatment effects on willingness to accept decision, Study 2 – Norwegian vignette
Treatment value Estimate Std. Error t-statistic p value
Not shown 3.5240964 0.0704614 50.0145997 0.0000000
Lamenting politician 0.0668127 0.1015700 0.6577994 0.5108375
General prime 0.2945311 0.0948936 3.1038044 0.0019710
Specific prime 0.1859036 0.0953184 1.9503444 0.0514494
Winner 0.6830042 0.0992042 6.8848320 0.0000000

11.4 Trust in politician

res_main <-  lm(trust ~ treatment, data = d) 
res_main <- broom::tidy(res_main)

labels <- data.frame(
  term = c(
    "treatmentLamenting politician",
    "treatmentGeneral Prime",
    "treatmentSpecific prime",
    "treatmentWinner"
    
  ),
  label = c( "Lamenting politician",
             "General prime",
             "Specific prime",
             "Winner")
)
#Figure
fig <-   res_main %>%
  filter(term != "(Intercept)") %>% 
  left_join(labels, by = "term") %>% 
  
  ggplot(aes(x = estimate, y = label,
             xmin = estimate - (2 * std.error),
             xmax = estimate + (2 * std.error))) +
   geom_errorbarh(height = 0) +
  geom_point() +
  geom_vline(aes(xintercept = 0), linetype = "dotted") +
  scale_x_continuous(limits = c(-1, 1),
                     breaks = round(seq(-1, 1, .25), 2),
                     expand = c(0, 0)) +
  labs(x = "Change in willingness to accept outcome",
       y = "Decision process attributes") +
  theme_bw() +
  theme(plot.margin = unit(c(2, 2, 2, 2), "mm"), axis.text.x=element_text(size=rel(0.7))) +
  theme(panel.spacing = unit(0.5, "lines"))
fig

ggsave(
  here("output", "novig", "figs", "pngs", "exp2-trust-mainfig.png"),
  plot = fig,
  width = 5.5, height = 2.75
)

ggsave(
  here("output", "novig", "figs", "pdfs", "exp2-trust-mainfig.pdf"),
  plot = fig,
  width = 5.5, height = 2.75
)


#Table
table <- res_main %>% 
  select(term, estimate, std.error, statistic, p.value) %>% 
  mutate(term = case_when( term == "(Intercept)" ~ "Not shown",
                    term == "treatmentLamenting politician" ~ "Lamenting politician",
                   term == "treatmentGeneral Prime" ~ "General prime", 
                   term == "treatmentSpecific prime" ~ "Specific prime",
                   term == "treatmentWinner" ~ "Winner"))

kable(table, booktabs = TRUE, caption = "Treatment effects on trust in politician, Study 2 -- Norwegian vignette", col.names = linebreak(c("Treatment value", "Estimate", "Std. Error", "t-statistic", "p value"))) %>% 
  kable_styling(bootstrap_options = c("striped", "hover", "responsive")) 
(#tab:204_post_trust)Treatment effects on trust in politician, Study 2 – Norwegian vignette
Treatment value Estimate Std. Error t-statistic p value
Not shown 3.2303371 0.0592765 54.4960757 0.0000000
Lamenting politician -0.0210348 0.0845576 -0.2487626 0.8035983
General prime 0.1138490 0.0801419 1.4205922 0.1557638
Specific prime 0.1458534 0.0805729 1.8102048 0.0705802
Winner 0.4679869 0.0837125 5.5904083 0.0000000