Changes in JAGS 5.0.0

Bug Fixes
=========
* The terminal interface will now dump the current values of all nodes
  when a sampler gets stuck (as stated in the manual).
* Requesting a monitored variable with an incorrect number of dimensions
  now gives an informative error rather than a LOGIC ERROR.
* LogicalNodes with fixed values now correctly report whether or not they
  are discrete valued via the isDiscreteValued() member function.



New features
============
* New monitor types based on trace and summary statistics of deviance
  related monitors to facilitate calculation of WAIC.
* New pv monitor.
* pD and popt monitors can now be set for any node in the graph.
* New distribution dgampois as an alias for dnegbin with reformulated
  parameters as often used to describe over-dispersed count data.
* The coda terminal command now has an optional type argument to
  facilitate use of the new monitor types.
* A vector of node names (of matching type) can now be obtained either
  via rjags or via the terminal application.

Library changes
===============
* Console class now has dumpNodeNames().
* Other additions to the JAGS library to facilitate new monitor types
  including Node->logDensity() and Node->KL() for all (including fixed)
  nodes.

Changes in JAGS 4.3.1

The Windows installer has been updated to work with the new compiler
for R >= 4.2.0.
  
Changes in JAGS 4.3.0

Bug fixes
=========
* Setting the RNG name and seed in a model with a data block caused a
  crash on exit. Thanks to Sourceforge user sathomasga.
* Samplers in the GLM module would recalculate the entire design matrix
  on each iteration, including columns that are fixed from one iteration
  to the next.
* There was a memory leak in the compiler which could create redundant
  constant nodes.
* Models in which the nodes were defined in forward-sampling order could
  could compile very slowly. The compilation time is now much less
  dependent on the order in which the nodes are defined.
* Parameter consistency checks are improved for bounded scalar stochastic
  nodes.
* The sum function was incorrectly reporting itself as a scale-preserving
  function when used with multiple arguments.
* Estimation of the deviance optimism pD was incorrect for the multinomial
  distribution.
* The command line interface now parses data when the first argument
  to the structure() function has name '.Data'. 

New features
============
* New distribution dmnorm.vcov for the multivariate normal distribution
  parameterized by the mean and the variance-covariance matrix.
  
Changes in JAGS 4.2.0

Bug fixes
=========
* JAGS 4.1.0 did not compile under Solaris Studio 12.3 as it referenced
  some C99 functions that are not part of the C++98 standard (It did
  compile under Solaris Studio 12.4).
* The non-central t distribution (dnt) was not inserted into the bugs
  module.
* The likelihood for left-truncated nodes was not calculated correctly
  (This did not affect truncated nodes with no parents, only truncated
   outcome variables).

Changes in JAGS 4.1.0

Bug fixes
=========
* False positive warnings about unused variables in 4.0.0 and 4.0.1
  are now fixed.
* Using the same name for a counter as an integer vector supplied with
  the data could lead to a "dimension mismatch" error when compiling
  the model.
* The compiler did not check that a subset expression was inside the
  range of a node array leading to a logic error. This is now checked
  in the Compiler::getRange function and a more informative
  compilation error message is generated.
* Setting up a large number of predictive nodes to be monitored
  is now much faster.
* The bugs::ConjugateNormal sample method did not work correctly with
  an exponential prior distribution.
* Error messages for undefined nodes and directed cycles are improved,
  with less misclassification between the two diagnostic messages.
* The configuration file jags.pc for pkg-config now gives the correct
  value for the variable moduledir.

New features
============
* A new distribution "dsample" in the bugs module represents sampling
  without replacement. It has the same interface as "dmulti" (sampling
  with replacement).

Library changes
===============
* The JRmath library contains d-p-q-r functions for the Weibull distribution
  using the shape-rate parameterization of BUGS instead of the shape-scale
  parameterization of R. These are used by the DWeib distribution in the
  bugs module.
* On Windows, the DLL of the JAGS library includes version information.
* Compiler::constFromTable returns NULL if a counter with the same name
  is on the counter stack.
* RScalarDist::randomSample has improved accuracy when sampling from the
  tails.
* Methods of the Console class consistently return false when an error
  occurs.

Internal changes in modules
===========================

