Prior conditional on other prior

94 Views Asked by At

I am trying to sample two parameters (prior) from a categorical distribution ranging from 1 to 5000, theta[1] and theta[2] with the requirement that theta1 < theta2.

I have tried (among other things):

theta[1] ~ dcat(p1[])
p1[1:n] <- 1/n 


theta[2] ~ dcat(p2[])
pi2[1:theta[1]] <- 0 
pi2[sum(theta[1],1):n] <- 1/sum(n, -pi1) 

with n = 5000 so that theta2 is sampled from the categorical distribution ranging from theta1 to n.

The error is: unknown variable theta[1].

Any help would be appreciated.

1

There are 1 best solutions below

0
On

If in this categorical variable with n=5000, the only requirement is that theta1<theta2, you could use the order() function:

theta.star[1] ~ dcat(p1[])
theta.star[2] ~ dcat(p1[])
theta <- order(theta.star)

The order() function is a way to impose order constraints in JAGS.