calc: Probability Distribution Functions
9.7 Probability Distribution Functions
======================================
The functions in this section compute various probability distributions.
For continuous distributions, this is the integral of the probability
density function from ‘x’ to infinity. (These are the “upper tail”
distribution functions; there are also corresponding “lower tail”
functions which integrate from minus infinity to ‘x’.) For discrete
distributions, the upper tail function gives the sum from ‘x’ to
infinity; the lower tail function gives the sum from minus infinity up
to, but not including, ‘x’.
To integrate from ‘x’ to ‘y’, just use the distribution function
twice and subtract. For example, the probability that a Gaussian random
variable with mean 2 and standard deviation 1 will lie in the range from
2.5 to 2.8 is ‘utpn(2.5,2,1) - utpn(2.8,2,1)’ (“the probability that it
is greater than 2.5, but not greater than 2.8”), or equivalently
‘ltpn(2.8,2,1) - ltpn(2.5,2,1)’.
The ‘k B’ (‘calc-utpb’) [‘utpb’] function uses the binomial
distribution. Push the parameters N, P, and then X onto the stack; the
result (‘utpb(x,n,p)’) is the probability that an event will occur X or
more times out of N trials, if its probability of occurring in any given
trial is P. The ‘I k B’ [‘ltpb’] function is the probability that the
event will occur fewer than X times.
The other probability distribution functions similarly take the form
‘k X’ (‘calc-utpX’) [‘utpX’] and ‘I k X’ [‘ltpX’], for various letters
X. The arguments to the algebraic functions are the value of the random
variable first, then whatever other parameters define the distribution.
Note these are among the few Calc functions where the order of the
arguments in algebraic form differs from the order of arguments as found
on the stack. (The random variable comes last on the stack, so that you
can type, e.g., ‘2 <RET> 1 <RET> 2.5 k N M-<RET> <DEL> 2.8 k N -’, using
‘M-<RET> <DEL>’ to recover the original arguments but substitute a new
value for ‘x’.)
The ‘utpc(x,v)’ function uses the chi-square distribution with ‘v’
degrees of freedom. It is the probability that a model is correct if
its chi-square statistic is ‘x’.
The ‘utpf(F,v1,v2)’ function uses the F distribution, used in various
statistical tests. The parameters ‘v1’ and ‘v2’ are the degrees of
freedom in the numerator and denominator, respectively, used in
computing the statistic ‘F’.
The ‘utpn(x,m,s)’ function uses a normal (Gaussian) distribution with
mean ‘m’ and standard deviation ‘s’. It is the probability that such a
normal-distributed random variable would exceed ‘x’.
The ‘utpp(n,x)’ function uses a Poisson distribution with mean ‘x’.
It is the probability that ‘n’ or more such Poisson random events will
occur.
The ‘utpt(t,v)’ function uses the Student’s “t” distribution with ‘v’
degrees of freedom. It is the probability that a t-distributed random
variable will be greater than ‘t’. (Note: This computes the
distribution function ‘A(t|v)’ where ‘A(0|v) = 1’ and ‘A(inf|v) -> 0’.
The ‘UTPT’ operation on the HP-48 uses a different definition which
returns half of Calc’s value: ‘UTPT(t,v) = .5*utpt(t,v)’.)
While Calc does not provide inverses of the probability distribution
functions, the ‘a R’ command can be used to solve for the inverse.
Since the distribution functions are monotonic, ‘a R’ is guaranteed to
be able to find a solution given any initial guess. Numerical
Solutions.