Boost logo

Boost :

Subject: Re: [boost] [math distributions] Laplace distribution
From: Thijs van den Berg (thijs_at_[hidden])
Date: 2008-11-28 08:58:00


Paul, John,

I've done a first commit to the sandbox!

1) sandbox\math_toolkit\boost\math\distributions\laplace.cpp
2) sandbox\math_toolkit\libs\math\test\test_laplace.cpp

..more later! (doc's, equations, charts, discussion)

The unit test file was (is) quite a lot of work, ..there are *so many*
things to consider/check.

How about this:
We could write some generic test based on the properties of distributions...

General relations:
1) quantile(cdf(x)) == x
2) hazard(x) = pdf(x)/(1-cdf(x))
3) pdf(x,location,scale) = pdf( (x-location)/scale, 0, 1)/scale
4) cdf(x,location,scale) = cdf( (x-location)/scale, 0, 1)
5) cdf(complement(N,x)) = cdf(N(-x))
6) quantile(complement(N,p)) = quantile(N(-x,1-p))

perhaps some automatic checking (for all distribution) of error throwing
7) support <-> cdf, pdf
8) quantile <-> p=0, p=1

And some generic test for distributions with specific properties
Symmetric distributions:
pdf(x) = pdf(-x)
cdf(x) = 1-cdf(-x)

etc.
we could write template functions for that, that get passed a set of 'x'
values etc

-- 
SITMO Quantitative Financial Consultancy - Software Development
M.A. (Thijs) van den Berg
Tel.+31 (0)6 2411 0061
Fax.+31 (0)15 285 1984
thijs_at_[hidden] <mailto:thijs_at_[hidden]> - www.sitmo.com 
<http://www.sitmo.com>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk