Questions tagged [winbugs]

Questions about BUGS language for defining Bayesian models that can be run by the WinBUGS software package. It is advised to supplement your question with a reproducible BUGS example (https://stackoverflow.com/q/5963269); for statistical questions please use crossvalidated.com.

WinBUGS

WinBUGS is a software program for Bayesian analysis of complex statistical models using Markov chain Monte Carlo (MCMC) methods. WinBUGS implements the BUGS language for defining Bayesian models. WinBUGS was created by Dave Lunn, Andrew Thomas, Nicky Best, and David Spiegelhalter in 1996. In 2007 the last stable version (1.4.3) was released. Thereafter development focused on the OpenBUGS project.

Official WinBUGS Documentation

Other Documentation

247 questions
3
votes
1 answer

'expected a comma' error in OpenBUGS

I am trying to fit a model using OpenBUGS. Here is the code: model { # N observations for (i in 1:N) { y[i] ~ dbin(p.bound[i],1) p.bound[i]<-max(0,min(1,p[i])) logit(p[i])<-Xbeta[i] Xbeta[i] <-…
Ecology
  • 55
  • 5
3
votes
1 answer

This seems to work fine but keep having "command #Bugs:gen.inits cannot be executed (is greyed out)"

I am doing a simple regression model with WinBUGS via R2WinBUGS. Results appear ok, however WinBUGS keeps showing this line and I don't know why: command #Bugs:gen.inits cannot be executed (is greyed out) Does someone have an idea? Thanks! The R…
ArnoLB
  • 77
  • 7
3
votes
0 answers

WINBUGS : adding time and product fixed effects in a hierarchical data

I am working on a Hierarchical panel data using WinBugs. Assuming a data on school performance - logs with independent variable logp & rank. All schools are divided into three categories (cat) and I need beta coefficient for each category (thus…
guneet
  • 41
  • 4
3
votes
1 answer

Tracking the point of intersection of a simulated time series with a specific value over many runs in OpenBUGS

I have an OpenBUGS model that uses observed data (y.values) over time (x.values) to simulate many runs (~100000) with new estimates of y-values (y.est) for each run. The observed data exhibit a pronounced decline from a maximum value. I want to keep…
Nigel Stackhouse
  • 481
  • 4
  • 20
3
votes
1 answer

Difference between BUGS model and PyMC?

I'm unable to replicate results from provided BUGS code using PyMC. The BUGS model is the Andersen-Gill multiplicative intensity Cox PH model. model { # Set up data for(i in 1:Nsubj) { for(j in 1:T) { # risk set = 1…
jseabold
  • 7,903
  • 2
  • 39
  • 53
3
votes
0 answers

Contraints on parameters in JAGS/Winbugs

I am using a multinomial model (I have 4 modalities) where I want to estimate all parameters of the model (6 parameters as I have 2 parameters for each of the three first modalities). I managed to do that. My problem now is that I would like to add…
3
votes
0 answers

How to make WinBUGS close when “Trap” occurs

This is just the same question I posted in CrossValidated, where some considered it off topic. So, I reproduce it here: I'm using R2WinBUGS to process several datasets in WinBUGS in "batch mode" from R. Occasionally traps occur, mainly due to bad…
Marshall
  • 83
  • 5
3
votes
1 answer

how to find the posterior mode in BRugs

I am trying to use the R package "BRugs" to implement Gibbs sampler, however the functions that produce summary posterior stats, such as samplesStats(), only returns the mean and the median. Is it possible to extract the posterior mode?
user77873
  • 31
  • 1
3
votes
1 answer

Show progress R2WinBugs

I am doing several Bayesian analyses using R2WinBugs so I can put them in a for-loop. It works perfectly, R calls WinBugs, then the simulation starts and when it is done the results are saved and the next analysis starts. When I normally use…
UserX
  • 115
  • 1
  • 1
  • 6
3
votes
1 answer

this chain contains uninitialized variables

I get "this chain contains uninitialized variables" when I load inits for 3 chains with the attached model. I hit "gen init" to keep going on. Is that a right thing to do? It does not happen with fixed model but tend to happen with random…
user3019492
  • 51
  • 2
  • 4
3
votes
3 answers

How to write for loop when function increases with each iteration?

I am trying to estimate the probability of detecting animals from n.sites over multiple observation periods when animals are removed and detection changes in time and space. It works if I do something like this for 5 observation periods: for(i in…
djhocking
  • 1,072
  • 3
  • 16
  • 28
3
votes
2 answers

rJAGS version of write.model()?

The R2WinBUGS package has a function called write.model(). The R package rjags has no such function of which I am aware. write.model creates a temporary text file that can be read as a model by WinBUGS. I know I can enter write.model into the…
rbatt
  • 4,677
  • 4
  • 23
  • 41
3
votes
2 answers

multiple definitions of node error in winbugs

I try to use WinBUGS from R via BRugs and R2WinBUGS, the code is followinig: require(R2WinBUGS) require(BRugs) model<-function(){ for(i in 1:N){ y[i] <- x[i] + w[i] w[i] ~ dnorm(0, sigma.y) x[i] <- a - b*5 + v[i] v[i] ~ dnorm(0,…
PepsiCo
  • 1,399
  • 4
  • 13
  • 18
3
votes
1 answer

unbalanced panel and multidimensional array in Winbugs

I have a model for input demand, with unbalanced data. The dependent variable is yijt, where i means input of production function (i=1,2,3), j means firm (j=1,..,21), and t means time (ti=1,..,Ti). So, because the panel is unbalanced, with three…
3
votes
2 answers

How many iterations are saved by JAGS/BUGS when burnin and thinning are specified?

I have a quick question about the details of running a model in JAGS and BUGS. Say I run a model with n.burnin=5000, n.iter=5000 and thin=2. Does this mean that the program will: Run 5,000 iterations, and discard results; and then Run another…
user1375871
  • 1,199
  • 1
  • 12
  • 23
1 2
3
16 17