Questions tagged [r2winbugs]

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

Documentation and Download

78 questions
2
votes
1 answer

R2WinBUGS opens WinBUGS window, but doesn't launch simulation

I'm trying to run some simulations in WinBUGS using R and R2WinBUGS running in Windows 7. After I prepare all the files a and launch the function bugs() the WinBUGS windows opens but doesn't start the simulations. The same happens with older…
mferreira
  • 388
  • 1
  • 8
2
votes
1 answer

"Collection operator c error" when calling OpenBUGS from R

I'm trying to use R2OpenBUGS to run a differential equation solver in OpenBUGS. I have tried this with the exponential decay example (Example01.odc) in the OpenBUGS/Diff/Examples folder. The first part of this example is a simulation, the second is…
2
votes
1 answer

Error from running R2WinBUGS in R: 'type' must be "real" for this format

I am getting an error from running R2WinBUGS in R. Heres the code for reproducibility. #Set working directory setwd("H://AChaudhuri/Testing/CSVS") matrix=NULL csvs <- paste("MVN", 1:2, ".csv", sep="") for(i in 1:length(csvs)){ matrix[[i]] <-…
user1560215
  • 227
  • 1
  • 13
2
votes
1 answer

error in using WinBUGS from R

The code is following: require(BRugs) require(R2WinBUGS) model<-function(){ for(i in 1:N){ y[i] ~ dnorm(x[i], sigma.y) } x[1] ~ dnorm(theta[1], sigma.y) theta[1] <- 0 for(j in 2:N){ x[j] ~ dnorm(theta[j], sigma.x) theta[j] <-…
PepsiCo
  • 1,399
  • 4
  • 13
  • 18
2
votes
1 answer

R2WinBUGS error - Trap - incompatible copy

I'm trying to call winBUGS from R to estimate a logistic regression. I'm using the following code: # Directorio de trabajo setwd("~/3 Diplomado/7 Bayesiana/8t1") # paquete para hablarse con WinBUGS desde R library(R2WinBUGS) # cargamos datos reg…
JEquihua
  • 1,217
  • 3
  • 20
  • 40
1
vote
2 answers

How do I obtain Monte Carlo error in R2OpenBugs?

Has anyone managed to obtain a Monte Carlo error for a parameter when running bayesian model un R2OpenBugs? It is provided in a standard output of OpenBugs, but when run under R2OpenBugs, the log file doesn't have MC error.Is there a way to ask…
marina_esp
  • 13
  • 3
1
vote
0 answers

Error: unexpected input in the model with R2OpenBUGS

I am trying to run this model under R for bayesian inference modelling: model { for (i in 1:N) { logit(theta[i]) i- alpha + beta*d[i] y[i] ∼ dbin(theta[i], n[i]) } alpha∼ dbeta(1, 1) beta ∼ dbeta(1, 1)} I have previously created a list with the…
Jeeks
  • 11
  • 1
1
vote
0 answers

Trace Plots after MCMC iteration with R2WinBUGS

After carring a Network bayesian Meta-analysis with R2WinBUGS, I tried to create some plots. Specifically, i would like to carry out some trace plot figures to show model convergence; however, I can't create one and don't know how to do it. Let's…
1
vote
0 answers

uninitialized variables and #Bugs:dic.set cannot be executed (is greyed out) issue in WinBUGS

I am running the following model using r2WinBUGS package from R. model{ for (i in 1:Nshim) { y.SHIM[i]~ dnorm(mu[i], tau) mu[i] <- zeta[PID[i]]+beta0[T[PID[i]]]+beta1[T[PID[i]]]*TIME[i]+beta2[T[PID[i]]]*pow(TIME[i],2) } for ( k in…
Uddin
  • 754
  • 5
  • 18
1
vote
1 answer

Replicating R's prod() function in WinBUGS

Using WinBUGS, how can I calculate the product of all values in a single vector? I have tried using a for loop over the same vector. For example: In R, if A <- [1,2,3,4], prod(A) = 24. However, in BUGS, if a <- 2 , and for (i in 1:n){ a <- a *…
1
vote
0 answers

R2WinBUGS error (no prior specified for this initial value)

The original WinBUGS code is as follows: model { for (i in 1:n) {for (j in 1:J) {y[i,j] <- equals(D[i],j) D[i] ~ dcat(p[i,]) p[i,j] <- phi[i,j] / sum(phi[i,]) LL[i,j] <- y[i,j]*log(p[i,j])} for (j in 2:J) { S.ed[i,j] <- …
HeeHun Kim
  • 11
  • 3
1
vote
0 answers

"invalid or unexpected token scanned" model error in WinBugs

by using model { for(i in 1:N){ n[i] ~ dpois(mu[i]) mu[i] <-­ pow(t[i]/beta, alpha) } alpha ~ dunif(1,100) beta ~ dunif(1,100) } WinBugs give error"invalid or unexpected token scanned" kindly consider the above model and give me the…
1
vote
0 answers

Cant able to access WinBUGS code in R using R2WinBUGS

I have the model specification in WinBUGS and I have specified all the parameters, initials in the R console. While using the bugs() function say, bugs(data, parameters,…
Janani A
  • 11
  • 2
1
vote
1 answer

Switching from MD to SMD in WinBUGS gives undefined real trap error

First time posting here so I hope I have been able to tick all the boxes for requirements. I am running a network meta-analysis using code provided by the NICE technical support documents via R and R2WinBUGS. Model works well using mean difference,…
Tdisher
  • 111
  • 1
1
vote
1 answer

print DIC in R2OpenBUGS

I'm working in "R2OpenBUGS" in R. I have some mcmc chain: mcmc <- bugs(data = ... DIC=TRUE ... codaPkg=TRUE) My question is how to print DIC when codaPkg = TRUE. If codaPkg = FaLSE, then if I just do print(mcmc), it prints the DIC value at the end.…
Babak
  • 497
  • 1
  • 7
  • 15