[R] R crashes when communicating with JAGS

Ben Bolker bbolker at gmail.com
Tue Aug 31 01:38:15 CEST 2010


Florian Weiler <fweiler08 <at> johnshopkins.it> writes:

> 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.
> 

[snip]

> > 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.

  This sort of thing is unfortunately really hard to debug remotely.
  Is it feasible to upgrade to the latest release of R (2.11.1), JAGS, and
rjags, just to rule that out as a possibility?  You said you had
used other Windows machines where it worked -- do they have
similar configurations?  Can you try to look for differences in the
configurations?  Do you get any messages at all from JAGS before
the program stops (I get

Compiling model graph
   Resolving undeclared variables
   Allocating nodes
   Graph Size: 1009

  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100%

: does any of this appear before R crashes)?



More information about the R-help mailing list