Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Implemented
-
1.0
-
None
Description
The TruncatedNormalDistribution computes the moments using the formulas on the Wikipedia page:
https://en.wikipedia.org/wiki/Truncated_normal_distribution#Moments
For the two sided truncation this computation is unstable. This is noted for the case when the bound [a, b] is far from the mean. It also effects a current test case for the following:
mean=7.1, sd=9.9, a=7.0999999, b=7.1000001
The implementation should be improved. I found one method based on the paper:
Foulley JL. A completion simulator for the two-sided truncated normal distribution. Genetics, selection, evolution 2000 Nov-Dec;32(6): p. 631-635.
When the bound [a, b] is far from the mean the range is in the long flat tail of the normal distribution. Here the moments can be computed as if the distribution is a continuous uniform distribution.
Note that the mean and variance are not used by the implementation. Improving the computation will simply provide a better result if the moments are desired.