Last active
July 6, 2023 15:55
-
-
Save itsdfish/0ba5aaf1681f2d8b52579773d830c103 to your computer and use it in GitHub Desktop.
Bijector Error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Turing | |
using SequentialSamplingModels | |
using Distributions | |
choice1,rt1 = rand(LBA(ν=[3.0, 2.0], A=0.8, k=0.2, τ=0.3), 25) | |
choice2,rt2 = rand(LBA(ν=[1.0, 1.5], A=0.7, k=0.2, τ=0.3), 25) | |
data = (choice=[choice1;choice2],rt=[rt1;rt1]) | |
condition = repeat([1,0], inner=25) | |
@model function model_lba(data; condition, min_rt=minimum(data.rt)) | |
# Parameters | |
n = length(data.rt) | |
# Priors for auxiliary parameters | |
A ~ truncated(Normal(0.8, 0.4), 0.0, Inf) | |
k ~ truncated(Normal(0.2, 0.2), 0.0, Inf) | |
tau ~ Uniform(0.0, min_rt) | |
# Priors over coefficients | |
beta_intercept ~ filldist(Normal(0, 1), 2) | |
beta_condition ~ filldist(Normal(0, 1), 2) | |
for i in 1:n | |
drifts = beta_intercept #.+ beta_condition * condition[i] | |
d = (choice=data.choice[i], rt=data.rt[i]) | |
d ~ LBA(; τ=tau, A=A, k=k, ν=drifts) | |
end | |
return (; data, A, k, tau) | |
end | |
chain = sample(model_lba((choice=data.choice, rt=data.rt); condition), NUTS(), 500) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment