@@ -25,6 +25,33 @@ parameters defined in the program. The C++ classes also include
25
25
code to transform the parameters from unconstrained to constrained and
26
26
apply the appropriate Jacobians.
27
27
28
+ ## Limitations due to finite accuracy presentation
29
+
30
+ In this section the transformations are described mathematically.
31
+ There are two cases where the observed behavior can be different from
32
+ the exact arithmetic:
33
+ - Stan’s arithmetic is implemented using double-precision
34
+ floating-point arithmetic, which may cause computation to behave
35
+ differently than mathematics. For example, lower bound constraint
36
+ is defined with logarithm constraint which mathematically excludes
37
+ the lower bound, but if the closest floating-point number for the
38
+ inverse transformed value is the boundary, then the value is
39
+ rounded to the boundary. This may cause unexpected warnings or
40
+ errors, if in other parts of the code the boundary value is
41
+ invalid. For example, we may observe floating-point value 0 for
42
+ a variance parameter that has been declared to be larger than 0.
43
+ See more about [Floating point Arithmetic in Stan user's guide](../stan-users-guide/floating-point.qmd)).
44
+ - CmdStan stores the output to CSV files with 6 significant digits
45
+ accuracy by default, but the constraints are checked with 8
46
+ decimal digit accuracy. Due to this, there can be errors if CSV
47
+ output is further used, for example, to run generated
48
+ quantities. For example, simplex constraint requires the values to
49
+ sum up to 1, but when writing the values to CSV they are rounded
50
+ to 6 significant digits and the sum of those rounded values can be
51
+ smaller or larger than 1 by more than 8 decimal digits. The
52
+ solution for CmdStan is to increase the number of significant
53
+ digits stored as discussed in [ CmdStan Command-Line Interface
54
+ Overview] ( ../cmdstan-guide/command_line_options.qmd ) .
28
55
29
56
## Changes of variables {#change-of-variables.section}
30
57
0 commit comments