Questions tagged [r2winbugs]

R2WinBUGS is an R package that interfaces with the WinBUGS and OpenBUGS Gibbs samplers.

Documentation and Download

78 questions
1
vote
1 answer

Avoiding rounding in R

I am conducting a Bayesian analysis in R thorough "R2Winbugs" package. In the R output, teh estimated parameters are rounded. My question is how can I control this? Here is my command: bugs(data, inits=inits, model.file =…
Günal
  • 115
  • 1
  • 2
  • 4
0
votes
0 answers

"NIL dereference (read) error in WinBUGS when using spike and slab priors for variable selection"

I am trying to perform group variable selection on a random intercept model using spike and slab priors in WinBUGS. However, I think it is trapping and I keep getting the error message "NIL dereference (read)" when running my code. I'm not sure…
Linda A
  • 33
  • 3
0
votes
1 answer

WinBUGS Error - What is my "undefined variable"?

This is my first time running WinBUGS. My model is fairly simple, with only an intercept and two random effects. However, when I run the model I get a whole list of errors (see below). The first error says "undefined variable". I am having trouble…
Ryan Snead
  • 13
  • 3
0
votes
0 answers

R2WinBUGS error "index out of range" in space-time model

I am very new to WinBUGS so I appreciate anyone's help troubleshooting. I used the R2WinBUGS package to run my model. I had originally posted with an issue about a pop-up in WinBUGS that said "incompatible copy". I resolved this issue by shortening…
0
votes
1 answer

array index is greater than array upper bound for d

Can anyone help me with this issue please? I have used other data sets with different number of studies (NS) and treatments (NT) and it worked fine. Any help will be highly appreciated. The dataset is as follows: list(N=186, NS=5, NT=3, mean=c(0,0);…
Mario
  • 3
  • 1
0
votes
1 answer

How to interpret posterior probability of an regression variable?

I am using the following model in WINBUGS to run a hierarchical Bayesian regression where the beta are my covariates: If I modify this model by adding the following code: # posterior probabilities of Positive beta's p.beta0 <- step( beta0 ) p.beta1…
user121
  • 849
  • 3
  • 21
  • 39
0
votes
0 answers

Where to save the model file while using R2Winbugs?

I'm learning R2WinBUGS. I have few doubts. Can anyone please help me in solving it? when I run this example, I get a error saying "ratsmodel1.txt" does not exists. where am I suppose to save my model file code? And how am I suppose to call it from R…
Janani A
  • 11
  • 2
0
votes
1 answer

Uploading a dataset in winbugs from R

I would like to know how to upload a data set from R packages to winbugs. In particular, "LearnBayes" package in R has too many data sets. I would like to use one of them in Winbugs. Can anyone help me with this?
Janani A
  • 11
  • 2
0
votes
1 answer

Trouble with multiple definitions of node

The model is syntactically correct, I loaded the data but when I compile, I get this error : "multiple definitions of node z". I don't know how to solve it model{ ... for(i in 1:r){ for(j in 1:r){ z[i,j] <-…
Alex
  • 3
  • 2
0
votes
1 answer

Run simulation studies in R2WinBUGS for n datasets

I am having issues figuring out how to run some simulation studies using R2WinBUGS. The aim is to simulate n datasets (aiming for 1000, but starting with 10), and put them all into the R2WinBUGS code as a matrix so that when it ports over to…
Rory Ellis
  • 25
  • 6
0
votes
1 answer

read data from a file rjags

My data file looks something like this: list(y=structure(.Data=c(26, 228, 31, ...)), .Dim=c(413,9)) Let's say this file is saved as "data.txt". If I'm working in 'R2OpenBUGS', it allows me to pass the data as a file with no problem: mcmc <-…
Babak
  • 497
  • 1
  • 7
  • 15
0
votes
1 answer

winbugs: expected a comma eroor

all! I am using winbugs to do simple linear regression. However, the system always give the error message, expected a comma. Here is my model statement: model { for (i in 1:I) { Z[i] ~ dnorm(beta0 + beta1 * X[i], tau) } tau <-…
Douglas J
  • 75
  • 6
0
votes
0 answers

Variable TT is not defined: Error in OpenBUGS

I am trying to run a model in OpenBUGS. But I am getting an error "Variable TT is not defined". Here is my BUGS code: model{ for(t in 2:TT){ for(i in 1:N){ y[t,i] ~ dmnorm(y1[t,i], tau[i]) } y1[t,1] <- (p[1,1] * y[t-1,1]) + (p[1,2]…
Ecology
  • 55
  • 5
0
votes
0 answers

Bayesian multilevel model with R2WINBUGS

data <- list("N","J","K","pa","unit","hosp","tech","teach","beds","unitsur","we","expe", "full") inits1<-list(p0=0.1,tau1=0,tau2=0, beta =c(1,1,1,1,1,1,1,1)) inits2<-list(p0=0.5,tau1=1,tau2=1, beta =c(1,1,1,1,1,1,1,1)) data.inits<-list(inits1,…
mo123
  • 1
  • 1
0
votes
2 answers

How to test the convergence in bugs model?

I want to explain the convergence in a bugs model with the command plot(). An example of the output is in the follow figure I don't sure that I can read this output well, thanks to everyone :)
angeella
  • 126
  • 7