model {
# Define likelihood model for data:
for (p in 1:N_patients)
{
for(a in 1:antibiotic_classes)
{
response[h_GUID[p],a] ~ dbern(a.prob[a])
}
}
for (gp in 1:N_gp)
{
for(a in 1:antibiotic_classes)
{
response[gp_GUID[gp],a] ~ dbern(a.prob[a])
}
}
for (v in 1:N_volunteers)
{
for(a in 1:antibiotic_classes)
{
response[v_GUID[v],a] ~ dbern(a.prob[a])
}
}
for (o in 1:N_outpatients)
{
for(a in 1:antibiotic_classes)
{
response[o_GUID[o],a] ~ dbern(a.prob[a])
}
}
# ------------------------
# Define the priors:
for(a in 1:antibiotic_classes)
{
antibiotic.class.effect[a] ~ dnorm(intercept, tau.class)
logit(a.prob[a]) <- antibiotic.class.effect[a]
}
# Prior value for intercept
intercept ~ dnorm(0, 0.001)
# Prior values for precision
tau.class ~ dgamma(0.001, 0.001)
# Convert precisions to sd
sd.class <- sqrt(1/tau.class)
#monitor# full.pd, dic, deviance, a.prob, intercept, sd.class
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.