* base module
  - The restriction on the length of nodes that FiniteMethod can sample is
  reintroduced (it was removed in release 4.0.0) but is large (100 instead
  of 20) and does not apply to nodes with prior distribution dcat.

* bugs module
  - Interval censored continuous variables can be sampled by the Censored
  method. Samplers are created by CensoredFactory.
  - New distribution DSample ("dsample") for sampling with replacement.
  - The bugs::Sum sampling method (SumMethod) now works when there are
  likelihood terms in addition to the sum constraint provided by the
  SumDist distribution. It can also handles the case when a SumDist node
  has only a single stochastic parent.


Changes in JAGS 4.0.1

Internal changes in modules
===========================
* The FLIBS flag is not passed to modules that use LAPACK and BLAS.
  This reverts a change in JAGS 4.0.0 that created an unwanted dependency
  on libgfortran on Mac OS X.

Changes in JAGS 4.0.0

New features
============
* Deterministic relations can be defined with the equals sign `=`
  as well as the left arrow `<-` (Thanks to Merlise Clyde for the suggestion).
* All distributions now have an associated function that calculates
  their normalized log density. If the name of the distribution is
  "dfoo" then the corresponding log density function is called
  "logdensity.foo". The first argument of the log density function is
  the value at which the density is to be evaluated, and the remaining
  arguments are the parameters of the distribution.
* The sum and prod functions are now variadic, like their R equivalents
  and return respectively the sum and product over all arguments.
* The sequence operator ":" can be used in any expression. If b < a then
  a:b returns a zero-length vector.
* The compiler gives more detailed information about the graph. In 
  addition to printing the total number of nodes, it gives the numbers
  of observed and unobserved stochastic nodes.
* Vector indexing is now possible for Node arrays and arbitrary integer
  vectors are allowed for the counter in a for loop.
* The generalized gamma distribution dgen.gamma now has alias "dggamma"
  for compatibility with OpenBUGS. The multinomial distribution has alias
  "dmultinom" for compatibility with R.
* The function c() has been added to the bugs module. Like the R function c()
  it combines its arguments into a single vector.
* New non-central t distribution "dnt" in the "bugs" module (from the R
  math library)
* Variables that are not completely defined can now be monitored. The
  undefined elements are dropped from CODA output.
* The compiler now gives a more informative error message when nodes
  cannot be resolved, and tries to distinguish between the two possible
  causes of an undefined node and a directed cycle.

Bug fixes
=========
* Unit tests for functions and distributions using CppUnit are now 
  included and can be activated by "make check"
* The qpar function in the bugs module was inverted.
* The not function in the base module was inverted.
* The ConjugateGamma sampler did not work correctly for the Chi Squared 
  distribution
* The parser accepts form feed as a white space character
* Fixes for lack of reproducibility (due to arbitrary ordering of
  Nodes in a Graph) have been put in place.
* The log-density functions for the multivariate normal (DMNorm) and
  Wishart (DWish) distributions now return zero for non-positive
  definite precision matrices, instead of throwing an exception. This
  allows flexible modelling of the precision matrix.
* The Windows installer no longer allows the same version of JAGS to
  be installed in two different locations (leading to registry problems)
* The qdexp function was incorrect.

Library changes
===============
* All C++ objects and functions are in the namespace jags
* Automake 1.12.0 or above is required. The header file generated from
  C++ yacc source is *.hh, not *.h for automake 1.12 and above. This is 
  incompatible with previous versions.
* The GraphView API has changed: stochasticChildren now returns a vector
  of (non-const) pointers. This is necessary for collapsing in multi-level
  models.
* The Graph interface is simplified as it now inherits from set<Node*>
* Names of functions in libjrmath are remapped to avoid namespace clashes
  with libR and libRmath.
* The Module.h header is moved into the module sub-directory
* The classes RScalarDist, DFunction, PFunction, QFunction are moved
  from the bugs module into the main library.
* SingletonGraphView is a new subclass of GraphView to be used when
  a single node is being sampled.
* Subclasses of Monitor no longer need to implement the reserve function.
  They should instead re-allocate memory during each update as necessary,
  ensuring that an update remains an amortized constant time operation.
* The ParallelSampler class is renamed MutableSampler. Similarly,
  the SamplerMethod class is renamed MutableSampleMethod. The API of 
  both classes is also modified as described below.
