I am trying to define a node *sat*, such that it is *0* if another node *con=0* and *sat* comes from a normal distribution if *con≠0*. Does anyone has any suggestion on how to make that work? Thanks!

Here are the things I have tried (along with error message), none of which work:

~~~~~~~

temp[i,1] ~ dcat(1)

temp[i,2] ~ dnorm(g[i],taus)

ind <- con[i]+1

sat[i] ~ temp[i,ind]

# Error in last line near "temp"

# I know for this case sat=1 when con=0, but that works too.

sat[i] ~ ifelse(con[i]==0, 0, dnorm(g[i],taus))

# Incorrect number of parameters in function dnorm

# Possibly because ifelse doesn't work with distributions

temp[i] ~ dnorm(g[i],taus)

sat[i] <- con[i]*temp[i]