./math/R-nimble, MCMC, Particle Filtering, and Programmable Hierarchical Modeling

[ CVSweb ] [ Homepage ] [ RSS ] [ Required by ] [ Add to tracker ]


Branch: CURRENT, Version: 1.2.1, Package name: R-nimble-1.2.1, Maintainer: pkgsrc-users

A system for writing hierarchical statistical models largely
compatible with 'BUGS' and 'JAGS', writing nimbleFunctions to operate
models and do basic R-style math, and compiling both models and
nimbleFunctions via custom- generated C++. 'NIMBLE' includes default
methods for MCMC, particle filtering, Monte Carlo Expectation
Maximization, and some other tools. The nimbleFunction system makes it
easy to do things like implement new MCMC samplers from R, customize
the assignment of samplers to different parts of a model from R, and
compile the new samplers automatically via C++ alongside the samplers
'NIMBLE' provides. 'NIMBLE' extends the 'BUGS'/'JAGS' language by
making it extensible: New distributions and functions can be added,
including as calls to external compiled code. Although most people
think of MCMC as the main goal of the 'BUGS'/'JAGS' language for
writing models, 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>.


Master sites: (Expand)


Version history: (Expand)


CVS history: (Expand)


   2023-06-17 14:41:54 by Makoto Fujiwara | Files touched by this commit (2)
Log message:
(math/R-nimble) Updated 1.0.0 to 1.0.1

#                            CHANGES IN VERSION 1.0.1 (June 2023)

## USER LEVEL CHANGES