* The MutableSampleMethod class does not need to implement the name method.
  The name of a MutableSampler is now defined in the constructor. (In many
  cases the SamplerFactory can pass its own name to the Samplers it constructs:
  this allows us to get rid of a redundant level of names).
* A new class ImmutableSampler and corresponding class
  ImmutableSampleMethod are added to the library for samplers that have
  no internal state (e.g. base::FiniteSampler or bugs::ConjugateSampler).
* StochasticNode has a new member function setData, which sets the
  value of the node to be the same across all chains and sets the
  status of the StochasticNode to observed. The setObserved member
  function is defunct.  The change guarentees that observed
  StochasticNodes have the same value across all chains. The Compiler
  has been modified to use the new StochasticNode API.
* The VectorFunction class has a new subclass ScalarVectorFunction for
  scalar-valued functions that take vector-valued arguments.
* The length of the return value of a VectorFunction and the dimension
  of the value of an ArrayFunction may now depend on the values of
  the arguments and not just the lengths/dimensions of the arguments.
* A new checkParameterDiscrete member function in the Function class
  allows Functions to check that some of the parameters are discrete.
* A new checkParameterFixed member function in the Function class
  allows Functions to check that some of the parameters have fixed
  values. This check is necessary when creating a LogicalNode from
  a Function that has a variable-sized return value depending on the
  values of the arguments (and not just the dimensions of the arguments).
  We can only permit this if the node has fixed length, and hence if
  the relevant arguments are fixed.
* The Range class now allows representation of arbitrary index ranges
  (e.g. indices that are not contiguous, nor increasing, or include
   repeats). This change is in support of vector indexing. The old Range
  class is now represented by a sub-class SimpleRange.
* The interface of the NodeArray class is simplified. Member functions
  find and isEmpty are defunct.
* The new NodeArraySubset class is introduced for use by Monitors.
  The BUGSModel::getNode and Model::addExtraNode functions are defunct.
  These functions were only needed by Monitors.
* Calculation of Kullback-Leibler divergence is moved out of the dic
  module and into the library.
* The Node destructor no longer removes "this" (the node
  being destroyed) from its parents' list of children. A new member function
  unlinkParents() is added for this purpose.
* A new class of closed functions DNODE_ADDITIVE is added to the
  ClosedFuncClass enumeration, with new method Function#isAdditive to
  support LogicalNode#isClosed. An additive function can be expressed as
  f(x) = a + sum(x) and is fixed if a is fixed.
* The test for valid initial values for Stochastic Nodes is moved out of
  the model class and replaced by calls to GraphView::checkFinite in
  the constructor of each sample method. This change enables samplers
  to correct initial values when they are not valid.
  
Internal changes in modules
===========================
* All module namespaces are nested inside namespace jags

* The FLIBS flag is now passed to modules that use LAPACK and BLAS.
  This allows static linking to LAPACK.

* base module
  - FiniteMethod no longer has a restriction on the length of the 
    nodes that it can sample.
  - The sequence operator ":" is now defined as a function in the
    base module. Previously it was handled by the compiler.
  - The TraceMonitor and MeanMonitor classes take their values from a 
    NodeArraySubset instead of a Node, allowing them to be constructed
    even when all elements of a NodeArray have not been defined.

* bugs module
  - The ConjugateDirichlet sampler is now much faster for mixture
  models. This sampler contains some experimental features that may
  eventually be folded into the GraphView class.
  - The classes RScalarDist, DFunction, PFunction, QFunction are
  moved into the main library
  - The beta binomial distribution (DBetaBin) is moved to the mix 
  module.
  - The logDensity function for the multivariate normal distribution
  (DMNorm) now includes the correct normalizing constant for PDF_FULL.
  This affects deviance statistics for multivariate normal nodes.
  - All VectorFunctions with scalar return values now inherit from
  the new ScalarVectorFunction class.
  - New distribution SumDist provides an "observable function" version
  of the sum function, and the associated sampling method SumMethodd
  provides a sampler for its stochastic parents.

* glm module
  - Refactorization of samplers. The new Outcome class presents an
  abstract normal approximation to the GLM engine.

* mix module
  - New sampler MixDirich for conjugate Dirichlet sampling in a mixture
  model.
  - New sampler LDA for Latent Dirichlet Allocation models.
  - The beta binomial distribution (DBetaBin) is moved from the 
  bugs module.

