1 | model.ord(Covs, prior, path)
|
Covs |
|
prior |
|
path |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (Covs, prior, path)
{
cat("model\n{", file = paste(path, "model.txt", sep = ""))
cat("\n for (i in 1:nobs) {\n p[i,1] <- 1 - Q[i,1]\n for (r in 2:(ncat-1)) {\n p[i,r] <- Q[i,r-1] - Q[i,r]\n }\n p[i,ncat] <- Q[i,(ncat-1)]\n for (r in 1:(ncat-1)) {\n logit(Q[i,r]) <- beta*Treat[i] - c[r]\n }\n\t Y[i] ~ dcat(p[i,])\n }\n for (i in 2:(ncat-1)) {",
file = paste(path, "model.txt", sep = ""), append = T,
sep = "")
cat("\n dc[i] ~", prior$Prior.dc, file = paste(path,
"model.txt", sep = ""), append = T, sep = "")
cat("\n }\n c[1] <- dc[1]\n for (i in 2:(ncat-1)) {\n c[i] <- c[i-1] + dc[i]\n }",
file = paste(path, "model.txt", sep = ""), append = T,
sep = "")
cat("\n dc[1] ~", prior$Prior.c1, file = paste(path,
"model.txt", sep = ""), append = T, sep = "")
cat("\n beta ~ ", prior$Prior.beta, file = paste(path,
"model.txt", sep = ""), append = T, sep = "")
cat("\n or <- exp(beta)", file = paste(path, "model.txt",
sep = ""), append = T, sep = "")
cat("\n }", file = paste(path, "model.txt", sep = ""),
append = T, sep = "")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.