N <- 600
status <- rbinom(N, 1, rep(c(0.25,0.5,0.75), each=N/3))
testdata <- data.frame(Population = rep(1:3, each=N/3),
FirstTest = rbinom(N, 1, status*0.95 + (1-status)*0.05),
SecondTest = rbinom(N, 1, status*0.75 + (1-status)*0.02),
ThirdTest = rbinom(N, 1, status*0.5 + (1-status)*0.01)
)
template_huiwalter(testdata, outfile="huiwalter_model.txt",
covariance=data.frame(
Test_A="FirstTest",
Test_B="SecondTest",
Active_Se=TRUE, Active_Sp=FALSE
)
)
## Then examine and verify the code manually!
cat(readLines("huiwalter_model.txt"), sep="\n")
## Before running the model:
if (FALSE) {
results <- run.jags("huiwalter_model.txt")
results
}
## Cleanup:
unlink("huiwalter_model.txt")
Run the code above in your browser using DataLab