- using R version 4.5.3 (2026-03-11)
- using platform: x86_64-pc-linux-gnu
- R was compiled by
gcc-15 (Debian 15.2.0-16) 15.2.0
GNU Fortran (Debian 15.2.0-16) 15.2.0
- running under: Debian GNU/Linux forky/sid
- using session charset: UTF-8
- checking for file ‘R2jags/DESCRIPTION’ ... OK
- this is package ‘R2jags’ version ‘0.8-9’
- checking package namespace information ... OK
- checking package dependencies ... OK
- checking if this is a source package ... OK
- checking if there is a namespace ... OK
- checking for executable files ... OK
- checking for hidden files and directories ... OK
- checking for portable file names ... OK
- checking for sufficient/correct file permissions ... OK
- checking serialization versions ... OK
- checking whether package ‘R2jags’ can be installed ... OK
See the install log for details.
- checking package directory ... OK
- checking for future file timestamps ... OK
- checking DESCRIPTION meta-information ... OK
- checking top-level files ... OK
- checking for left-over files ... OK
- checking index information ... OK
- checking package subdirectories ... OK
- checking code files for non-ASCII characters ... OK
- checking R files for syntax errors ... OK
- checking whether the package can be loaded ... [1s/1s] OK
- checking whether the package can be loaded with stated dependencies ... [1s/1s] OK
- checking whether the package can be unloaded cleanly ... [1s/1s] OK
- checking whether the namespace can be loaded with stated dependencies ... [0s/1s] OK
- checking whether the namespace can be unloaded cleanly ... [1s/1s] OK
- checking loading without being on the library search path ... [1s/1s] OK
- checking use of S3 registration ... OK
- checking dependencies in R code ... OK
- checking S3 generic/method consistency ... OK
- checking replacement functions ... OK
- checking foreign function calls ... OK
- checking R code for possible problems ... [8s/10s] OK
- checking Rd files ... [0s/1s] OK
- checking Rd metadata ... OK
- checking Rd line widths ... OK
- checking Rd cross-references ... OK
- checking for missing documentation entries ... OK
- checking for code/documentation mismatches ... OK
- checking Rd \usage sections ... OK
- checking Rd contents ... OK
- checking for unstated dependencies in examples ... OK
- checking examples ... [2s/3s] ERROR
Running examples in ‘R2jags-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: jags
> ### Title: Run 'JAGS' from R
> ### Aliases: rjags-class rjags.parallel-class jags jags2 jags.parallel
> ### Keywords: interface models
>
> ### ** Examples
>
> # An example model file is given in:
> model.file <- system.file(package="R2jags", "model", "schools.txt")
> # Let's take a look:
> file.show(model.file)
# Bugs model file for 8 schools analysis from Section 5.5 of "Bayesian Data
# Analysis". Save this into the file "schools.bug" in your R working directory.
model {
for (j in 1:J){ # J=8, the number of schools
y[j] ~ dnorm (theta[j], tau.y[j]) # data model: the likelihood
tau.y[j] <- pow(sd[j], -2) # tau = 1/sigma^2
}
for (j in 1:J){
theta[j] ~ dnorm (mu, tau) # hierarchical model for theta
}
tau <- pow(sigma, -2) # tau = 1/sigma^2
mu ~ dnorm (0.0, 1.0E-6) # noninformative prior on mu
sigma ~ dunif (0, 1000) # noninformative prior on sigma
}
> # you can also write BUGS model as a R function, see below:
>
> #=================#
> # initialization #
> #=================#
>
> # data
> J <- 8.0
> y <- c(28.4,7.9,-2.8,6.8,-0.6,0.6,18.0,12.2)
> sd <- c(14.9,10.2,16.3,11.0,9.4,11.4,10.4,17.6)
>
>
> jags.data <- list("y","sd","J")
> jags.params <- c("mu","sigma","theta")
> jags.inits <- function(){
+ list("mu"=rnorm(1),"sigma"=runif(1),"theta"=rnorm(J))
+ }
>
> ## You can input data in 4 ways
> ## 1) data as list of character
> jagsfit <- jags(data=list("y","sd","J"), inits=jags.inits, jags.params,
+ n.iter=10, model.file=model.file)
module glm loaded
Compiling model graph
Resolving undeclared variables
Allocating nodes
Graph information:
Observed stochastic nodes: 8
Unobserved stochastic nodes: 10
Total graph size: 41
Initializing model
>
> ## 2) data as character vector of names
> jagsfit <- jags(data=c("y","sd","J"), inits=jags.inits, jags.params,
+ n.iter=10, model.file=model.file)
Compiling model graph
Resolving undeclared variables
Allocating nodes
Graph information:
Observed stochastic nodes: 8
Unobserved stochastic nodes: 10
Total graph size: 41
Initializing model
>
> ## 3) data as named list
> jagsfit <- jags(data=list(y=y,sd=sd,J=J), inits=jags.inits, jags.params,
+ n.iter=10, model.file=model.file)
Compiling model graph
Resolving undeclared variables
Allocating nodes
Graph information:
Observed stochastic nodes: 8
Unobserved stochastic nodes: 10
Total graph size: 41
Initializing model
>
> ## 4) data as a file
> fn <- "tmpbugsdata.txt"
> dump(c("y","sd","J"), file=fn)
> jagsfit <- jags(data=fn, inits=jags.inits, jags.params,
+ n.iter=10, model.file=model.file)
Compiling model graph
Resolving undeclared variables
Allocating nodes
Graph information:
Observed stochastic nodes: 8
Unobserved stochastic nodes: 10
Total graph size: 41
Initializing model
> unlink("tmpbugsdata.txt")
>
> ## You can write bugs model in R as a function
>
> schoolsmodel <- function() {
+ for (j in 1:J){ # J=8, the number of schools
+ y[j] ~ dnorm (theta[j], tau.y[j]) # data model: the likelihood
+ tau.y[j] <- pow(sd[j], -2) # tau = 1/sigma^2
+ }
+ for (j in 1:J){
+ theta[j] ~ dnorm (mu, tau) # hierarchical model for theta
+ }
+ tau <- pow(sigma, -2) # tau = 1/sigma^2
+ mu ~ dnorm (0.0, 1.0E-6) # noninformative prior on mu
+ sigma ~ dunif (0, 1000) # noninformative prior on sigma
+ }
>
> jagsfit <- jags(data=jags.data, inits=jags.inits, jags.params,
+ n.iter=10, model.file=schoolsmodel)
Compiling model graph
Resolving undeclared variables
Allocating nodes
Graph information:
Observed stochastic nodes: 8
Unobserved stochastic nodes: 10
Total graph size: 41
Initializing model
>
>
> #===============================#
> # RUN jags and postprocessing #
> #===============================#
> jagsfit <- jags(data=jags.data, inits=jags.inits, jags.params,
+ n.iter=5000, model.file=model.file)
Compiling model graph
Resolving undeclared variables
Allocating nodes
Graph information:
Observed stochastic nodes: 8
Unobserved stochastic nodes: 10
Total graph size: 41
Initializing model
>
> # Can also compute the DIC using pD (=Dbar-Dhat), via dic.samples(), which
> # is a closer approximation to the original formulation of Spiegelhalter et
> # al (2002), instead of pV (=var(deviance)/2), which is the default in JAGS
> jagsfit.pD <- jags(data=jags.data, inits=jags.inits, jags.params,
+ n.iter=5000, model.file=model.file, pD=TRUE)
Compiling model graph
Resolving undeclared variables
Allocating nodes
Graph information:
Observed stochastic nodes: 8
Unobserved stochastic nodes: 10
Total graph size: 41
Initializing model
>
> # Run jags parallely, no progress bar. R may be frozen for a while,
> # Be patient. Currenlty update afterward does not run parallelly
> #
> jagsfit.p <- jags.parallel(data=jags.data, inits=jags.inits, jags.params,
+ n.iter=5000, model.file=model.file)
Error in serverSocket(port = port) :
creation of server socket failed: port 11390 cannot be opened
Calls: jags.parallel -> makeCluster -> makePSOCKcluster -> serverSocket
Execution halted
- checking for unstated dependencies in ‘tests’ ... OK
- checking tests ... [2s/5s] OK
Running ‘testthat.R’ [1s/4s]
- checking PDF version of manual ... [4s/7s] OK
- checking HTML version of manual ... [0s/1s] OK
- checking for non-standard things in the check directory ... OK
- DONE
Status: 1 ERROR