<- read_csv("all_apps_wide.csv") |>
d filter(participant._index_in_pages==6) #only those who finished
Risk preferences
Evidence from a MPL experiment
Load data
- We load the data from the MPL experiment
- Assign the tibble to
d
- Assign the tibble to
- Select only the “relevant” columns
- Assign it to
d.sel
- Assign it to
<-
d.sel |>
d select(participant.code, session.code, paste("prolific_MPL.1.player.HL_", 1:10, sep = ""))
Session descriptives
- Number of participants
|>
d.sel distinct(participant.code) |>
nrow() |>
kable(caption="Number of participants", col.names = NULL) |>
kable_styling()
12 |
- Number of sessions
|>
d.sel distinct(session.code) |>
nrow() |>
kable(caption = "Number of sessions", col.names = NULL) |>
kable_styling()
2 |
Choices
Frequency of A choices by prospect
- We compute the frequency of choices by prospect
<-
dt |>
d.sel select(participant.code, prolific_MPL.1.player.HL_1:prolific_MPL.1.player.HL_10) |>
pivot_longer(names_to = "Prospect", values_to = "Choice", 2:11) |>
mutate(Prospect=substr(Prospect,26,27)) |>
mutate(Prospect=as.integer(Prospect)) |>
mutate(Choice = ifelse(Choice == 1, "A", "B")) |>
group_by(Prospect) |>
count(Choice) |>
mutate(Frequency = round(prop.table(n),3))
|>
dt select(Prospect,Choice, Frequency) |>
pivot_wider(names_from = Choice, values_from = Frequency) |>
kable(caption = "Relative frequency of choices by prospect") |>
kable_styling(font_size = 12, full_width = FALSE, bootstrap_options = c("striped", "hover", "condensed"))
Prospect | A | B |
---|---|---|
1 | 0.750 | 0.250 |
2 | 0.917 | 0.083 |
3 | 0.833 | 0.167 |
4 | 0.583 | 0.417 |
5 | 0.333 | 0.667 |
6 | 0.500 | 0.500 |
7 | 0.250 | 0.750 |
8 | 0.167 | 0.833 |
9 | 0.083 | 0.917 |
10 | 0.167 | 0.833 |
|>
dt ggplot(aes(x=Prospect, y=Frequency, fill=Choice)) +
geom_col() +
scale_fill_manual(values=c("grey", "black")) +
labs(x="Prospect", y="Frequency", fill="Choice") +
scale_x_continuous(breaks = c(1,2,3,4,5,6,7,8,9,10)) +
theme_bw() +
labs(
title = "Frequency of choices by prospect",
y = "Relative frequency",
x = "Prospect",
caption = "Source: MPL experiment",
color = "Odd"
+
) theme(
legend.position = "bottom",
axis.text = element_text(size = 8),
axis.title = element_text(size = 14, face = "bold"),
legend.background = element_rect(
fill = "grey",
linewidth = 2, linetype = "solid"
) )