- Fix bug (introduced in v. 1.0.0) causing incorrect setting of 'data'
flag for models with variables containing a mix of data nodes and nodes
appearing only on the right-hand side of expressions, for cases where not
all elements of the variable are defined (such as capture-recapture
models). This also addresses an unanticipated change in behavior in
initializing right-hand side only nodes from the `data` argument (PR #1328).

- Improved error trapping in MCMC sampler for categorical distributions
(PR #1325).
   2023-06-11 05:24:46 by Makoto Fujiwara | Files touched by this commit (2)
Log message:
(math/R-nimble) Updated 0.13.1 to 1.0.0

#                            CHANGES IN VERSION 1.0.0 (May 2023)

This release introduces tools for automatic differentiation in NIMBLE.

## USER LEVEL CHANGES

- Add tools for automatic differentiation. Functionality includes:

    -- The ability to differentiate nimbleFunctions with respect
    to input arguments in a flexible way.

    -- The ability to differentiate `model$calculate()` calls
    with respect to model node elements.

    -- Functionality that enables Hamiltonian Monte Carlo (provided in the
    `nimbleHMC` package).

    -- A parameter transformation system to work in unconstrained parameter
    spaces when model parameters have constrained domains.

- Add Laplace approximation algorithm, allowing a user to approximate
the marginal likelihood (integration/marginalizing over random effects/
latent process values) and find the MLE.

- Improve aspects of WAIC (PR #1256):

    -- Provide aggregate and per-chain WAIC when `perChainWAIC` is `TRUE`.

    -- Report number of `pWAIC` values greater than 0.4.

    -- Warn user if WAIC is enabled but not set to `TRUE` in `runMCMC`.

    -- Improve clarity in `help(WAIC)`.

- Reduce the default adaptation interval for the `AF_slice` sampler to 200.

- Improved control of `addSampler` method of MCMC
configuration objects (PR #1293):

    -- `expandTarget` argument controls whether nodes specified in
       `target` undergo expansion via `expandNodeNames`, adding a
       separate sampler instance for each resulting node.

    -- When `expandTarget = TRUE`, the `scalarComponents` argument is
       passed as the `returnScalarComponents` argument to `expandNodeNames`.

    -- Removed `nodes` argument as redundant.  Target nodes are
       uniquely specified using the `target` argument.

- Improve handling of resetting of scale when `adaptive=FALSE` (PR #1275).

- Allow `dcat` to have a `prob` vector of length 1 (PR #1251).

- Add error trapping for MCMC `thin` argument not positive and integer-valued
(PR #1250).

- Enhance discussion of MCMC initialization in the User Manual (issue #1247).

- Enhance discussion of indexing in loops and variables in User Manual,
including differences from JAGS.

- Rework language in `help(buildMCMC)` to improve clarity.

- Add information on predefined nimbleLists to the User Manual.

- Improve error message when user-defined distribution has incorrect dimension
for `x`.

- Improve error message when mistakenly using `T()` in deterministic rather than
  stochastic model declaration.

- Improve error-trapping when a loop index is incorrectly used in indexing
a block of a variable (PR #1289).

- Error trap use of reduction operations on scalars (PR #1281).

- Error trap some cases of incorrect return type in user-defined simulation
('r') functions (PR #1280).

- Error trap case where a variable name is also used as a loop index variable
(PR #1278).

- Error trap setting deterministic nodes as data in `setData` (PR #1269).

- Better error trap of wrong size/dimensions of in `setInits` (PR #1260).

- Export `clearCompiled`, allowing users to clear compiled objects and unload
the shared library produced during nimble's compilation process (on non-Windows
operating systems).

## BUG FIXES

- Fix bug producing integer overflow in `getDependencyPathCountOneNode`
and improve efficiency of checking maximum number of paths in conjugacy
checking (PR #1322).

- Fix long-standing memory leak in `dinvwish_chol` (PR #1320).

- Fix bug giving incorrect results for `runCrossValidate`, when using the
default MSE loss function and any user-defined loss functions,
but not the 'predictive' loss function. Also, calculate loss when using
the predictive loss using the compiled model rather than the uncompiled model.
(PRs #1298, #1299).

- Fix bug in conjugacy checking that caused incorrect identification of
conjugate relationships with subsets and supersets of multivariate nodes,
as well as inconsistent slices of multivariate nodes (PR #1290).

- Fix `runMCMC` to reset the WAIC state when rerun (PR #1256).

- Fix reset mechanism for WAIC so that one can get WAIC from all the samples
in a chain that is created by multiple calls to the MCMC `$run` method even
when `getWAIC` is called in the middle (PR #1310).

- Fix bug affecting `d=2` case in uncompiled `RW_lkj_corr_cholesky` sampler
(PR #1273).

- Fix aliasing issue arising in assignment operations such as
`nf$a <- nf$a[1:3]` (PR 1301).

- Fix assignment into a block of a model variable (PR #1300).

- Fix compilation error when using `nimSeq` with integers (PR #1282).

- Fix scoping of argument evaluation for `replaceSamplers` method (PR #1287).

- Fix a corner case where particular indexing in model code prevents model
building (PR #1279).

- Fix handling of right-hand side only nodes so not flagged as deterministic
(issue #1269).

- Error trap and fix a bug in handling particular cases in list-like subsetting
(PR #1259).

- Make optimDefaultControlList handle default values completely and with
  consistent compiled and uncompiled behavior.

- make nimOptim respect parscale control parameter.

- Update manual installation chapter and `INSTALL` links to gfortran on MacOS.

## DEVELOPER LEVEL CHANGES

- Take `nimbleCppADbaseClass` out of `libnimble.a` and instead make a
session-specific .o file from it to address AD-related crashes on some OSes. (PR
#1318)

- Remove `nimOptim_model` functionality. This fixes build warning on MacOS
  involving `nimOptim` (PR #1276).

- Update `Eigen` copyright dates.

- Fix invisible return of `NULL` in nimbleFunctions without explicit return
statements (PR #1254).

- Fix inconsistent use of offset in internal conversion functions (PR #1277).

- Remove references to unsupported `trace` (issue #1262).

#                            CHANGES IN VERSION 0.13.2 (May 2023)

## DEVELOPER LEVEL CHANGES

- Remove code triggering Windows warnings about writing bytes into region of
  size 0 by modifying `setLength`.

- Remove use of C++11 standard, per CRAN requirements. As part of this, replace
  use of `std::ptr_fun` (PR #1292).
   2023-03-11 11:05:26 by Makoto Fujiwara | Files touched by this commit (2) | Package updated
Log message:
(math/R-nimble)  Updated 0.12.2 to 0.13.1

(From: nimble/inst/NEWS.md)
#                            CHANGES IN VERSION 0.13.1 (December 2022)

## BUG FIXES

- Fix bug in MCMC sampler inclusion/exclusion of predictive nodes from
  target node dependencies (PR #1248).

#                            CHANGES IN VERSION 0.13.0 (November 2022)

## USER LEVEL CHANGES

- Thoroughly revamp handling of predictive nodes in MCMC sampling. If MCMC
results identical to previous versions of NIMBLE are needed in models with
posterior predictive nodes, set
`nimbleOptions(MCMCusePredictiveDependenciesInCalculations = TRUE)`
and `nimbleOptions(MCMCorderPosteriorPredictiveSamplersLast = FALSE)`.

    -- MCMC samplers, by default, will now exclude predictive dependencies
    from internal sampler calculations.  This can be reverted to the old behavior
    of including predictive dependencies in calculations using
    `nimbleOptions(MCMCusePredictiveDependenciesInCalculations = TRUE)`.

    -- At the time of `buildMCMC`, all `posterior_predictive` samplers are
    automatically reordered to operate last among all samplers. Doing so,
    posterior predictive samples are generated conditional on the other values
    in the MCMC sample.  This reordering can be disabled using
    `nimbleOptions(MCMCorderPosteriorPredictiveSamplersLast = FALSE)`
    (but doing so without also setting
    `nimbleOptions(MCMCusePredictiveDependenciesInCalculations = TRUE)` could
    result in samples that are invalid in terms of the joint posterior
    distribution (but with valid samples marginally).

    -- Removal of the `posterior_predictive_branch` sampler.  Filling the same
    role, the `posterior_predictive` sampler now updates all nodes downstream
    of its `target` node.  Assignment of the `posterior_predictive` sampler
    happens automatically during MCMC configuration, unless
    `nimbleOptions(MCMCusePosteriorPredictiveSampler = FALSE)`.

    -- Automatic determination of "predictive" model nodes, which are all
    stochastic non-data nodes that have no data nodes anywhere in their
    downstream dependencies. Tracking of predictive nodes is done
    automatically, but maybe be disabled using
    `nimbleOptions(determinePredictiveNodesInModel = FALSE)`.

    -- New arguments `includePredictive` (default value `TRUE`) and
    `predictiveOnly` (default value `FALSE`), for both the `getNodeNames`
    and the `getDependencies` methods of model objects.  These specify whether
    any predictive nodes are included in the results, and whether only
    predictive nodes are included, respectively.

    -- The MCMC configuration object will issue a warning message if there are
    stochastic non-data nodes which will not undergo MCMC sampling.  This
    warning can be disabled using
    `nimbleOptions(MCMCwarnUnsampledStochasticNodes = FALSE)`.

- Add option to WAIC system (via `controlWAIC`) to allow additional burnin (in
addition to standard MCMC burnin) before calculating online WAIC, thereby
allowing inspection of initial samples without forcing them to be used for WAIC
(PR #1244).

- For MCMC configuration `addSampler` method, change name of the
`scalarComponents` argument to `expandComponents` (PR #1215).

- Add new `default` argument for the `addSampler` method of MCMC configuration
objects.  When `default = TRUE`, default samplers (conjugate, or otherwise) will
be added to the specified nodes.  The addition of this argument provides an
entry point to the logic of default sampler determination and assignment,
without creating a new MCMC configuration object (PR #1215).

- Add new `nodes` argument for the `addSampler` method of MCMC configuration
objects.  Nodes specified in `nodes` automatically undergo expansion according
to `expandNodeNames` prior to sampler assignment, allowing for easier assignment
of samplers to multiple nodes (PR #1215).

- `rcar_normal` issues an informative error message when invoked from the R
command line (PR #1243).

- Warn users of unused constants during model building (PR #1242).

- Add `replaceSamplers` method to MCMC configuration objects to simplify
modifying how a node is sampled (PR #1222).

- Convert `NEWS` to Markdown format for proper rendering in browser
(issue #1231).

- Indicate model code that produces warnings about unknown nimbleFunctions
(issue #370).

## BUG FIXES

- Avoid error occurring when a model variable name starts with "logProb"
(PR #1240).

- Avoid error occurring when a model variable is named "i" (PR #1239).

- Prevent infinite recursion in particular cases in conjugacy checking
(PR #1228).

- Fix bug in simulating from `dcar_normal` nodes when multiple nodes passed to
simulate (issue #1238).

- Fix error message about duplicate node declarations (PR #1233).

- Fix another issue with long variable names (PR #1217).

- Fix warning related to `dataNodes` in WAIC.

## DEVELOPER LEVEL CHANGES

- Remove use of bitwise `|` and `&` operators in C++ code, per CRAN request.

- Refactor `nimbleMCMC` to pull out model creation (PR #1223).

- Fix an issue with nested `nimbleList`s on MacOS (PR #1213).
   2022-08-31 20:41:07 by Brook Milligan | Files touched by this commit (1)
Log message:
math/R-nimble: Add tool dependency on gmake.

A library, libnimble.a, is compiled by this package using a Gnu makefile.
Add a tool dependency on gmake to avoid syntax errors.
   2022-04-28 17:52:38 by Makoto Fujiwara | Files touched by this commit (2)
Log message:
(math/R-nimble) Updated 0.11.1 to 0.12.2, NEWS.md unknown
   2021-10-26 12:56:13 by Nia Alarie | Files touched by this commit (458)
Log message:
math: Replace RMD160 checksums with BLAKE2s checksums

All checksums have been double-checked against existing RMD160 and
SHA512 hashes
   2021-10-07 16:28:36 by Nia Alarie | Files touched by this commit (458)
Log message:
math: Remove SHA1 hashes for distfiles
   2021-09-18 05:53:43 by Makoto Fujiwara | Files touched by this commit (2) | Package updated
Log message:
(math/R-nimble) Updated 0.9.0 to 0.11.1

(from: inst/NEWS)
                            CHANGES IN VERSION 0.11.1 (May 2021)

USER LEVEL CHANGES

-- Add information about categorical sampler and univariate version of ESS
   sampler to `help(samplers)`.

BUG FIXES

-- Fix to the `posterior_predictive_branch` MCMC sampler, to update
   the log-probabilities of the sampled posterior predictive nodes (PR #1127).

                            CHANGES IN VERSION 0.11.0 (April 2021)

USER LEVEL CHANGES

-- Add new `posterior_predictive_branch` MCMC sampler, which is
   automatically assigned to trailing dependency node networks of entirely
   non-data nodes (jointly posterior predictive branches).  This sampler
   simulates jointly from the predictive distribtion of these posterior
   predictive node branches, and is designed to improve MCMC mixing of the
   branch, and consequently of the entire model (PR #1086).

-- Allow use of elliptical slice sampler for univariate nodes, which can be
   useful in multimodal problems (PR #1109).

-- Add a `getParents` method to the model API, allowing one to determine parent
   nodes, analogous to use of `getDependencies` to determine child nodes
   (PR #1094).

-- Add `getConditionallyIndependentSets` method (not yet documented) to the model
   API, allowing one to determine nodes that are conditionally independent of
   each other given parent nodes (PR #1094).

-- Improve efficiency of conjugate samplers by avoiding unneeded calculations
   when a conjugate relationship does not involve shifting or scaling (PR #1087).

-- Allow use of `nimNumeric`, `nimMatrix`, `nimArray` in model code (PR #1096).

-- Add progress bar to `getSamplesDPmeasure` (NCT issue 110).

-- Allow model definition using `if` without `else`, fixing a longstanding
   oversight (PR #1104).

-- Improve warning when multiple nodes provided to `getParam` (PR #1118).

-- Check during model building for unnamed elements of `data` and `inits`
   (PR #1117).

-- Remove error trapping to prevent use of variables in defining node names,
   such as `getDependencies('y[idx]')` as this is hard to check robustly and
   efficiently (PR #1122).

-- Improve error messages when reporting `getParam` cannot calculate a parameter
   when checking a model (PR #1112).

-- Error trap cases where model nodes are defined in two different declarations,
   adding check for overlapping multivariate nodes (PR #1110).

-- Improve error trapping of mis-formed stochastic declarations in models
   (PR #1106).

-- Increase maximum length of compiler output when using
   `compileNimble(..., showCompilerOutput = TRUE)` (NCT issue 205).

-- Point to parallelization example on r-nimble.org in relevant places of manual.

BUG FIXES

-- Fix a bug (issue #1091) causing incorrect node names when having more than
   100,000 elements in a vector node or in a dimension of a multi-dimensional
   node (PR #1092).

-- Fix `getNodeNames` to return no nodes when `latentOnly` is `TRUE` and model
   contains no latent nodes (PR #1116).

-- Fix checking for unknown nimbleFunction methods and improve related error
   trapping (PRs #1107, #1105).

DEVELOPER LEVEL CHANGES

-- Update our testing code/infrastructure to use latest testthat API (PR #1090).

-- Shift internal code to use `model$calculate(...)` style rather than
   `calculate(model, ...)` style for various node functions (PR #1114).

-- Clean up commented out code (PR #1098) and remove unused test files
   (PR #1097).

-- Update to a newer (but not latest) version of Eigen to suppress some compiler
   warnings (PR #1093).

                            CHANGES IN VERSION 0.10.1 (November 2020)

USER LEVEL CHANGES

-- Add `round` argument to `samplesSummary` (PR #1077).

-- `samplesSummary` function (and also `runMCMC(..., summary = TRUE)`) was made
   to be robust against non-valid values in posterior samples array (PR #1075).

BUG FIXES

-- Fix `makeParamInfo` when there is only one declID involved to address a bug
   affecting usage of `getParam`. This bug was introduced in version 0.10.0 when
   reducing memory use of `getParam` (PR #1016). This fixes incorrect behavior
   of conjugate samplers (because of incorrect inputs from `getParam`) under
   certain model structures, in particular state-space style models (PR #1080).

-- Prevent usage of marginal version of WAIC (i.e., when not monitoring all
   direct stochastic parents of data nodes); use of marginal version of WAIC in
   previous versions gave incorrect results (PR #1083).

DEVELOPER LEVEL CHANGES

-- Deprecate `samplerAssignmnentRules` system (PR #1078).

-- Deprecate `autoBlock` MCMC option (PR #1079).

                            CHANGES IN VERSION 0.10.0 (October 2020)

USER LEVEL CHANGES

-- Greatly extend BNP functionality with the CRP (Chinese restaurant process)
   distribution by allowing multiple observations to be grouped together (e.g.,
   for longitudinal or time series data) without requiring they be specified
   as a multivariate node (PR #1033).

-- Add a variety of conjugate cases to BNP conjugate samplers (PR #1033).

-- Greatly improve efficiency of model and MCMC building and configuration for
   BNP-based models with CRP components (PR #1033).

-- Move all sequential Monte Carlo (SMC; aka particle filtering) methods to
   new package `nimbleSMC`, including various particle-filter-based MCMC
   samplers.

-- Prevent use of variables in indexes of nodes, such as `y[idx]`, which was
   incorrectly being evaluated based on R scoping rules (PR #1064).

-- Allow use of `logdet` in model code (Issue #1018).

-- New `resetMV` argument available to `mcmc$run` method. In combination
   with `reset = FALSE`, specifying `resetMV = TRUE` will continue the current
   run of the MCMC, but discard any previously-collected samples
   (PR #1051; thanks to 'DJRP').

-- New methods `setMonitors` and `setMonitors2` added for MCMC configuration
   objects.  These methods replace the current set of monitors (or monitors2)
   with the specified variables (PR #1061).

-- Add `as.list` method for modelValues objects (PR #1060).

-- Update `getSamplesDPmeasure` function to improve efficiency and reduce
   output size; output is now a list of matrices (PR #1059).

-- Add `dimensions` argument to `nimbleMCMC` (PR #1058).

-- Add method `getWidthHistory` to slice sampler to retrieve sampling history
   information (PR #1057; thanks to 'rpatin').

-- Various improvements to the manual.

BUG FIXES

-- Fix a bug in k-fold cross-validation routine (`runCrossValidate`), where
   the merging of MCMC sampler configurations was done incorrectly and causing
   incorrect results (PR #1068).

-- Fix bug giving incorrect `dwish` density when using non-default S
   parameterization (PR #1017).

-- Fix incorrect NaN eigenvalues in singular normalized adjacency matrices
   under `dcar_normal` (PR #1019).

-- Update all MCMC sampler functions to use a new syntax for control list
   element extraction, which prevents a possible bug caused by R's partial
   matching of list names (PR #1065).

-- Define auto-generated simulation ('r') functions for user-defined
   distributions in the global environment to avoid scoping issues (PR #1063).

-- Update user-defined distribution processing so user-defined distributions
   can be defined inside functions (PR #1063).

-- Fix bug preventing use of `dirName` argument to `compileNimble` (PR #1062).

-- Fix a bug preventing model building when there are overly long names of
   model variables resulting from long deterministic expressions in model code
   (PR #1069).

-- Fix `buildMCEM` so it works with a compiled model as argument (PR #1028).

-- Fix `dmvt` so default unnamed parameters work (PR #1027).

-- Fix error in model building in corner case where
   `makeVertexNamesFromIndexArray2` made a simplifying assumption to conclude
   a block of nodes was contiguous (PR #1026).

-- Fix bug in `nimbleRcall` causing run-time warnings when `returnType` is void
   (PR #1013).

DEVELOPER LEVEL CHANGES

-- Improve efficiency of `getParam` implementation, which improves speed for
   MCMC compilation (PR #1016).

-- Improve MCMC sampling efficiency by not copying data nodes, only data node
   logProbs, during sampler execution for various samplers (PR #1040).

-- Update Travis testing to use R 4.0.

-- Remove `GID_map` internal to modelValues (PR #1032).

-- Remove deprecated function `getLoadingNamespace` and (deprecated) use of
   `where=getLoadingNamespace`. Also improve handling of environments set up
   by `nimbleFunction` to make it easier to write packages depending on NIMBLE
   (PRs #1029, 1011).

-- Force intermediates of index range expressions to be of type 'int' for use
   in AD (PR #1024).

                            CHANGES IN VERSION 0.9.1 (May 2020)

USER LEVEL CHANGES

-- Switched from use of `system` to `system2` to avoid problems with installation
   under R 4.0 on Windows (PR #1003).

-- Modify various adaptive MCMC samplers so the exponent controlling the scale
   decay of the adaptation is adjustable by user (rather than hard-coded at 0.8
   (PR #981).

-- Allow `pmin` and `pmax` to be used in models (PR #982).

-- Add documentation for `is.na`,`is.nan`,`any`,`all` (PR #988)

-- Add system option `MCMCuseConugacy` to control whether conjugate samplers are
   used (PR #998).

-- Adds checks for `niter`, `nburnin` in the `mcmc$run` method (PR #980).

-- Modify print handling in `addSampler` and `configureMCMC` (PRs #986, 989).

-- Improve handling of NA values in `dCRP` to avoid error messages when building
   models (PR #994).

-- Avoid monitoring top-level data nodes in models (PR #1006).

BUG FIXES

-- Modify MCMC `autoBlock` routine to only group Wishart, Inverse-Wishart, and
   Dirichlet nodes with themselves, to avoid violating the constraints of those
   nodes (PR #999).

-- Fix incorrect error message from `warnRHSonlyDynIdx` when variable appears
   multiple times on right-hand side of a model expression (PR #997).

-- Fix `checkDistributionFunctions` to respect default `nDim=0` when extracting
   first argument, to avoid error when dimension not specified in user-defined
   distributions (PR #992).

-- Fix `print` option of `addSampler` (PR #986).

-- Improve handling of cases where indexing goes beyond extent of variable in
   `expandNodeNames` and related queries of model structure (PR #977).

DEVELOPER LEVEL CHANGES

-- Use `inherits` rather than testing for equality of `class(object)` (PR #988).