Questions tagged [r2winbugs]

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

Documentation and Download

78 questions
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
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

R2WinBUGS - logistic regression with simulated data

I am just wondering whether anyone has some R code that uses the package R2WinBUGS to run logistic regression - ideally with simulated data to generate the 'truth' and two continous co-variates. Thanks. Christian PS: Potential code to generate…
cs0815
  • 16,751
  • 45
  • 136
  • 299
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
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
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
4
votes
1 answer

OpenBUGS: missing value in Bernoulli distribution

I'm trying to model the observation "time" as random variable with OpenBUGS via R (R2OpenBUGS). If all the observation times are available (no NA's) everything works, but if I set one of the times to NA, nothing happens. I tested the same code with…
Jouni Helske
  • 6,427
  • 29
  • 52
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
1 answer

R2WinBUGS error in R

I'm trying to duplicate some code and am running into troubles with WinBUGS. The code was written in 2010 and I think that back then, the package was installed with additional files which R is now looking for and can't find (hence the error), but…
Maya Hadar
  • 41
  • 1
  • 2
4
votes
0 answers

Why am I getting "Error in handleRes(res) : NA" when running bugs() with syntactically correct model?

I'm trying to run a bayes model through R using R2WinBugs and BRugs but running into an error which I cannot solve. I've checked that my model is syntactically correct, and this is the output from when I try running (example below): model is…
Polly
  • 41
  • 4
4
votes
1 answer

What's wrong with this WinBUGS model

I used Winbugs from R via R2WinBUGS and BRugs package, I write the model and try to run it, but the result didn't come out, and I read the WinBUGS log, seems nothing got wrong. Here is the model: require(BRugs) require(R2WinBUGS) # MCMC…
PepsiCo
  • 1,399
  • 4
  • 13
  • 18
3
votes
3 answers

R2WinBUGS - Warning messages

I am trying to use R2WinBUGS using this example: code (Please only consider the part: ### 5.4. Analysis using WinBUGS) I am getting this error message: Error in file(con, "wb") : cannot open the connection In addition: Warning messages: 1: In…
cs0815
  • 16,751
  • 45
  • 136
  • 299
3
votes
2 answers

Translating WinBUGS model to JAGS (using R)

I am trying to implement the following model written for WinBUGS in JAGS: model { for (i in 1:N) { wtp[i] ~ dweib(r[G[i]], mu[i])I(lower[i], upper[i]) mu[i] <- exp(beta[G[i]]) G[i] ~ dcat(P[]) } …
johnson-shuffle
  • 1,023
  • 5
  • 11
1
2 3 4 5 6