Commit ecd260e8 authored by linushof's avatar linushof
Browse files

Add CPT model files for JAGS

parent 5b052a7b
model
{
# Define priors
alpha.phi ~ dnorm(0,1)
gamma.phi ~ dnorm(0,1)
delta.phi ~ dnorm(0,1)
rho.lmu ~ dunif(-2.3, 1.61)
alpha <- 2*phi(alpha.phi)
gamma <- 2*phi(gamma.phi)
delta <- 5*phi(delta.phi)
rho <- exp(rho.lmu)
# Trial loop
for (i in min_i:max_i)
{
v.x.a[i] <- pow(x_A[i],alpha)
v.y.a[i] <- pow(y_A[i],alpha)
v.x.b[i] <- pow(x_B[i],alpha)
v.y.b[i] <- pow(y_B[i],alpha)
w.x.a[i] <- (delta * (pow(px_A[i],gamma))) / (delta * (pow(px_A[i], gamma)) + pow(py_A[i],gamma))
w.y.a[i] <- 1-w.x.a[i]
w.x.b[i] <- (delta * (pow(px_B[i],gamma))) / (delta * (pow(px_B[i], gamma)) + pow(py_B[i],gamma))
w.y.b[i] <- 1-w.x.b[i]
Vf.a[i] <- w.x.a[i] * v.x.a[i] + w.y.a[i] * v.y.a[i]
Vf.b[i] <- w.x.b[i] * v.x.b[i] + w.y.b[i] * v.y.b[i]
# retransform
Vf.a.re[i] = pow(Vf.a[i], (1/alpha))
Vf.b.re[i] = pow(Vf.b[i], (1/alpha))
binval[i] <- (1)/(1+exp((-1*rho)*(Vf.a.re[i]-Vf.b.re[i])))
resp[i] ~ dbern(binval[i])
}
}
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