Title
Unnecessary restriction in [rand.dist.norm.chisq]
Status
cd1
Section
[rand.dist.norm.chisq]
Submitter
Stephan Tolksdorf

Created on 2007-09-21.00:00:00 last changed 163 months ago

Messages

Date: 2010-10-21.18:28:33

[ Stephan Tolksdorf adds pre-Bellevue: ]

In [rand.dist.norm.chisq]:

Delete ", where n is a positive integer" in the first paragraph.

Replace both occurrences of "explicit chi_squared_distribution(int n = 1);" with "explicit chi_squared_distribution(RealType n = 1);".

Replace both occurrences of "int n() const;" with "RealType n() const;".

In [rand.dist.norm.f]:

Delete ", where m and n are positive integers" in the first paragraph.

Replace both occurrences of

explicit fisher_f_distribution(int m = 1, int n = 1);

with

explicit fisher_f_distribution(RealType m = 1, RealType n = 1);

Replace both occurrences of "int m() const;" with "RealType m() const;".

Replace both occurrences of "int n() const;" with "RealType n() const;".

In [rand.dist.norm.t]:

Delete ", where n is a positive integer" in the first paragraph.

Replace both occurrences of "explicit student_t_distribution(int n = 1);" with "explicit student_t_distribution(RealType n = 1);".

Replace both occurrences of "int n() const;" with "RealType n() const;".

Date: 2010-10-21.18:28:33

Proposed resolution:

See N2424 for the proposed resolution.

Date: 2010-10-21.18:28:33

[ Sophia Antipolis: ]

Marc Paterno: The generalizations were explicitly left out when designing the facility. It's harder to test.

Marc Paterno: Ask implementers whether floating-point is a significant burden.

Alisdair: It's neater to do it now, do ask Bill Plauger.

Disposition: move to review with the option for "NAD" if it's not straightforward to implement; unanimous consent.

Date: 2010-10-21.18:28:33

[ Bellevue: ]

In N2424. Not wildly enthusiastic, not really felt necessary. Less frequently used in practice. Not terribly bad either. Move to OPEN.

Date: 2007-09-21.00:00:00

chi_squared_distribution, fisher_f_distribution and student_t_distribution have parameters for the "degrees of freedom" n and m that are specified as integers. For the following two reasons this is an unnecessary restriction: First, in many applications such as Bayesian inference or Monte Carlo simulations it is more convenient to treat the respective param- eters as continuous variables. Second, the standard non-naive algorithms (i.e. O(1) algorithms) for simulating from these distributions work with floating-point parameters anyway (all three distributions could be easily implemented using the Gamma distribution, for instance).

Similar arguments could in principle be made for the parameters t and k of the discrete binomial_distribution and negative_binomial_distribution, though in both cases continuous parameters are less frequently used in practice and in case of the binomial_distribution the implementation would be significantly complicated by a non-discrete parameter (in most implementations one would need an approximation of the log-gamma function instead of just the log-factorial function).

Possible resolution: For these reasons, I propose to change the type of the respective parameters to double.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg3597
2010-10-21 18:28:33adminsetmessages: + msg3596
2010-10-21 18:28:33adminsetmessages: + msg3595
2010-10-21 18:28:33adminsetmessages: + msg3594
2007-09-21 00:00:00admincreate