inst/classic-bugs/R/Rcheck.R

library(rjags, quietly=TRUE)

read.jagsdata <- function(file)
{
  e <- new.env()
  eval(parse(file), e)
  return(as.list(e))
}

check.fun <- function() {
   checkstats <- summary(x)$statistics
   if (is.matrix(benchstats)) {
     rnb <- order(rownames(benchstats))
     rnc <- order(rownames(checkstats))
     z <- (benchstats[rnb,1] - checkstats[rnc,1])
     z <- ifelse(z==0, 0, z/benchstats[rnb,2])
   } else {
     z <- (benchstats[1] - checkstats[1])
     z <- ifelse(z==0, 0, z/benchstats[2])
   }
   print(z)
   if (any(abs(z) > 0.15)) {
     stop("FAIL")
     quit(save="no", status=1)
   } else {
     cat("OK\n")
   }
}

Try the nimble package in your browser

Any scripts or data that you put into this service are public.

nimble documentation built on July 9, 2023, 5:24 p.m.