This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi, I'm attaching a diff against the anoncvs version that adds some cumulative distribution functions for the following distributions: gamma family (gamma, chisq, exponential), geometric, binomial, beta, tdist, cauchy, logistic, pareto. It includes modifications to test.c to check whether a pdf integrates/sums up to the corresponding cdf (the test messages are perhaps a bit too verbose; and some tests fail for the pareto_cdf in the two rare cases where the simple numerical integration of the pdf gives poor results). A few related questions and suggestions: could somebody explain the rationale for the implementation of the Erlang distribution? I thought it was a discrete distribution, but maybe I'm confused. Second, it might be useful to have a functions that compute a definite integral over a pdf with lower and upper bounds supplied by arguments. This could be in addition to or in place of the _cdf functions. The reason for this is (discrete) distributions with no closed-form formula for the cumulative density/mass. So the design questions is, should one have functions of the form foo_cdf(x,...) where x is the upper bound of the sum/integral, or rather foo_cdf(a,b,...) that return \sum_{x=a}^b foo_pdf(x,...) (resp. \int)? Finally, would it be worth the added overhead to have separate types for the parameters of each distribution? For example, the current gamma_pdf takes a shape parameter a and a scale parameter b; one could put them in a struct and have several constructors (one in terms of shape and scale, one in terms of shape in inverse scale, one in terms of sample moments, etc.) that return such a struct, which could then be passed to the _pdf(), _cdf() and variate functions. I'd shy away from using macros for this, since the macro could only be invoked inside the argument list of a function call expression. Thanks, - martin
Attachment:
cdf.diff
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |