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 (http://stackoverflow.com/q/5963269).

learn more… | top users | synonyms

2
votes
1answer
29 views

Joint prior distributions in WinBUGS

Suppose we have a hierarchical model summarised by the following: $y_{i} \sim N(\mu_{i}, \sigma^{2})$, for $i = 1, \ldots, n$; (For these purposes, assume $\sigma^{2}$ is known) where $\mu_{i} = ...
-1
votes
0answers
19 views

solve the problem of dichotomous data in winbugs [closed]

i want to write a command in winbugs but i want to write in other method not like the code below so i want to manipulate the problem of dichotomous data. anyone help me thanks alot for(j in ...
1
vote
0answers
23 views

How to make WinBUGS close when “Trap” occurs [closed]

I'm using R2WinBUGS to process several datasets in WinBUGS in "batch mode". Occasionally traps occur, mainly due to bad parameters (I guess), and I managed to avoid ...
2
votes
0answers
56 views

WinBUGS/OpenBUGS Gamma distribution parameters [closed]

According to the WinBUGS manual the gamma distribution is defined by: dgamma(r,mu) However, what is r? Is it the shape, scale ...
1
vote
1answer
42 views

Specification of logical node (with distribution?) in WINBUGS

For a piece of homework I have an assignment using WINBUGS which I must admit confuses me to say the least. Tangential to my question but I have a few stochastic nodes that are to be gamma ...
1
vote
1answer
64 views

JAGS burn-in phase takes ZERO time? [duplicate]

My breath was taken away by this. I tried to run my JAGS model with different number burn-in samples but it still takes the same amout of time!! ...
1
vote
0answers
111 views

CAR spatial models in JAGS

WinBUGS comes with the GeoBUGS add-on, which contains a number of predefined model structures that are suitable for modelling spatial data structures e.g. geostatical structures (spatial.exp), ...
0
votes
1answer
111 views

Undefined real result in a zero-inflated negative binomial

I have run a zero-inflated Poisson model in WinBUGS without problems, and now I am trying to run its equivalent negative binomial. However, I get an "undefined real result" trap message over and over. ...
0
votes
1answer
165 views

Estimation of the shape parameter of gamma distribution in Winbugs

I want to estimate the shape parameter of gamma distribution in Winbugs. I select gamma distribution as prior for shape parameter. Data set is generated using MATLAB as: ...
0
votes
0answers
69 views

How exactly is car.normal model specified?

Looking at the GeoBUGS manual version 12, there is a confusion how exactly the car.normal model is specified: 1) at page 12, I read car.normal and car.l1 [top] ...
0
votes
1answer
135 views

Define Priors for Dirichlet Distribution parameters in JAGS

I'm defining a Multinomial-Dirichlet model in JAGS and want to assign some hyperpriors to the parameters of the Dirichlet distribution. In the WinBugs manual I read that "the parameters of Dirichlet ...
1
vote
1answer
101 views

How can I estimate the precision of a normal using a Gibbs sampler?

I am trying to estimate the precision $\tau$ of a normal distribution with either WinBUGS or OpenBUGS: $c \sim \text{normal}(\mu,\tau)$ $\mu \rightarrow \lambda \cdot t^{-\beta}$ $\tau \sim ...
0
votes
0answers
38 views

How to calculate gelman and rubin convergence diagnostics in Excel

Does anyone know how to calculate the gelman and rubin convergence diagnostics in Excel. I'm trying to understand the steps in the formula, but not sure that I doing it correctly. I know it can be ...
1
vote
0answers
88 views

The effective sample size from WinBUGS results

I am running a Bayesian regression model by WinGUBS via R2WinBUGS package in R. Everything looks fine except for one parameter: ...
1
vote
1answer
259 views

Trap 66 in WinBUGS in a hierarchical Bayesian modeling

I want to analyze a multilevel multidimensional model in WinBUGS. the model is as below (N=2362 students responding to K=45 items of a test, students are nested within J=116 schools): ...
1
vote
1answer
265 views

WinBUGS: Multiple definitions of a node

So this question is about the BUGS modeling language. So you either know it or have no clue. I'm a newbie to this so it's been driving me mad. I want to define a simple two-state hidden Markov model ...
2
votes
0answers
96 views

How to define a BUGS/JAGS or WinBUGS model with a likelihood node that includes two integrals?

I would like to implement a BUGS/WINBUGS or JAGS model that specifies the likelihood node by marginalizing over two parameters. Is this feasible in BUGS/WINBUGS or JAGS? This is the posterior ...
2
votes
3answers
135 views

Bayesian Vs MLE regression - getting different results

I've set up a Bayesian regression model in WinBUGS to determine values for the unknown parameters (b1, b2, b3, b4) and intercept value (b0) in a linear regression model. The code is as follows: ...
0
votes
1answer
46 views

Looking for step by step example of sampling from DAG in Bayesian model

I am looking for a tutorial type example that shows the step by step process sampling from a simple hierarchical model. For example, I am trying to study the distribution of ...
1
vote
0answers
77 views

How can I compute covariances between parameters in WinBUGS?

I am wondering if there is an easy way to compute the covariances between parameters in WinBUGS/OpenBUGS. It is easy to obtain the variances, but for subsequent analysis, I need the covariances. ...
0
votes
0answers
144 views

How to implement mixture distributions for data in JAGS

In JAGS, how can I model the data being sampled from a mixture distribution? For example, I want an outcome to be either $0$ with probability $p$ or normal with probability $(1 - p)$. $p$ and the ...
0
votes
0answers
150 views

How many chains should we choose in multi-treatment meta-analysis using MCMC and WinBugs

I am learning to undertake multiple treatment comparison meta-analysis (aka network meta-analysis or MTM) using WinBugs. One of the specifications are choosing the number of chains to run in the MCMC ...
2
votes
1answer
409 views

WinBUGs-TIme Series Code

I am looking to get started using time series (arima) (regression) (etc) evaluating log stock returns in WinBUGs. Does anyone have a simple code to get me jump started?
1
vote
1answer
69 views

Multiplying a matrix by a scalar which has a prior distribution in OpenBUGS

So I am having a problem specifying my model in OpenBUGS. A set of vectors in a linear regression model is given a multivariate normal prior with a constant mean vector and a constant precision matrix ...
3
votes
0answers
103 views

How to use an initial posterior for recursive / sequential updating in WinBUGS

I am using WinBUGS to estimate / update the parameters of a model. The model is: $$ \begin{aligned} D(T,B,a)&= B*(a_0+a_1T+a_2T^2+a_3T^3)+error(B,T,a) \\ error &= \mathcal N(0, ...
2
votes
1answer
259 views

Logistic Regression - Bayesian Approach - Assessing Classification Precision

I have recently begun to read about bayesian statistics and I am playing around with the R2WinBUGS package. I'm trying to fit a logistic regression to the spam data (that can be found on the webpage ...
1
vote
2answers
271 views

Thinning chains in BUGS/JAGS

Hi 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 ...
0
votes
1answer
472 views

WinBUGS truncated normal distribution [duplicate]

I am estimating a stochastic frontier with a mixed model. So far the half normal distribution worked good but I need a truncated normal distribution. It does not work, and I receive the error ...
1
vote
0answers
589 views

How do I identify this trap error in WinBUGS?

I am currently working on my thesis and interested in estimating a Weibull conditional Hazard Frailty Model for recurrent event data using WinBUGS. I wrote the model but when am trying to use it with ...
2
votes
0answers
176 views

Calculate DIC from WinBUGS output

Has anyone ever tried to calculate DIC "manually" from WinBUGS output? I tried for the simplest linear model, and could get exact the same Dbar, but always a bit different Dhat. I think Dhat ...
3
votes
2answers
432 views

Variables that do not converge in winbugs

I conducted a Bayesian analysis in winbugs and then checked the convergence from the history plots. The regression coefficients look stabilized, but the variance parameters don't. I got the number of ...
1
vote
0answers
120 views

How do you code three summation functions in WinBUGS?

I recently learned how to use winbugs. I know nothing about coding and programming. My model is not included in the set of distributions that are already available in winbugs. This is a trivariate ...
2
votes
2answers
207 views

Results Difference: Frequentist vs. Bayesian

I fit a lognormal model on some data points using both frequentist and Bayesian (using a non-informative prior) approaches. However, I got different results. Here are my codes and outputs: ...
1
vote
0answers
499 views

Fitting Lognormal Distribution in WinBugs

Let's suppose that some data points follow $Lognormal(\mu,\sigma^2)$ and both parameters are unknown . My goal is to obtain the posterior distribution by assigning conjugate prior distributions on ...
0
votes
1answer
457 views

Code Problem in Lognormal Bayesian Model in JAGS/WinBUGS

I have a data set with 853 units. Below, a small sample of it: y ...
1
vote
0answers
66 views

Latent groups in Bayes net with BUGS

I'm modeling a Bayes net with OpenBUGS, and I find problems to specify some of the parameters and their priors. The aim of the model is to identify latent groups in the data from a sample of human ...
0
votes
0answers
183 views

ANOVA with uncertain values - attempt to redefine node

I'm trying to do one-way ANOVA on uncertain (latent) input value YReal[i] (each input value is not exactly known, but it is given as normal distribution with mean ...
7
votes
3answers
509 views

Winbugs and other MCMC without information for prior distribution

What happens when you don't have an idea of the parameters distribution? What approach should we use? Most of the time we aim to undersatnd if a certain variable has any influence over the ...
5
votes
2answers
236 views

First iteration in MCMC coda chain is different from initial values

I have my jags output object. In order to understand how MCMC coda chains work, I tried to see if first iteration in each MCMC chain is equal to the initial values supplied. And it is different! The ...
4
votes
1answer
141 views

Crazy divergence in mixed model - chains start well but go crazy later

I'm trying to compute a mixed model using jags (R2jags) and I got very strange divergence. The chains started so well, very well according to the results expected (also see ...
2
votes
1answer
593 views

Can I get predictions from Winbugs/OpenBUGS?

I am new to WinBUGS and OpenBUGS. I just fit a model to try an example. I was wondering whether I can get predictions generated by WinBUGS/OpenBUGS. If not, are there any convenient ways available ...
4
votes
1answer
103 views

Inferring multiple ratios and binomial proportions with missing data

I have a number of studies describing families tested for a genetic condition. For each study the following data are described: $n_p$, number of probands (the proband is the first person in a family ...
1
vote
1answer
589 views

How does “thin” setting affect the number of samples in WinBUGS?

I do not understander how "thin" setting affects the number of samples in WinBUGS. Here is my case: Case 1: In Model --> Update... -> Update Tool, I set ...
5
votes
1answer
1k views

How to get prediction for a specific variable in WinBUGS?

I am a new user of WinBUGS and have one question for your help. After running the following code, I got parameters of beta0 through ...
0
votes
1answer
530 views
-1
votes
1answer
1k views

WinBUGS error with zero values in binomial distribution: value of order of binomial <expr> must be greater than zero

It seems that WinBUGS has problems if it has only zero draws from one binomial distribution: 1. case - simple model ...