Commit 67fc65e4 authored by linushof's avatar linushof
Browse files

Housekeeping

parent b9608d50
# parameters
parameters <- c("alpha",
"gamma",
"delta",
"rho")
n_chains <- 4
# prepare data for JAGS
## select strategy-parameter combination
choices_MCMC <- choices %>%
filter(strategy == "piecewise" & boundary == "relative" & s == 1-.9, a == 7) %>%
mutate(choice_A = case_when(choice == "A" ~ 1,
choice == "B" ~ 0),
i = row_number(),
a_p2 = 1-a_p1,
b_o1 = b,
b_p1 = b_p,
b_o2 = 0,
b_p2 = 0) %>%
select(strategy:rare, a_p1, a_o1, a_p2, a_o2, a_ev, b_p1, b_o1, b_p2, b_o2, choice_A, i)
data = list(
resp = choices_MCMC$choice_A,
x_A = choices_MCMC$a_o2, # higher risky outcome
y_A = choices_MCMC$a_o1, # lower risky outcome
x_B = choices_MCMC$b_o1, # safe outcome
y_B = choices_MCMC$b_o2, # 0
px_A = choices_MCMC$a_p2, # probability higher risky outcome
py_A = choices_MCMC$a_p1, # probability lower risky outcome
px_B = choices_MCMC$b_p1, # probability safe outcome (1)
py_B = choices_MCMC$b_p2, # 0
min_i = min(choices_MCMC$i),
max_i = max(choices_MCMC$i)
)
# MCMC sampling
samples <- jags.parallel(data,
parameters,
model.file = "JAGS/cpt_trial_level.txt",
inits = NULL,
n.chains = n_chains,
n.iter = 10000,
n.burnin = 5000,
n.thin = 1,
n.cluster = n_chains,
jags.seed = 888)
# MCMC diagnostics
samples$BUGSoutput$summary
mcmcplots::mcmcplot(samples)
# NOTE: Simulation of sampling data with comprehensive strategy
The simulation was first run for boundary values a = {15, 20, 25, 30, 35}, which caused the sampling process to stop early, indicating too small boundaries. Further analysis indicated that this scaling issue may have masked the effect of the parameter a on decision quality and may have produced an artifical interaction between the a and s (switching probability) parameter. I.e., decreasing values for s cause larger samples that are consecutively drawn from a given prospect. For absolute boundaries, this may cause the prospect attended first to reach the boundary without drawing a single sample from the other prospect. For relative boundaries, somewhat similarily, this may cause the comparisons of sums over increasingly unequal sample sizes immediately after switching between prospects.
The simulation was thus rerun for boundary values a = {40, 45, 50, 55, 60, 65, 70, 75, 80}. Because a very large memory space that is required by the simulation, the rerun was split for the rows 1 to 122 in the set of parameter combinations and the rows 123 to 180, respectively.
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