SDIST v0.1 Common probability and statistical distributions for the

advertisement
SDIST v0.1
Common probability and statistical distributions
for the HP48G Series (also HP48S?)
(C) 1996, Sune Bredahl
Here's a collection of probability and statistical distributions which
I've
used myself for a time now, so I've cramed them all into a library and
SDIST.LIB is the result.
I've only tested this library on a HP48G and I don't know if it will work
on the S series too. The commands have been written on different
occations,
and I can't remember if there are any HP48G-specific commands, but I
don't
think so.
In short SDIST offers the following:
*
*
*
*
'inverse' UTPx commands, ie. percentiles of t, F and chi-square dist.
Enhanced UPTx commands - not limited to d.o.f < 500
Binomial, Poisson and Hypergeometric distributions (also cummulative)
algebraic syntax for all commands
The probabilities returned for continous distributions are 'upper-tail'
probabilities, likewise the inverse distribution functions will assume
that
upper-tail probabilities are given.
In the following, commands will be referred to by their algebraic syntax,
but obviously they work with stack arguments as well.
(1) Upper-tail probabilities:
T->P(n,t)
F->P(n1,n2,f)
CHI->P(n,x)
N->P(m,v,x)
SN->P(x)
distribution
Upper-tail
Upper-tail
Upper-tail
Upper-tail
Upper-tail
probability
probability
probability
probability
probability
of
of
of
of
of
t-distribution *
F-distribution *
chi-square distribution *
normal distribution
the standard-normal
* if n>499 an approximation is used
(2) The following are 'inverted' versions of the above, ie. returns the
p'th
percentile of the distribution in question:
P->T(n,p)
P->F(n1,n2,p)
P->CHI(n,p)
P->N(m,v,p)
Upper p'th percentile of the t-distribution *
Upper p'th percentile of the F-distribution *
Upper p'th percentile of the chi-square distribution *
Upper p'th percentile of the normal distribution
P->SN(p)
Upper p'th percentile of the standard-normal distribution
* if n>499 an approximation is used.
(3)
Discrete distributions:
BINOM(n,p,x) Binomial distribution *
POISS(l,x) Poisson distribution *
HYPER(m,N,n,x)
Hypergeometric distribution */**
* These distributions work cummulative by defining x as a complex number,
eg.
'BINOM(9,1/2,(0,5))' calculates BINOM(9,1/2,0)+...+BINOM(9,1/2,5).
** In the hypergeometric distribution, m is the population size, N is the
number of 'succes' elements in the population and n in the sample size
drawn
from the population. (HYPER then returns the probability of getting
exactly x
of the succes elements in the sample drawn.)
********************************************
SOME NUMERICAL DETAILS
I've included som info here on the computational details for the commands
in SDIST.
t->P, F->P and chi->P
For n<500 (n=degrees of freedom) these are equal to the built-in UTPT,
UTPF
and UTPC commands respectively. For n>499 numerical approximations are
used.
The approximations (from the Stegun and Abrahamowitz book) are quite
good,
except in the F-distribution case if n1 and n2 differs very much.
P->t, P->F, P->chi, P->N, P->SND
These are found using the the built-in solver with the respective
distribution so they're not that fast. The comments concerning n>499
apply
here as well.
BIN, POIS, HYPER
When used cummulative round-off problems may occur in some delicate
situations, so a normal approx. should be used if there's reason to
suspect
this.
I still consider this a beta release, so if you find any bugs or if you
have
any suggestions, then please e-mail me.
Enjoy
Sune Bredahl, c947086@student.dtu.dk
Download