Setup

library(magrittr); library(tidyverse); library(here) 
theme_set(theme_minimal())

Read data.

d_path <- "data/02_tidy_data/"
d <- read_csv(here(d_path, "goal_actions_tidy_pilotB.csv"))
d %<>% 
  mutate(hypothesis_type = factor(hypothesis_type) %>% fct_rev(),
         slider_response_collapsed = factor(slider_response_collapsed) %>% fct_rev(),
         action_response_collapsed = factor(action_response_collapsed) %>% fct_rev()) 

Table of comments

d %>% 
  select(id, age, condition, about) %>% 
  unique() %>% 
  arrange(condition) %>% 
  knitr::kable()
id age condition about
4 43 learning I am not sure what the task was about, but perhaps it was to see how likely it was that I would believe the brightest button would make the music play.
8 42 learning analyzing humans
9 41 learning I have no idea.
10 34 learning figuring out how a toy works
12 24 learning how to get a toy to play music
14 33 learning To see how many people would pick each choice.
16 30 learning To better understand our decisions when interacting with a new device.
17 44 learning No idea
18 45 learning Not sure
21 40 learning no clue
24 33 learning HUMAN PERCEPTION
25 34 learning To see what peoples instincts told them about how to work something simple.
30 45 learning reasoning and deduction
31 25 learning A childrens toy.
32 31 learning getting the right combo to make a toy work
33 23 learning To see how people made decisions when given a scenario
34 38 learning Problem solving and logic.
35 39 learning Trying to see how quickly children can learn to play the music.
37 35 learning no idea
38 21 learning design
40 38 learning decision makin
45 24 learning i’m not sure
46 35 learning figuring out how toys work
50 20 learning Learning about which choice makes something work.
52 32 learning Seeing how people make choices
53 21 learning Guessing how the toy works
54 37 learning not sure
1 32 performance idk
2 24 performance Looking at what and how people assume things
3 31 performance no clue
5 19 performance Decision making
6 36 performance To see if people could figure out the logic behind making a children’s toy.
7 33 performance how people make the toy work
11 38 performance Baby toys
13 39 performance perceptions
15 50 performance not really sure ?
19 31 performance Decision making
20 22 performance Seeing what people’s first reactions are to something
22 29 performance How we process information and find solution for a problem
23 37 performance intution
26 33 performance To study how colors affect choices.
27 18 performance I have no idea
28 41 performance how an adult conceptualizes a child’s problem solving skills?
29 54 performance to see how we think and ratinalize
36 26 performance not sure
39 24 performance Determining how something works
41 28 performance To assess perceptions
42 35 performance I have no idea
43 25 performance To see if people can figure how the toy works
44 42 performance how people get things to work?
47 28 performance not sure
48 25 performance It was about perceptions.
49 24 performance which button makes the music play!
51 56 performance no idea
55 36 performance Which button(s) people would choose.

Prior and posterior beliefs

Now summarise and plot.

d %>% 
  group_by(hypothesis_type, condition, hypothesis) %>% 
  summarise(m = mean(slider_value_normalized)) %>% 
  ggplot(aes(x = hypothesis, y = m, fill = condition)) +
  geom_bar(stat = "identity", width = 0.4, position = position_dodge()) +
  geom_hline(yintercept = 0.3, linetype = "dashed") +
  lims(y = c(0,1)) +
  scale_fill_grey() +
  ggthemes::theme_few() +
  theme(legend.position = "top") +
  facet_wrap(~hypothesis_type)

Same plot but collapsing across the single button hypotheses.

d %>% 
  group_by(hypothesis_type, condition, slider_response_collapsed) %>% 
  summarise(m = mean(slider_value_norm_2)) %>% 
  ggplot(aes(x = slider_response_collapsed, y = m, fill = condition)) +
  geom_bar(stat = "identity", width = 0.4, position = position_dodge()) +
  geom_hline(yintercept = 0.3, linetype = "dashed") +
  lims(y = c(0,1)) +
  scale_fill_grey() +
  ggthemes::theme_few() +
  labs(x = "Hypothesis", y = "Beliefs") +
  theme(legend.position = "top") +
  facet_wrap(~hypothesis_type)

Action responses

Plot counts of different action responses for the learning vs. performance goal conditions.

d %>% 
  select(condition, action_response, id) %>% 
  unique() %>% 
  group_by(action_response, condition) %>% 
  count() %>% 
  group_by(condition) %>% 
  mutate(prop = n / sum(n)) %>% 
  ggplot(aes(x = action_response, y = prop, fill = condition)) +
  geom_bar(stat = "identity", width = 0.4, position = position_dodge()) +
  lims(y = c(0,1)) +
  scale_fill_grey()

Plot the distribution using the collapsed action response variable.

d %>% 
  select(condition, action_response_collapsed, id) %>% 
  unique() %>% 
  group_by(action_response_collapsed, condition) %>% 
  count() %>% 
  group_by(condition) %>% 
  mutate(prop = n / sum(n)) %>% 
  ggplot(aes(x = action_response_collapsed, y = prop, fill = condition)) +
  geom_bar(stat = "identity", width = 0.4, position = position_dodge()) +
  lims(y = c(0,1)) +
  labs(y = "Prop. Participants", x = "Action Selected") +
  scale_fill_grey()

Make a table of the raw counts.

d %>% 
  select(condition, action_response_collapsed, id) %>% 
  unique() %>% 
  group_by(action_response_collapsed, condition) %>% 
  count() %>% 
  knitr::kable()
action_response_collapsed condition n
single_button learning 13
single_button performance 17
both_buttons learning 14
both_buttons performance 11

Experiment time distributions

Plot the distribution of overall time on the experiment across conditions.

d %>% 
  select(id, experiment_time, condition) %>% 
  unique() %>% 
  ggplot(aes(x = condition, y = experiment_time / 60)) +
  geom_boxplot(width = 0.3) +
  lims(y = c(0,max(d$experiment_time / 60))) +
  labs(y = "Time (min)")

Make the same plot, but for the time spent on the action decision.

d %>% 
  select(id, action_trial_time, condition) %>% 
  unique() %>% 
  ggplot(aes(x = action_trial_time)) +
  geom_histogram() + 
  facet_wrap(~condition)

Plot belief change

d %>% 
  ggplot(aes(x = hypothesis_type, y = slider_value_norm_2, color = condition)) +
  geom_line(aes(group = id), size = 1) + 
  geom_jitter(width = 0.03, size = 2) +
  facet_wrap(~slider_response_collapsed) +
  lims(y = c(0,1)) +
  langcog::scale_color_solarized() +
  ggthemes::theme_few() +
  theme(legend.position = "top")

Now as a function of which action participants chose

d %>% 
  ggplot(aes(x = hypothesis_type, y = slider_value_norm_2, 
             color = condition,
             linetype = action_response_collapsed)) +
  geom_line(aes(group = id), size = 0.5) + 
  geom_jitter(width = 0, size = 2) +
  facet_grid(~slider_response_collapsed) +
  lims(y = c(0,1)) +
  langcog::scale_color_solarized() +
  ggthemes::theme_few() +
  theme(legend.position = "top")