Hi All:
I am getting an error (highlighted) from running R2WinBUGS in R.
To be able to replicate the situation heres the code:
.#Set working directory
setwd("H://AChaudhuri/Testing/CSVS")
matrix=NULL
csvs <- paste("MVN", 1:2, ".csv", sep="")
for(i in 1:length(csvs)){
  matrix[[i]] <- read.csv(file=csvs[i], header=T)
  print(matrix[[i]])
}

So now I have read in 2 simulated datasets which  look like
 Y1 Y2
1 11  6
2  8  5
3 25 13
4  1 13
5  8 22
  Y1 Y2
1  9  1
2  7  9
3 25 13
4  1 18
5  9 12

My next step is to run a multivariate logit normal model on these datasets
and automate this process for such simulated datasets. Heres the model
statement:
model
 {
  for (j in 1 : Nf)

      {
      p1[j, 1:2 ] ~ dmnorm(gamma[1:2 ], T[1:2 ,1:2 ])

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

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

I am trying to use the following code to run it in R
library("R2WinBUGS")
bugs.output <- list()
for(i in 1:2){

       Y <-(matrix[i])

       bugs.output[[i]] <- bugs(
       data=list(Y=Y, Nf=5), # change for no of sites
    inits=NULL,
       model.file="M-LN_model_trial.txt",
       parameters.to.save = c("p","rho","sigma2"),
n.chains=1, n.iter=12000, n.burnin=5000,
bugs.directory="H://AChaudhuri/winbugs14/WinBUGS14",
working.directory=NULL)}


Error in FUN(X[[1L]], ...) :

  .C(..): 'type' must be "real" for this format

Any suggestion would be helpful.
Thanks!

        [[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