[R] R crashes when communicating with JAGS

Florian Weiler fweiler08 at johnshopkins.it
Mon Aug 30 12:16:47 CEST 2010


Hi again,

I was asked to provide some code. Well, in my case it doesn't really
matter which example I use, so I just write down a very basic and
canned example:

First I create some data:
N <- 1000
x <- rnorm(N, 0, 5)

Then I specify a model in JAGS, storing it in the directory with the
extension .bug:
model {
	for (i in 1:N) {
		x[i] ~ dnorm(mu, tau) ## the model
	}
	mu ~ dnorm(0, .0001) ## uninformative priors
	tau <- pow(sigma, -2)
	sigma ~ dunif(0, 100)
}

Then I call the rjags library and finally I try to run the jags model:
library('rjags')

jags <- jags.model('example.bug',
                   data = list('x' = x,
                               'N' = N))

This is where its always crashing, i.e. I don't get an error message,
but R simply stops working and I have to close and reopen the program.
I don't even start drawing samples from the model, it just crashes the
moment I try to call on JAGS.

Sorry for not providing the example right away,
Florian


On Mon, Aug 30, 2010 at 9:17 AM, Florian Weiler
<fweiler08 at johnshopkins.it> wrote:
> Dear all,
>
> I have a question regarding using JAGS and R. My problem is that every
> single time I want to call JAGS from R the latter crashes (i.e. it
> turns pale and the Windows tells me "R has stopped working".
> Strangely, if there is a mistake in my jags code, this will be
> reported without a crash. Only when the code is right and the model
> should start to run, R stops working. I already tried to use different
> version of R (currently R 2.10.1 and JAGS-2.1.0-1),but to no avail. A
> couple of days ago I even upgraded from Vista to Windows 7, hoping
> this would sort our the problem, but its still exactly the same. Could
> anyone think of a possible solution for this problem?
>
> I worked on other computers using Windows without encountering the
> described problem. However, I am quite new to using JAGS, so I might
> just be missing the obvious.
>
> Thanks for your help and precious time,
> Florian
>



More information about the R-help mailing list