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
23
votes
0 answers

How to incorporate weights into the likelihood of a WinBUGS model?

I want to incorporate weights into the likelihood of a WINBUGS model to do what brms does with weights. The usual BUGS approaches to accomplish that for dnorm and dpois are not working for dbin. In brms, as paul.buerkner says here, that is…
Krantz
  • 1,424
  • 1
  • 12
  • 31
13
votes
3 answers

How can I convert an mcmc.list to a bugs object?

I am using the rjags R library. The function coda.samples produces an mcmc.list, for example (from example(coda.samples)): library(rjags) data(LINE) LINE$recompile() LINE.out <- coda.samples(LINE, c("alpha","beta","sigma"),…
David LeBauer
  • 31,011
  • 31
  • 115
  • 189
11
votes
2 answers

BUGS error messages

I am new to WinBUGS/OpenBUGS and having difficulty debugging my code. Does anyone know of a list of potential error messages for BUGS models and their meanings in plain English?
user3343467
  • 185
  • 1
  • 2
  • 9
11
votes
1 answer

Choosing Different Distributions based on if - else condition in WinBugs/JAGS

I am trying to write a Winbugs/Jags model for modeling multi grain topic models (exactly this paper -> http://www.ryanmcd.com/papers/mg_lda.pdf) Here I would like to choose a different distribution based on a particular value. For Eg: I would like…
user662239
  • 145
  • 2
  • 6
8
votes
2 answers

WinBUGS Weibull Network Meta-Analysis

I am currently working on a meta-analysis of survival data across several clinical trials. To do this, I have code from a published analysis using the same methodology. However, when running this code using the data from the published analysis, I…
jrdnmdhl
  • 1,935
  • 18
  • 26
6
votes
1 answer

Three-level nested mixed-effects model

I am trying to model a three-level nested linear mixed effects model in rjags (by three-level: multiple observations for multiple individuals within multiple groups). There are unique sets of individuals in the groups. The equivalent model in lme4…
user2957945
  • 2,353
  • 2
  • 21
  • 40
6
votes
0 answers

Decoding a Trap - "Index Out of Range" Message in WinBUGS

I've been tasked with re-running someone else's model with updated data (I did the data update and formatting). I understand how the model works but didn't write it, and it's quite long and detailed. On top of that, I exclusively use JAGS and this…
stewart6
  • 259
  • 2
  • 4
  • 15
6
votes
1 answer

WinBUGS message error: Expected key word structure

I am new to WinBUGS and I could not get the code below to work. The model is syntactically correct (it is a hierarchical logit model with random effects), but when I click load data the error message that appears is expected key word structure. What…
Guille
  • 63
  • 1
  • 3
6
votes
3 answers

Defining new functions and distributions in the BUGS/JAGS/STAN language

I am very new statistical analysis world and have taken a recent interest in the BUGS/JAGS/STAN modelling language. Something which really surprises me is that I haven't seen any examples of new functions or distributions being defined to avoid code…
jacky
6
votes
1 answer

OpenBUGS fails to converge on model that converges in WinBUGS. Precision limit?

As the title of this post says, when I try to run code and data that work fine in WinBUGS from R using BRugsFit (with coda=T), I get these errors: Error in glm.fit(x = structure(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, : NA/NaN/Inf in foreign…
bokov
  • 3,444
  • 2
  • 31
  • 49
5
votes
2 answers

OpenBUGS error undefined variable

I'm working on a binomial mixture model using OpenBUGS and R package R2OpenBUGS. I've successfully built simpler models, but once I add another level for imperfect detection, I consistently receive the error variable X is not defined in model or in…
sgo
  • 53
  • 1
  • 4
5
votes
2 answers

jags.parallel - Error in get(name, envir = envir) : invalid first argument

When using jags.parallel, I get the following error: > out <- jags.parallel(win.data, inits, params, "Poisson.OD.t.test.txt", + nc, ni, nb, nt); Error in get(name, envir = envir) : invalid first argument The same call using jags function runs OK. I…
Tomas
  • 57,621
  • 49
  • 238
  • 373
4
votes
1 answer

R2WinBUGS - how to reload the WinBUGS computation results to bugs object again

I have run a looong computation in WinBUGS (million iterations) using the R2WinBUGS package from within R: bugs.object <- bugs(...) but the R crashed. How do I reload the bugs.object into R again without running winbugs again? I tried this (I have…
Tomas
  • 57,621
  • 49
  • 238
  • 373
4
votes
0 answers

Translating WinBUGS models to rstan

I have WinBUGS models below which I need to use in R. However because I am not familiar with WinBUGS and for consistency with other parts of the analysis, I would appreciate any help to convert them to rstan. Here are the models and data (full…
Krantz
  • 1,424
  • 1
  • 12
  • 31
4
votes
3 answers

JAGS - hierarchical model comparison not jumping between models even with pseudopriors

I'm using the hierarchical modelling framework described by Kruschke to set up a comparison between two models in JAGS. The idea in this framework is to run and compare multiple versions of a model, by specifying each version as one level of a…
Tim
  • 69
  • 6
1
2 3
16 17