Questions tagged [r2winbugs]

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

Documentation and Download

78 questions
3
votes
0 answers

R2WinBugs data entry incompatible copy error for Conditional Binomial likelihood, probit link, Random Effects (Psoriasis example)

I was working on the the guide for calculating the effect size of different treatments using a NETWORK META-ANALYSIS as done in example 6.a. Here It works fine in winBugs, but I want to do the analysis in R using R2winugs so that I can automate the…
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

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

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

R2OpenBUGS: modelling final treatment outcomes from intermediate outcomes

Is anyone using R2OpenBUGS? Should I rather be using r2winbugs? ... I am trying to model final (2-year) treatment outcomes (e.g. success, death, default or failure) for my sample of patients with a (single) intermediate (3-month) outcome.…
2
votes
1 answer

Calling WinBUGS14 from R

I'm trying to call WinBUGS from R, but I have not been very successful. I typed this code in R: radon.data <- list ("n", "J", "x", "y", "county") radon.inits <- function (){ list (a=rnorm(J), b=rnorm(1), mu.a=rnorm(1), sigma.y=runif(1),…
2
votes
0 answers

Bayesian - decision model with R and R2WinBugs

We want to run a given baysian Model for decision making with R and WinBugs. We are using RStudio and R2WinBugs. The model is given by: # Search and Stop model{ # Data for (i in 1:ns){ for (q in 1:nq){ y[i,q] ~…
Simon S
  • 21
  • 2
2
votes
1 answer

Specify logit function explicitly in WinBUGS/OpenBUGS

I'm new to OpenBUGS and I got some problem in fitting a model with the logit() function. Reading around I found that one possible solution for this would be explicit specify the logit function without using the WinBUGS’ own logit function: In…
Vincenzo G
  • 41
  • 5
2
votes
0 answers

Cannot bracket slice for node, WinBUGS

So I have been working on this code for awhile running hazard models for a population and for one of my initial parameters it cannot figure out how to fix it. This is the area of code that is giving me problems. I am coding in Notebook++, running in…
2
votes
0 answers

spatial.exp on WinBUGS

I really hope this is not a stupid question, but I am trying to simulate a very simple spatial Bayesian model and I keep getting some sort of "incopmatible copy" message on the WinBUGS window. I am simulating…
2
votes
1 answer

set.seed in WinBUGS through R

Is it possible to set a seed in WinBUGS to reproduce parameter estimates like one can do with set.seed in R?
Mark Miller
  • 12,483
  • 23
  • 78
  • 132
2
votes
1 answer

Passing variable to WinBugs model in R

I am using the R2WinBugs package. I would like to pass two parameter that are calculated previously in the R script to the model function c0yy <- 0.1 syy <- 0.0001 #Model model <- function(c0yy,syy){ #Likelihood for(i in 1:n){ y[i] ~…
user3036416
  • 1,205
  • 2
  • 15
  • 28