Commit 587f28d6 authored by linushof's avatar linushof
Browse files

Generate 2-outcome gambles

parent 1c2d6afc
source("./R/functions/fun_gambles.R") # call function for generating gambles
# call function for generating gambles
source("R/fun_generate_gambles.R")
# generate 10,000 safe-risky gambles
set.seed(3211)
set.seed(349)
sr_gambles <- generate_gambles(n = 10000, safe = TRUE, lower = 0, upper = 20)
sr_gambles <- sr_gambles %>% mutate(rare = case_when(a_p1 >= .2 & a_p1 <= .8 ~ "None",
a_p1 < .2 ~ "Unattractive",
a_p1 > .8 ~ "Attractive"))
write_csv(sr_gambles, "./R/data/gambles/sr_gambles.csv")
sr_gambles <- sr_gambles %>% mutate(rare = case_when(a_p1 >= .2 & a_p1 <= .8 ~ "none",
a_p1 < .2 ~ "unattractive", # a_o1 is the smaller outcome
a_p1 > .8 ~ "attractive"))
write_csv(sr_gambles, "data/gambles/sr_gambles.csv")
# select subset of 60 safe-risky gambles
## Unfortunately, no RNG-seed was set before drawning the subset of gambles.
## Load the subset via read_csv("./R/data/gambles/sr_subset.csv")
# select subset of 60 gambles
# stratified sampling of 20 gambles with no/attractive/unattractive rare event
sr_subset <- tibble()
set.seed(735)
for(i in unique(sr_gambles$rare)) {
type <- sr_gambles %>% filter(rare == i)
smpl <- sample(seq_len(nrow(type)), size = 20)
type <- sr_gambles %>% filter(rare == i) # type of rare event
smpl <- sample(seq_len(nrow(type)), size = 20) # random sample of 20 rows/gambles
sr_subset <- bind_rows(sr_subset, type[smpl, ])
}
write_csv(sr_subset, "./R/data/gambles/sr_subset.csv")
write_csv(sr_subset, "data/gambles/sr_subset.csv")
This diff is collapsed.
a_p1,a_o1,a_o2,a_ev,b_p,b,b_ev,ev_diff,ev_ratio,rare
0.38,1.19,9.56,6.38,1,6.93,6.93,-0.55,0.92,None
0.73,1.42,12.37,4.38,1,9.25,9.25,-4.87,0.47,None
0.55,0.07,14.6,6.61,1,13.73,13.73,-7.12,0.48,None
0.22,5.84,9.93,9.03,1,6.96,6.96,2.07,1.3,None
0.57,6.3,13.23,9.28,1,8.9,8.9,0.38,1.04,None
0.56,4.99,9.56,7,1,7.7,7.7,-0.7,0.91,None
0.67,2.91,15.78,7.16,1,11.07,11.07,-3.91,0.65,None
0.67,1.96,13.12,5.64,1,7.56,7.56,-1.92,0.75,None
0.37,3.55,12.4,9.13,1,10.05,10.05,-0.92,0.91,None
0.52,3.42,18.6,10.71,1,18.32,18.32,-7.61,0.58,None
0.47,3.51,13.31,8.7,1,10.86,10.86,-2.16,0.8,None
0.78,5.14,12.25,6.7,1,11.87,11.87,-5.17,0.56,None
0.43,6.1,17.8,12.77,1,7.6,7.6,5.17,1.68,None
0.37,5.03,16.83,12.46,1,11.47,11.47,0.99,1.09,None
0.68,0.85,12.03,4.43,1,11.26,11.26,-6.83,0.39,None
0.41,9.6,16.81,13.85,1,10.79,10.79,3.06,1.28,None
0.67,0.47,19.26,6.67,1,6.87,6.87,-0.2,0.97,None
0.23,5.33,19.9,16.55,1,16.89,16.89,-0.34,0.98,None
0.34,0.61,13.56,9.16,1,9.02,9.02,0.14,1.02,None
0.7,13.41,17.37,14.6,1,13.64,13.64,0.96,1.07,None
0.17,4.37,17.66,15.4,1,15.96,15.96,-0.56,0.96,Unattractive
0.06,2.83,13.9,13.24,1,6.73,6.73,6.51,1.97,Unattractive
0.08,1.45,19.4,17.96,1,7.91,7.91,10.05,2.27,Unattractive
0.05,3.57,16.34,15.7,1,10.41,10.41,5.29,1.51,Unattractive
0.05,5.94,19.92,19.22,1,7.45,7.45,11.77,2.58,Unattractive
0.04,2.54,11.25,10.9,1,2.6,2.6,8.3,4.19,Unattractive
0.03,4.64,13.27,13.01,1,5.34,5.34,7.67,2.44,Unattractive
0.16,9.39,13.81,13.1,1,13.68,13.68,-0.58,0.96,Unattractive
0.09,0.98,10.66,9.79,1,1.37,1.37,8.42,7.15,Unattractive
0.1,3.95,7.22,6.89,1,4.84,4.84,2.05,1.42,Unattractive
0.1,10.85,19.62,18.74,1,15.49,15.49,3.25,1.21,Unattractive
0.14,4.76,15.53,14.02,1,6.84,6.84,7.18,2.05,Unattractive
0.14,0.99,16.97,14.73,1,12.96,12.96,1.77,1.14,Unattractive
0.16,10.44,12.3,12,1,10.66,10.66,1.34,1.13,Unattractive
0.04,10.27,18.48,18.15,1,16.19,16.19,1.96,1.12,Unattractive
0.05,15.12,17.58,17.46,1,15.64,15.64,1.82,1.12,Unattractive
0.02,7.07,13.63,13.5,1,8.55,8.55,4.95,1.58,Unattractive
0.19,8.66,18.6,16.71,1,17.91,17.91,-1.2,0.93,Unattractive
0.06,0.2,13.14,12.36,1,8.07,8.07,4.29,1.53,Unattractive
0.15,3.83,17.99,15.87,1,9.13,9.13,6.74,1.74,Unattractive
0.91,2.03,16.5,3.33,1,11.58,11.58,-8.25,0.29,Attractive
0.89,6.91,15.45,7.85,1,6.95,6.95,0.9,1.13,Attractive
0.93,5.98,16.19,6.69,1,10.85,10.85,-4.16,0.62,Attractive
0.84,12.39,18.63,13.39,1,18.03,18.03,-4.64,0.74,Attractive
0.9,6.2,15.54,7.13,1,10.32,10.32,-3.19,0.69,Attractive
0.86,12.15,17.92,12.96,1,14.31,14.31,-1.35,0.91,Attractive
0.96,2.89,15.75,3.4,1,13.98,13.98,-10.58,0.24,Attractive
0.96,2.04,5.76,2.19,1,3.36,3.36,-1.17,0.65,Attractive
0.82,16.26,19.55,16.85,1,18.56,18.56,-1.71,0.91,Attractive
0.89,0.3,17.69,2.21,1,13.14,13.14,-10.93,0.17,Attractive
0.89,7.13,12.79,7.75,1,9.58,9.58,-1.83,0.81,Attractive
0.88,13.89,19.5,14.56,1,16.45,16.45,-1.89,0.89,Attractive
0.96,0.53,11.95,0.99,1,11.61,11.61,-10.62,0.09,Attractive
0.83,0.55,15.88,3.16,1,6.07,6.07,-2.91,0.52,Attractive
0.81,6.34,18.01,8.56,1,8.94,8.94,-0.38,0.96,Attractive
0.96,1.15,17.37,1.8,1,9.64,9.64,-7.84,0.19,Attractive
0.84,0.79,17.29,3.43,1,2.75,2.75,0.68,1.25,Attractive
0.85,2.72,17.39,4.92,1,9.39,9.39,-4.47,0.52,Attractive
0.86,4.71,16.94,6.42,1,8.79,8.79,-2.37,0.73,Attractive
0.92,2.78,18.05,4,1,15.7,15.7,-11.7,0.25,Attractive
a_p1,a_o1,a_p2,a_o2,b_p1,b_o1,b_p2,b_o2,a_ev,b_ev,ev_diff,ev_ratio,rare
0.57,4.52,0.43,19.84,1,14.89,0,0,11.11,14.89,-3.78,0.75,none
0.53,8.83,0.47,18.38,1,18.27,0,0,13.32,18.27,-4.95,0.73,none
0.64,0.63,0.36,6.01,1,4.92,0,0,2.57,4.92,-2.35,0.52,none
0.47,2.11,0.53,19.78,1,8.37,0,0,11.48,8.37,3.11,1.37,none
0.67,5.15,0.33,13,1,9.81,0,0,7.74,9.81,-2.07,0.79,none
0.22,2.85,0.78,7.29,1,5.77,0,0,6.31,5.77,0.54,1.09,none
0.68,6.9,0.32,10.99,1,8.14,0,0,8.21,8.14,0.07,1.01,none
0.55,5.81,0.45,12.15,1,10.27,0,0,8.66,10.27,-1.61,0.84,none
0.34,9.69,0.66,17.73,1,11.15,0,0,15,11.15,3.85,1.35,none
0.57,3.86,0.43,8.75,1,8.63,0,0,5.96,8.63,-2.67,0.69,none
0.68,1.38,0.32,9.7,1,4.32,0,0,4.04,4.32,-0.28,0.94,none
0.8,3.71,0.2,5.88,1,5.06,0,0,4.14,5.06,-0.92,0.82,none
0.26,2.84,0.74,4.12,1,3,0,0,3.79,3,0.79,1.26,none
0.62,1.49,0.38,6.92,1,4.46,0,0,3.55,4.46,-0.91,0.8,none
0.43,7.26,0.57,17.05,1,7.42,0,0,12.84,7.42,5.42,1.73,none
0.26,4.16,0.74,16.41,1,4.87,0,0,13.22,4.87,8.35,2.71,none
0.66,1.39,0.34,18.99,1,9.02,0,0,7.37,9.02,-1.65,0.82,none
0.36,3.61,0.64,19.61,1,8.02,0,0,13.85,8.02,5.83,1.73,none
0.33,0.42,0.67,10,1,1.67,0,0,6.84,1.67,5.17,4.1,none
0.54,0.39,0.46,12.86,1,7.12,0,0,6.13,7.12,-0.99,0.86,none
0.92,3.03,0.08,14.41,1,7.05,0,0,3.94,7.05,-3.11,0.56,attractive
0.82,0.14,0.18,10.02,1,7.12,0,0,1.92,7.12,-5.2,0.27,attractive
0.96,0.77,0.04,5.43,1,3.31,0,0,0.96,3.31,-2.35,0.29,attractive
0.98,6.25,0.02,12.31,1,10.41,0,0,6.37,10.41,-4.04,0.61,attractive
0.94,1.52,0.06,13.89,1,8.46,0,0,2.26,8.46,-6.2,0.27,attractive
0.91,4.84,0.09,17.95,1,11.07,0,0,6.02,11.07,-5.05,0.54,attractive
0.83,1.73,0.17,14.55,1,10.95,0,0,3.91,10.95,-7.04,0.36,attractive
0.9,1.62,0.1,8.15,1,4.23,0,0,2.27,4.23,-1.96,0.54,attractive
0.95,5.06,0.05,17.86,1,5.82,0,0,5.7,5.82,-0.12,0.98,attractive
0.95,0.07,0.05,17.63,1,9.21,0,0,0.95,9.21,-8.26,0.1,attractive
0.91,3.73,0.09,16.78,1,11.74,0,0,4.9,11.74,-6.84,0.42,attractive
0.89,0.27,0.11,10.68,1,9.53,0,0,1.42,9.53,-8.11,0.15,attractive
0.88,7.1,0.12,12.67,1,12.14,0,0,7.77,12.14,-4.37,0.64,attractive
0.98,0.33,0.02,14.87,1,10.43,0,0,0.62,10.43,-9.81,0.06,attractive
0.84,10.44,0.16,12.13,1,10.51,0,0,10.71,10.51,0.2,1.02,attractive
0.86,2.47,0.14,12.86,1,8.95,0,0,3.92,8.95,-5.03,0.44,attractive
0.97,3.32,0.03,9.09,1,6.5,0,0,3.49,6.5,-3.01,0.54,attractive
0.87,4.85,0.13,19.3,1,10.16,0,0,6.73,10.16,-3.43,0.66,attractive
0.84,5.33,0.16,13.94,1,7.31,0,0,6.71,7.31,-0.6,0.92,attractive
0.82,9.86,0.18,11.9,1,11.17,0,0,10.23,11.17,-0.94,0.92,attractive
0.14,0.13,0.86,8.12,1,6.69,0,0,7,6.69,0.31,1.05,unattractive
0.16,9.93,0.84,14.74,1,10.56,0,0,13.97,10.56,3.41,1.32,unattractive
0.19,8.61,0.81,17.36,1,17.26,0,0,15.7,17.26,-1.56,0.91,unattractive
0.15,14.84,0.85,17.38,1,15.68,0,0,17,15.68,1.32,1.08,unattractive
0.08,3.93,0.92,18.77,1,7.2,0,0,17.58,7.2,10.38,2.44,unattractive
0.05,1.32,0.95,18.43,1,15.72,0,0,17.57,15.72,1.85,1.12,unattractive
0.07,4.85,0.93,10.96,1,10.59,0,0,10.53,10.59,-0.06,0.99,unattractive
0.05,1.53,0.95,18.68,1,17.32,0,0,17.82,17.32,0.5,1.03,unattractive
0.13,4.3,0.87,16.88,1,12.11,0,0,15.24,12.11,3.13,1.26,unattractive
0.04,7.38,0.96,15.77,1,12.08,0,0,15.43,12.08,3.35,1.28,unattractive
0.16,4.33,0.84,17.65,1,15.46,0,0,15.52,15.46,0.06,1,unattractive
0.18,9.01,0.82,15.03,1,13.84,0,0,13.95,13.84,0.11,1.01,unattractive
0.19,1.03,0.81,18.83,1,3.51,0,0,15.45,3.51,11.94,4.4,unattractive
0.01,1.61,0.99,19.86,1,14.87,0,0,19.68,14.87,4.81,1.32,unattractive
0.18,12.75,0.82,17.21,1,16.32,0,0,16.41,16.32,0.09,1.01,unattractive
0.07,3.75,0.93,13.43,1,11.15,0,0,12.75,11.15,1.6,1.14,unattractive
0.12,14.05,0.88,14.3,1,14.13,0,0,14.27,14.13,0.14,1.01,unattractive
0.03,3.18,0.97,9.16,1,3.97,0,0,8.98,3.97,5.01,2.26,unattractive
0.16,0.93,0.84,19.63,1,15.37,0,0,16.64,15.37,1.27,1.08,unattractive
0.13,6.2,0.87,8.78,1,7.33,0,0,8.44,7.33,1.11,1.15,unattractive
Supports Markdown
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