Open paciorek opened 3 months ago
@paciorek I'm also surprised this doesn't work. I thought we checked to make sure p_eff[i] <- z[i]*expit(alpha[1]+alpha[2]*x1[i] + alpha[3]*x2[i])
is okay if z[i]
is a bernoulli. I suppose we checked a different case of that.
This minor change version is allowed:
code <- nimbleCode({
for(j in 1:4)
beta[j] ~ dnorm(0, sd=10) # use all three covariates
for(j in 1:3)
alpha[j] ~ dnorm(0, sd=10) # only use first two covariates
for(i in 1:n_sites) {
logit(p[i]) <- beta[1] + beta[2]*x1[i]+beta[3]*x2[i] + beta[4]*x3[i]
z[i] ~ dbern(p[i])
p_eff[i] <- expit(alpha[1]+alpha[2]*x1[i] + alpha[3]*x2[i])
for(j in 1:n_visits) {
y[i,j] ~ dbern(z[i]*p_eff[i])
}
}
})
I thought my error trapping for model structure would allow this but it doesn't seem to. There are easy workarounds, but would be nice if this worked.