Changes in JAGS 3.4.0
=====================

New features
====================
* You can now set a monitor of type "mean" for any node, which records
  the running mean.
* The order function in the bugs module returns a permutation that sorts
  its argument in ascending order (the inverse of the permutation 
  provided by the rank function).
* The Windows installer now offers a choice of personal or global
  installation for users with Admin access.
* The negative binomial distribution is extended to allow parameters
  size=0 and probability=1.

Bug fixes
=========
* LogicalNode::isClosed could throw a logic_error due to a bug in
  the checkLinear function (Linear.cc)
* Setting a monitor with thinning interval 0 prints an error message
  but no longer throws a logic_error exception.
* The command line interface could print a spurious warning that
  ".RNG.seed" or ".RNG.state" was unused.
* A function or distribution with zero arguments caused a segmentation
  fault. This now gives a compilation error.
* The "dround" function (bugs module) was incorrectly calling fprec
  (round to n significant figures) when it should have been calling
  fround (round to n decimal places).
* The sd() function divided by n (sample size) instead of (n-1).
* The Windows uninstaller did not correctly uninstall personal
  installations for users with administrative access.

Internal changes in modules
===========================

* base module
  - The Pow function has alias "pow" so it can be invoked either as "a^b"
  or as "pow(a,b)"

* bugs module
  - The Pow function has been removed: it was a duplicate of base::pow
  - The DSum distribution no longer throws an exception if the parameters
  are inconsistent with the value. This gives a more informative error
  message.



Changes in JAGS 3.3.0
=====================

User-visible changes
====================
* JAGS now prints a warning about unused initial values
* Failure to set a "pD" monitor from the "dic" module should produce a
  more informative error messages
* The Windows installer no longer creates a shortcut in the start menu
  to the uninstaller.  Use the Control Panel to uninstall JAGS on Windows.

Bug fixes
=========
* The inverse and logdet functions now work on scalars
* NodeArray::setValue could overwrite values of observed nodes.
  At the user-interface level, one could change the value of a constant
  node by providing an initial value.
* Underflow errors in the Weibull distribution are now caught.
* The auxiliary mixture sampling method now works with binomial data
  that have a zero denominator.
* The multinomial distribution now allows a zero size parameter.
* The log-density of the uniform distribution was incorrect when
  doing likelihood calculations.
* The ConjugateWishart distribution did not work correctly in mixture
  models.
* The choose and lchoose functions in the JRmath library could go into
  an infinite recursion, overflowing the C stack and crashing JAGS.
* The Poisson log-likelihood function did not return zero for non-integer
  values. This could lead to a crash in the glm module.
* Multiple bug fixes in the IWLS sampler in the glm module.

Internal changes in modules
===========================

  bugs module
* The InProd and MatMult functions now use BLAS calls.

  glm module:
* Cutoff for left and right expansions in Holmes-Held sampler is now optimal.
* IWLS sampler only works with certain link functions.

  dic module
* Faster Kullback-Leibler calculations for the Bernoulli distribution.

--------------------------------------------------------------------------
Changes in JAGS 3.2.0

User-visible changes
====================
* New observable function "dround" may be used to represent data that have
  been rounded to a given number of decimal places.

Bug fixes
=========
* BaseRNGFactory did not recycle RNGs correctly.
* DMState now declares itself to be a discrete-valued distribution.
* Likelihood calculations were incorrect for the binomial distribution
  with unobserved size parameter.
* The Holmes-Held sampler for logistic regression models with binary
  outcomes is now more numerically stable.

Internal changes in modules
===========================
* New ShiftedCount sampler samples nodes with a Poisson, binomial or
  negative binomial prior distribution that are used as the size
  parameter of a binomial distribution. 
* New ShiftedMultinomial sampler is a multivariate version of shiftedCount.
  It samples nodes with a multinomial prior distribution, elements of
  which are used as the size parameters of distinct binomial children.
* Headers in the GLM module are properly documented.

---------------------------------------------------------------------
Changes in JAGS 3.1.0

User-visible changes
====================
* Allow progress bar in batch mode if user gives "by" option to update
  or adapt.

Bug fixes
=========
* If a monitor is requested while the model is in adaptive mode, then
  adaptive mode is turned off, with a NOTE to the user, instead of
  throwing an exception.

