Commit b9608d50 authored by linushof's avatar linushof
Browse files

Add simple data preprocessing pipeline

parent 0eb71884
......@@ -38,8 +38,6 @@ choices_piecewise <- sim_piecewise %>%
mutate(strategy = "piecewise",
s = 1-(s+.5)) %>% # to interpret parameter s as switching probability
select(strategy, s:gamble, rare, a_p1:ev_ratio, agent, n_sample, n_a, a_p1_exp, a_p2_exp, a_ev_exp, b_ev_exp, choice, A_sum, B_sum, diff)
write_csv(choices_piecewise, "data/choices/choices_piecewise.csv")
# comprehensive strategy
......@@ -53,7 +51,7 @@ if(hash_comprehensive != "6e62f9cbeebbabcebae86188d72426ab"){
## transform data to obtain trial summaries
choices_comprehensive <- sim_comprehensive %>%
group_by(s, sigma, boundary, a, gamble, agent) %>%
group_by(s, boundary, a, gamble, agent) %>%
mutate(n_sample = n(),
n_a = n_sample - sum(is.na(A)),
a_p2_exp = round(sum(if_else(A == a_o2, 1, 0), na.rm = TRUE)/n_a, 2),
......@@ -68,3 +66,8 @@ choices_comprehensive <- sim_comprehensive %>%
mutate(strategy = "comprehensive",
s = 1-(s+.5)) %>%
select(strategy, s:gamble, rare, a_p1:ev_ratio, agent, n_sample, n_a, a_p1_exp, a_p2_exp, a_ev_exp, b_ev_exp, choice, A_sum, B_sum, diff)
# all choice data
## required: 2 strategies x 60 gambles x 100 subjects x 100 parameter combinations = 1.200.000 choices
choices <- bind_rows(choices_piecewise, choices_comprehensive)
write_csv(choices, "data/choices/choices.csv")
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment