Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion UserManual/src/_output.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ bookdown::gitbook:
before: |
<img src="./nimble-icon.png"
width=100>
<li><a href="./cha-welcome-nimble.html">NIMBLE User Manual, Version 1.4.2</a></li>
<li><a href="./cha-welcome-nimble.html">NIMBLE User Manual, Version 1.4.3</a></li>
<li><a href="https://github.com/nimble-dev/nimble">NIMBLE Development Team</a></li>
<li><a href="https://R-nimble.org">https://R-nimble.org</a></li>
after: |
Expand Down
13 changes: 6 additions & 7 deletions UserManual/src/chapter_MCMC.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -758,17 +758,16 @@ derived_name <- nimbleFunction(
##
## run fuction has one argument:
## timesRan, which is the number of times this method has executed during
## the present MCMC chain,
## including the present time. This can be used as an index for a matrix
## of results.
## the present MCMC chain, including the present time. This can be used
## as an index for a matrix of results.
##
},
methods = list(
set_interval = function(newInterval = double()) {
##
## REQUIRED `set_interval` method, which matches the definition below
## exactly.
## this method is necessary, to allow the default value of 'interval' to
## This method is necessary, to allow the default value of 'interval' to
## match the thinning interval of the MCMC.
##
interval <<- newInterval
Expand All @@ -777,7 +776,7 @@ derived_name <- nimbleFunction(
before_chain = function(niter = double(), nburnin = double(),
thin = double(1), chain = double()) {
##
## (optional) `before_chain` method,
## (optional) `before_chain` method:
## must have must have these arguments specifications:
## - niter (total number of *post-burnin* MCMC iterations)
## - nburnin (number of burnin iterations for this MCMC chain)
Expand All @@ -788,7 +787,7 @@ derived_name <- nimbleFunction(
},
after_chain = function() {
##
## (optional) `after_chain` method,
## (optional) `after_chain` method:
## no arguments and no return value
##
},
Expand All @@ -808,7 +807,7 @@ derived_name <- nimbleFunction(
},
reset = function() {
##
## (optional) `reset` method
## (optional) `reset` method:
## no arguments and no return value
##
}
Expand Down
2 changes: 1 addition & 1 deletion UserManual/src/title.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
\vspace{0.2in}
{\large NIMBLE Development Team}\\
\vspace{0.2in}
{\large Version 1.4.2}\\
{\large Version 1.4.3}\\
\vspace{3in}
\includegraphics[width=1.5in]{../nimble-icon.png}\\
{\large
Expand Down
4 changes: 2 additions & 2 deletions packages/nimble/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Description: A system for writing hierarchical statistical models largely
one can use 'NIMBLE' for writing arbitrary other kinds of model-generic
algorithms as well. A full User Manual is available at <https://r-nimble.org>.
Version: 1.4.3
Date: 2026-05-01
Date: 2026-08-21
Maintainer: Christopher Paciorek <paciorek@stat.berkeley.edu>
Authors@R: c(
person("Perry", "de Valpine", role = "aut"),
Expand Down Expand Up @@ -153,4 +153,4 @@ Collate:
registration.R
nimble-package.r
zzz.R
RoxygenNote: 7.3.2
RoxygenNote: 7.3.3
6 changes: 3 additions & 3 deletions packages/nimble/INSTALL
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
You can install NIMBLE as an R package from CRAN in the usual way.

You can install from the source file using
R CMD INSTALL nimble_1.4.2.tar.gz
R CMD INSTALL nimble_1.4.3.tar.gz
or
install.packages("nimble_1.4.2.tar.gz", repos = NULL)
install.packages("nimble_1.4.3.tar.gz", repos = NULL)

You can also install the package directly from the NIMBLE repository
install.packages("nimble", repos = "https://r-nimble.org")
Expand All @@ -21,7 +21,7 @@ i.e. not Windows.
By default, we will use the Eigen distribution included with the package.

We can specify any or all of these with
R CMD INSTALL nimble_1.4.2.tar.gz --configure-args="--enable-dylib=true --with-eigen=/Users/duncan/local"
R CMD INSTALL nimble_1.4.3.tar.gz --configure-args="--enable-dylib=true --with-eigen=/Users/duncan/local"
or
install.packages("nimble", configure.args = "--enable-dylib=true --with-eigen=/Users/duncan/local")

Expand Down
4 changes: 3 additions & 1 deletion packages/nimble/R/BUGS_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,9 @@ Details: The upward search for dependent nodes propagates through deterministic
if(self) { # The C++ call does *not* return self nodes
nodeFunIDs <- unique(modelDef$maps$vertexID_2_nodeID[ nodeIDs ])
parentIDs <- sort(c(parentIDs, nodeFunIDs))
}
} else parentIDs <- setdiff(parentIDs, nodeIDs)


if(!includeRHSonly) parentIDs <- parentIDs[modelDef$maps$types[parentIDs] != 'RHSonly']
if(determOnly) parentIDs <- parentIDs[modelDef$maps$types[parentIDs] == 'determ']
if(stochOnly) parentIDs <- parentIDs[modelDef$maps$types[parentIDs] == 'stoch']
Expand Down
2 changes: 2 additions & 0 deletions packages/nimble/R/cppDefs_ADtools.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#'
#' create an ADproxyModelClass object. For internal use.
#'
#' @usage ADproxyModelClass(Rmodel)
#'
#' @param Rmodel The name of an uncompiled model
#'
#' @author NIMBLE development team
Expand Down
2 changes: 2 additions & 0 deletions packages/nimble/R/nimbleFunction_Rexecution.R
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ nimSeq <- function(from, to, by, length.out) { ## this creates default arguments
#'
#' @name setupOutputs
#'
#' @usage setupOutputs(...)
#'
#' @param ... An arbitrary set of names
#'
#' @details
Expand Down
2 changes: 2 additions & 0 deletions packages/nimble/R/nimbleList_core.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ nimbleListBase <- setRefClass(Class = 'nimbleListBase',
#'
#' Create a nimbleType object, with information on the name, type, and dimension of an object to be placed in a \code{\link{nimbleList}}.
#'
#' @usage nimbleType(name, type, dim = NA)
#'
#' @param name The name of the object, given as a character string.
#' @param type The type of the object, given as a character string.
#' @param dim The dimension of the object, given as an integer. This can be left blank if the object is a nimbleList.
Expand Down
37 changes: 16 additions & 21 deletions packages/nimble/R/setupMargNodes.R
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,19 @@
#' \code{calcNodes}. Such deterministic nodes will be included in
#' calculations automatically when needed.
#'
#' If \code{randomEffectsNodes} is missing, the default is a bit complicated: it
#' includes all latent nodes that are descendants (or "downstream") of
#' \code{paramNodes} (if provided) and are either (i) ancestors (or
#' "upstream") of data nodes (if \code{calcNodes} is missing), or (ii)
#' ancestors or elements of \code{calcNodes} (if \code{calcNodes} and
#' \code{paramNodes} are provided), or (iii) elements of \code{calcNodes} (if
#' \code{calcNodes} is provided but \code{paramNodes} is missing). In all
#' cases, discrete nodes (with warning if \code{check=TRUE}), posterior
#' predictive nodes and \code{paramNodes} are excluded.
#' If \code{randomEffectsNodes} is missing, the default is a bit complicated.
#' It starts by considering all latent nodes as potential \code{randomEffectsNodes}.
#' If \code{paramNodes} is provided, only latent nodes that are downstream of
#' \code{paramNodes} are included in the potential nodes.
#' Then the set of potential nodes is filtered to
#' include only nodes that satisfy one of the following conditions
#' (only one of which will be applicable): (i) parents of data nodes
#' (applies only if calcNodes is missing), (ii) parents or elements of
#' \code{calcNodes} (applies only if \code{calcNodes} and \code{paramNodes}
#' are both provided), (iii) elements of calcNodes (applies if \code{calcNodes}
#' is provided but \code{paramNodes} is missing). In all
#' cases, discrete nodes (with warning if \code{check=TRUE}), posterior
#' predictive nodes and \code{paramNodes} are excluded.
#'
#' \code{randomEffectsNodes} should only include stochastic nodes.
#'
Expand Down Expand Up @@ -234,8 +238,6 @@ setupMargNodes <- function(model, paramNodes, randomEffectsNodes, calcNodes,
} else {
nodesToFindParentsFrom <- randomEffectsNodes
paramNodes <- model$getParents(nodesToFindParentsFrom, self=FALSE, stochOnly=TRUE)
# self=FALSE doesn't omit if one RE node is a parent of another, so we have to do the next step
paramNodes <- setdiff(paramNodes, nodesToFindParentsFrom)
}
if(paramsHandled) {
if(calcProvided) paramNodes <- setdiff(paramNodes, calcNodes)
Expand Down Expand Up @@ -283,21 +285,18 @@ setupMargNodes <- function(model, paramNodes, randomEffectsNodes, calcNodes,
tempDataNodesDefault <- model$getNodeNames(dataOnly = TRUE)
if(paramsHandled)
tempDataNodesDefault <- setdiff(tempDataNodesDefault, paramNodes)
tempDataNodesDefaultParents <- model$getParents(tempDataNodesDefault, upstream = TRUE, stochOnly = TRUE)
# See comment above about why this is necessary:
tempDataNodesDefaultParents <- setdiff(tempDataNodesDefaultParents, tempDataNodesDefault)
tempDataNodesDefaultParents <- model$getParents(tempDataNodesDefault, upstream = TRUE, stochOnly = TRUE,
self = FALSE)
reNodesDefault <- intersect(reNodesDefault, tempDataNodesDefaultParents)
} else {
# Update reNodesDefault to exclude nodes that lack downstream connection to a calcNode
if(paramsHandled) { # This means reProvided OR paramsProvided. Including parents allows checking
# of potentially missing REs.
reNodesDefault <- intersect(reNodesDefault,
model$getParents(calcNodes, upstream=TRUE, stochOnly = TRUE))
model$getParents(calcNodes, upstream=TRUE, stochOnly = TRUE, self = TRUE))
} else { # This means !paramsHandled and hence !reProvided AND !paramsProvided
reNodesDefault <- intersect(reNodesDefault,
calcNodes)
reNodesDefault <- intersect(reNodesDefault,
model$getParents(calcNodes, upstream=TRUE, stochOnly = TRUE))
}
}
}
Expand All @@ -306,8 +305,6 @@ setupMargNodes <- function(model, paramNodes, randomEffectsNodes, calcNodes,
# and are now ready to create default paramNodes
if(!paramsHandled) {
paramNodes <- model$getParents(reNodesDefault, self=FALSE, stochOnly=TRUE)
# See comment above about why this is necessary:
paramNodes <- setdiff(paramNodes, reNodesDefault)
if(calcOtherProvided) paramNodes <- setdiff(paramNodes, calcNodesOther)
}

Expand Down Expand Up @@ -414,8 +411,6 @@ setupMargNodes <- function(model, paramNodes, randomEffectsNodes, calcNodes,
if(!paramProvided) {
possibleNewParamNodes <- model$getParents(calcNodes, self=FALSE, stochOnly=TRUE, includeData=FALSE)
# includeData=FALSE as data nodes cannot be parameters
# self=FALSE doesn't omit if one node is a parent of another, so we have to do the next step
possibleNewParamNodes <- setdiff(possibleNewParamNodes, calcNodesDefault)
paramNodes <- unique(c(paramNodes, possibleNewParamNodes))
}

Expand Down
3 changes: 3 additions & 0 deletions packages/nimble/man/ADproxyModelClass-class.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/nimble/man/nimbleType-class.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 4 additions & 7 deletions packages/nimble/man/samplers.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 13 additions & 9 deletions packages/nimble/man/setupMargNodes.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/nimble/man/setupOutputs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions packages/nimble/tests/testthat/test-getDependencies.R
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,12 @@ test_that("getParents works in model with no criss-crossing dependencies", {

expect_identical(m1$getParents("f1"), c("a1", "a2", "c2", "c4", "c3"))
expect_identical(m1$getParents("f1", immediateOnly = TRUE), c("c4", "c3"))
expect_identical(m1$getParents(c("f1", "g1"), stochOnly = TRUE), c("a1", "a2", "f1"))
expect_identical(m1$getParents(c("f1", "g1"), immediateOnly = TRUE), c("c4", "c3", "f1"))
expect_identical(m1$getParents(c("g1", "f1"), stochOnly = TRUE), c("a1", "a2", "f1"))
expect_identical(m1$getParents(c("f1", "g1"), stochOnly = TRUE), c("a1", "a2"))
expect_identical(m1$getParents(c("f1", "g1"), immediateOnly = TRUE), c("c4", "c3"))
expect_identical(m1$getParents(c("g1", "f1"), stochOnly = TRUE), c("a1", "a2"))
expect_identical(m1$getParents(c("f1", "g1"), stochOnly = TRUE, self = TRUE), c("a1", "a2", "f1", "g1"))
expect_identical(m1$getParents(c("c3", "c2", "e1"), stochOnly = FALSE), c("a1", "c2", "c3"))
expect_identical(m1$getParents(c("c3", "c2", "e1"), immediateOnly = TRUE, stochOnly = FALSE), c("a1", "c2", "c3"))
expect_identical(m1$getParents(c("c3", "c2", "e1"), stochOnly = FALSE), c("a1"))
expect_identical(m1$getParents(c("c3", "c2", "e1"), immediateOnly = TRUE, stochOnly = FALSE), c("a1"))
expect_identical(m1$getParents("h1", includeRHSonly = TRUE, stochOnly = FALSE), c("lho"))
})

Expand Down
Loading
Loading