[
https://issues.apache.org/jira/browse/STATISTICS-55?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alex Herbert updated STATISTICS-55:
-----------------------------------
Attachment: NormalSample.jpg
> TruncatedNormalDistribution sampler
> -----------------------------------
>
> Key: STATISTICS-55
> URL: https://issues.apache.org/jira/browse/STATISTICS-55
> Project: Commons Statistics
> Issue Type: New Feature
> Components: distribution
> Affects Versions: 1.0
> Reporter: Alex Herbert
> Priority: Minor
> Fix For: 1.0
>
> Attachments: NormalSample.jpg
>
>
> The TruncatedNormalDistribution currently uses inverse CDF sampling.
> Sampling is also possible using a normalised Gaussian sampler to create
> samples and then rejecting those outside the range of the truncation.
> In the use case where the truncated normal distribution covers over 50% of
> the standard normal distribution, then rejection sampling will need less than
> 2 samples per value. This is efficiently sampled by generating fast Gaussian
> deviates and throwing away the few that are not in the supported bounds.
> The speed of each method will be approximately equal when:
> {noformat}
> t1 * n = t2{noformat}
> Where:
> * t1 is the speed of the normal distribution sampler;
> * n number of samples required to generate a value within the truncated
> range;
> * t2 is the speed of the inverse transform sampler.
> Rearranging provides a switching threshold to change to rejection sampling:
> {noformat}
> t1 / t2 <= 1 / n{noformat}
> Where {{1 / n}} is the fraction of the CDF covered by the truncated normal
> distribution. The threshold requires evaluation of t1 and t2.
> The relative speed of sampling using Gaussian deviates and inverse CDF
> sampling should be investigated with the intention to use rejection sampling
> for certain truncated distributions.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)