5 R style probability distributions
Attempts have been made to make the interface (function name and arguments) as close as possible to that of R.
The densities (
d...
) are provided both in the discrete and continuous case, cumulative distributions (p...
) and inverse cumulative distributions (q...
) are provided only for continuous distributions.Scalar and
vector
arguments (in combination) are supported, but notarray
ormatrix
arguments.The last argument (of type
int
) corresponds to thelog
argument in R: 1=logaritm, 0=ordinary scale.true
(logaritm) andfalse
(ordinary scale) can also be used.Vector arguments must all be of the same length (no recycling of elements). If vectors of different lengths are used an “out of range” error will occur, which can be picked up by the debugger.
DATA_IVECTOR()
andDATA_INTEGER()
cannot be used with probability distributions, except possibly for the last (log) argument.An example:
To sum over elements in the vector returned use