Hi All:

I am running R2WinBUGS so that I could automate the running of my
Multivariate Logit Normal model on 300 simulated datasets. The problem I
have is I am not able to read in the data correctly and then code it in the
automation part.

*Heres my model:*

model
{
 for (j in 1 : Nf)

{
p1[j, 1:2 ] ~ dmnorm(gamma[1:2], T[1:2 ,1:2])
# T is the precision matrix or inverse sigma for MVN

for (i in 1:2)
{
logit(p[j,i])<-p1[j,i]

Y[j,i] ~ dbin(p[j,i],n)
}

}
# Hyper-priors:

gamma[1:2] ~ dmnorm(mn[1:2],prec[1:2 ,1:2])
mn<-c(-1.59,-2.44)
prec<-structure(.Data = c(.001,0,0,.001),.Dim = c(2, 2))

T[1:2 ,1:2] ~ dwish(R[1:2 ,1:2], 2)
sigma2[1:2, 1:2] <-inverse(T[,])
rho <- sigma2[1,2]/sqrt(sigma2[1,1]*sigma2[2,2])
R<-structure(.Data = c(.001,0,0,.001),.Dim = c(2, 2))

}

As of now my *Y is in 2 seperate datasets*,generated using the 2
different p's.I am using the first 5 simulated datsets for now.My question
is should I put the two Y's together in one dataset and then read that. If
so, how do I read it?

*Heres my automation code:*

trial.data <- read.table("trial_data.txt", header=T)
bugs.output <- list()
for(i in 1:5){
       nausea <- as.integer(trial.data[i,])
       bugs.output[[i]] <- bugs(
       data=list(nausea=nausea, Nf=20),
       model.file="model.txt", n.iter=12000, n.burnin=5000,
bugs.directory="E:/AChaudhuri/winbugs14/WinBUGS14")}

Appreciate any help.
Thanks
Anamika

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to