Library changes
===============
* BUGSModel::setMonitor will return after the first error message is 
  reported from a MonitorFactory.

Internal changes in modules
===========================
* dic
  - Improved error messages from PDTraceFactory in case a pD monitor
    cannot be generated.

-----------------------------------------------------------------------
Changes in JAGS 3.0.0

User-visible changes
====================

* Functions and distributions may now have an alias, so that they can be
  referred to by more than one name. This allows compatibility with the
  naming conventions of OpenBUGS (e.g. ddirch vs ddirich) and of R
  (e.g. dbin vs dbinom).
* Progress bar
  - The width of the progress bar is extended from 40 to 50 characters
  - In batch mode, the progress bar is not printed
  - Adaptive mode is always indicated by symbol "+"
* In batch mode JAGS halts on the first error 
* New distributions in the bugs module
  - Non-central chi-square (dnchisqr)
  - Beta binomial (dbetabin)
  - Generalized gamma (dgen.gamma)
* Separate messages are printed during compilation and initialization of 
  the model.
* The multinomial distribution (dmulti) can take a scalar probability
  parameter (like dcat)
* A warning is printed if a user tries to initialize a model before it
  is compiled. This was previously silently ignored.
* The user has more control over the adaptive phase.  The adapt command
  does not automatically turn off the adaptive phase and so may be
  run sequentially until adaptation is complete.
* When a monitor cannot be defined an attempt is made to return an
  informative error message.
* A single installer for Windows contains both 32-bit and 64-bit
  versions of JAGS.

Library changes
===============

* logLikelihood function renamed to logDensity. This function now
  takes an argument allowing fast calculation of likelihoods and
  priors.
* New error functions declared in the header module/ModuleError.h can
  be called from a module instead of throwing an exception.  This
  allows safe handling when the library is statitically linked to the
  C++ runtime, as exceptions cannot be thrown across DLL boundaries in
  this case.
* New subclasses of runtime_error for functions (FuncError),
  distributions (DistError)
* Mixture nodes may share a common MixMap, with substantial memory savings.
* Models with large multivariate nodes have been optimized for speed.

Configuration changes
=====================

* Use up-to-date m4 macros for blas and lapack from gnu autoconf archive
* For modules, drop the -no-undefined linker flag except on Windows, where
  it is necessary.
* On Solaris, the macro for detecting blas automatically has been updated
  to use new syntax -library=sunperf.

Internal changes in modules 
===========================

* bugs 
  - The base RNG factory only uses the time stamp once, during
    construction, to fix the random number seed.  Use the bugs
    namespace consistently in the bugs module
  - Changed all instances of lgamma (C library) to lgamma_fn (R math)
  - The DSum sampler may be multi-level (i.e. it may sample two nodes,
    one of which is the descendant of the other)

* glm
  - The HolmesHeld sampler has been (temporarily) suppressed as its numerical 
    instability problems have not been solved.
  - The glm module now contains a copy of CHOLMOD, AMD, COLMOD

* mix
  - The DNormMix sampler may be multi-level

Bug fixes
=========

* Fixed segfault in BUGSModel when requesting monitor for node with wrong
  dimensions
* Fixed segfault in ConjugateMNormal
* Fixed glm module in case of GLMs with mis-measured covariates
  - Holmes-Held method cannot work with such models
  - With Albert-Chib method we need to update all auxiliary data 
    at the start of each iteration
* The lexer now accepts floating point expressions when the exponent
  has no sign (e.g. 6.022E23 now accepted as well as 6.022E+23)
* Corrected random number generation for
  - Pareto distribution
  - Multivariate T distribution
  - Hypergeometric distribution (seg fault)
* The constructors for Vector- and ArrayStochasticNodes now check
  the number of parameters.
* Fixed serious bug in NodeArray::find (It always returned 0 and led
  to the creation of spurious aggregate nodes).
* More informative error messages in case of module loading failure
* Random walk Metropolis sampler now copes with non-finite log-densities
* CalKLExact was only returning half the correct value, with 
  consequences for the pD and popt monitors.
* The binomial distribution now allows a zero size parameter
* Fixed bug in PDMonitorFactory that stopped Monitor objects being
  created when any node in the model is bounded.
* The scanner throws an exception if it encounters the Unicode 
  replacement charcter U+FFFD
