Skip to content

Instantly share code, notes, and snippets.

@itsdfish
Last active July 6, 2023 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itsdfish/0ba5aaf1681f2d8b52579773d830c103 to your computer and use it in GitHub Desktop.
Save itsdfish/0ba5aaf1681f2d8b52579773d830c103 to your computer and use it in GitHub Desktop.
Bijector Error
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