You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to run a model but getting an error message. Here is my entire code. Could anyone please help me to understand why I am getting this error message. Thanks in advance
N=nrow(dat) #index for rows
I=ncol(dat) #index for columns
rater=c(1,2,3,1,2,3)
item=c(1,1,1,2,2,2)
K <- apply(dat, 2, max)
rater1 <- function() {
for (i in 1:N) {
for (j in 1:I) {
dat[i,j] ~ dcat(prob[i,j,1:K[j]])
}
theta[i] ~ dnorm(0,1)
for(j in 1:I) {
for(k in 1:(K[j]-1)) {
logit( P[i,j,k] ) <- theta[i]-B[item[j]] -C[item[j],k]-D[rater[j]]
}
P[i, j,K[j]] <- 1
}
for(j in 1:I) {
prob[i, j, 1] <- P[i, j, 1]
for (k in 2:(K[j])){
prob[i, j, k] <- P[i, j, k] - P[i, j, k-1]
}
}
}
for(j in 1:2) {
B[j] ~ dnorm(0,4)
}
for (j in 1:3) {
D[j] ~ dnorm(0,4)
}
for (j in 1:2) {
for(k in 1:(K[j])) {
C[j,k] ~ dnorm(0,1)
}
}
}
write.model(rater1, con = "rater.bug", digits = 5)
data=list("dat", "N", "I","rater","item", "K")
#R2jugs
rjags=jags(data=data, inits = NULL, n.chains = 1, n.iter = 1500,
n.thin = 1, model.file = "rater.bug", n.burnin = 300,DIC = T,
parameters.to.save=c("B","C","theta","D"))
The text was updated successfully, but these errors were encountered:
Hi,
I am trying to run a model but getting an error message. Here is my entire code. Could anyone please help me to understand why I am getting this error message. Thanks in advance
library(R2WinBUGS);
library(R2jags);
library(coda) ;
library(boot);
library(R2jags);
dat<-matrix(c(
6 ,5 , 1 ,1 , 1, 1,
5 ,1 , 1 ,3 , 1, 1,
6 ,5 , 6 ,1 , 1, 1,
6 ,6 , 3 ,1 , 1, 1,
6 ,6 , 6 ,1 , 2, 1,
6 ,6 , 6 ,1 , 1, 1,
6 ,6 , 6 ,6 , 6, 1,
6 ,6 , 6 ,1 , 1, 1,
6 ,6 , 6 ,6 , 6, 5,
6 ,6 , 6 ,1 , 1, 1,
6 ,6 , 1 ,2 , 1, 1,
6 ,6 , 6 ,6 , 4, 1), ncol=6)
N=nrow(dat) #index for rows
I=ncol(dat) #index for columns
rater=c(1,2,3,1,2,3)
item=c(1,1,1,2,2,2)
K <- apply(dat, 2, max)
rater1 <- function() {
for (i in 1:N) {
for (j in 1:I) {
dat[i,j] ~ dcat(prob[i,j,1:K[j]])
}
theta[i] ~ dnorm(0,1)
}
for(j in 1:2) {
B[j] ~ dnorm(0,4)
}
for (j in 1:3) {
D[j] ~ dnorm(0,4)
}
for (j in 1:2) {
for(k in 1:(K[j])) {
C[j,k] ~ dnorm(0,1)
}
}
}
write.model(rater1, con = "rater.bug", digits = 5)
data=list("dat", "N", "I","rater","item", "K")
#R2jugs
rjags=jags(data=data, inits = NULL, n.chains = 1, n.iter = 1500,
n.thin = 1, model.file = "rater.bug", n.burnin = 300,DIC = T,
parameters.to.save=c("B","C","theta","D"))
The text was updated successfully, but these errors were encountered: