CRAN Package Check Results for Package R2jags

Last updated on 2015-03-07 03:50:17.

Flavor Version Tinstall Tcheck Ttotal Status Flags
r-devel-linux-x86_64-debian-clang 0.05-03 1.15 16.10 17.25 OK
r-devel-linux-x86_64-debian-gcc 0.05-03 0.78 15.68 16.46 OK
r-devel-linux-x86_64-fedora-clang 0.05-03 22.76 OK
r-devel-linux-x86_64-fedora-gcc 0.05-03 29.83 OK
r-devel-osx-x86_64-clang 0.05-03 20.67 OK
r-devel-windows-ix86+x86_64 0.05-03 7.00 40.00 47.00 OK
r-patched-linux-x86_64 0.05-01 1.18 17.38 18.56 ERROR
r-patched-solaris-sparc 0.05-03 236.30 OK
r-patched-solaris-x86 0.05-03 55.40 OK
r-release-linux-ix86 0.05-01 1.49 29.22 30.71 OK
r-release-linux-x86_64 0.05-03 1.16 20.24 21.40 OK
r-release-osx-x86_64-mavericks 0.05-03 OK
r-release-osx-x86_64-snowleopard 0.05-03 OK
r-release-windows-ix86+x86_64 0.05-03 6.00 39.00 45.00 OK
r-oldrel-windows-ix86+x86_64 0.05-03 7.00 48.00 55.00 OK

Check Details

Version: 0.05-01
Check: S3 generic/method consistency
Result: WARN
    as.mcmc:
     function(x, ...)
    as.mcmc.rjags:
     function(x)
    
    See section ‘Generic functions and methods’ in the ‘Writing R
    Extensions’ manual.
Flavor: r-patched-linux-x86_64

Version: 0.05-01
Check: examples
Result: ERROR
    Running examples in ‘R2jags-Ex.R’ failed
    The error most likely occurred in:
    
    > ### 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 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 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 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 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 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 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)
    >
    > # display the output
    > print(jagsfit)
    Inference for Bugs model at "/home/hornik/tmp/R.check/r-patched-gcc/Work/build/Packages/R2jags/model/schools.txt", fit using jags,
     3 chains, each with 5000 iterations (first 2500 discarded), n.thin = 2
     n.sims = 3750 iterations saved
     mu.vect sd.vect 2.5% 25% 50% 75% 97.5% Rhat n.eff
    mu 8.152 5.758 -2.402 4.782 8.123 11.684 18.843 1.006 3800
    sigma 6.946 8.506 0.121 2.036 4.816 8.909 27.031 1.024 1000
    theta[1] 11.657 8.434 -1.582 6.264 10.697 15.592 32.736 1.005 1100
    theta[2] 8.047 6.447 -4.497 3.924 8.116 12.340 20.777 1.002 1900
    theta[3] 6.443 7.946 -12.259 2.266 7.039 11.456 20.704 1.001 3800
    theta[4] 7.839 6.530 -5.680 3.655 7.948 12.110 20.943 1.002 1200
    theta[5] 5.574 6.539 -8.848 1.522 6.118 10.238 16.579 1.001 3800
    theta[6] 6.265 6.941 -9.818 2.241 6.815 11.042 18.387 1.001 3800
    theta[7] 10.768 6.857 -1.066 6.081 10.423 14.616 26.819 1.002 1800
    theta[8] 8.814 8.041 -6.543 4.286 8.743 13.002 26.510 1.002 1600
    deviance 60.496 2.152 57.150 59.205 60.100 61.447 65.919 1.004 640
    
    For each parameter, n.eff is a crude measure of effective sample size,
    and Rhat is the potential scale reduction factor (at convergence, Rhat=1).
    
    DIC info (using the rule, pD = var(deviance)/2)
    pD = 2.3 and DIC = 62.8
    DIC is an estimate of expected predictive error (lower deviance is better).
    > plot(jagsfit)
    >
    > # traceplot
    > traceplot(jagsfit.p)
    > traceplot(jagsfit)
    >
    > # or to use some plots in coda
    > # use as.mcmmc to convert rjags object into mcmc.list
    > jagsfit.mcmc <- as.mcmc(jagsfit.p)
    > jagsfit.mcmc <- as.mcmc(jagsfit)
    > ## now we can use the plotting methods from coda
    > xyplot(jagsfit.mcmc)
    Error: could not find function "xyplot"
    Execution halted
Flavor: r-patched-linux-x86_64