You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Alex Herbert (Jira)" <ji...@apache.org> on 2022/03/02 00:54:00 UTC

[jira] [Commented] (RNG-167) Sampling from a T-distribution

    [ https://issues.apache.org/jira/browse/RNG-167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17499822#comment-17499822 ] 

Alex Herbert commented on RNG-167:
----------------------------------

This method is implemented in the current development version of Commons Statistics. There it is tested with a histogram based on quartiles using degrees of freedom 0.25, 0.5, 1, 2, 5, 10, 100, 1e4, 1e6, 1e10, 1e14.

I ported the class to Commons RNG where the test uses 50 chi-squared repeats on a histogram based on deciles. I tested degrees of freedom (DF) 0.76543, 30, 312, 1e10, 1e15, 1e20. All tests pass thus the method appears stable up to very large degrees of freedom. At high DF the deciles cannot be computed by Commons Math and must be supplied, preventing simple testing of a more extensive range of large DF values. Note that this bug has been resolved by STATISTICS-25.

At very large degrees of freedom the t distribution CDF approaches the normal distribution CDF. Deciles computed by matlab are different at 2^52, and the same at 2^53 (approximately 9e15). This threshold is around 1/eps where eps is the machine epsilon. The sampler can switch to using a normal approximation at this threshold. Given that the sampler passes at 1e20 using Bailey's method this threshold is a safe limit.

 

> Sampling from a T-distribution
> ------------------------------
>
>                 Key: RNG-167
>                 URL: https://issues.apache.org/jira/browse/RNG-167
>             Project: Commons RNG
>          Issue Type: New Feature
>          Components: sampling
>    Affects Versions: 1.4
>            Reporter: Alex Herbert
>            Priority: Minor
>
> The Box-Muller method for sampling from a Normal distribution can be extended to the T-distribution.
> [https://en.wikipedia.org/wiki/Student%27s_t-distribution#Monte_Carlo_sampling|http://example.com/]
> {noformat}
> Bailey RW (1994). "Polar Generation of Random Variates with the t-Distribution". Math. Comput. 62 (206): 779–781.{noformat}
> [https://doi.org/10.2307%2F2153537]
> The sampler can be used within Commons Statistics for the T-distribution implementation.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)