[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

D.16.1 rmath statistical functions

Functions for evaluating random draws, density, cumulative probability and inverse cumulative probability are provided for some of the more frequently used probability distributions, which are chi-squared, non-central chi-squared, exponential, lognormal, normal, poisson, Student’s t, and uniform.

Each distribution is known by an abbreviated name and specified by one or two real parameters as listed below. Names of distributions in this table form the stem of a library function name. The names of the parameters such as mu and sigma are not explicitly mentioned when invoking the functions, but are listed here for reference. The precise definitions of the distribution functions and interpretations of these parameters can be found in standard texts on probability and statistics.

 
chisq         df
nchisq        df, lambda
exp           scale
lnorm         logmean, logsd
norm          mu, sigma
pois          lambda
t             n
unif          a, b

The virtual code interface follows a naming convention similar to the native API, in that function names beginning with r represent random draws from a distribution, with the argument to the function being the parameters specifying the distribution. Functions in this first group return a random draw from a distribution described by a single real parameter.

These next functions return random draws from distributions specified by a pair of parameters, (x,y).

Functions whose names begin with d evaluate the probability density of a distribution at a given point. They require at least two real arguments, the first being the point whose probability density is sought, and the remaining ones being the parameters that specify the distribution. A boolean operand, which is nil for false and (nil,nil) for true, requests the logarithm of the density when true.

Functions with names in the following group take a triple with two real operands and a boolean, (x,(y,a)), and return a probabiity density.

The next functions pertain to distributions requiring two paramters to specify them, so they take a quadruple with three real operands and a boolean, (x,(y,(z,a))).

Functions whose names begin with p or q obtain cumulative probabilities or inverse cumulative probabilities respectively for a specified distribution. They require one real operand to identify the point whose probability or inverse probability is sought, and other real operands to parameterize the distribution, as above. There are also two boolean operands. The first is true in order to request a probability or inverse probability with respect to the lower tail as opposed to the upper, and the other is true to indicate that probabilities are to be expressed logarithmically.

The argument to these functions is a quadruple with two real operands and two booleans, (x,(y,(a,b))).

The remaining functions pertain to distributions parameterized by two real operands. These take a quintuple with three real operands and two booleans, (x,(y,(z,(a,b)))).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on December 10, 2012 using texi2html 1.82.