|
Stata's density and distribution functions have been renamed. First,
all the old names continue to work, even when not documented in the
manual, at least under version control. The new standard, however,
is, if X is the name of a distribution, then
Xden() |
is its density |
X() |
is its cumulative distribution |
invX() |
is its inverse cumulative |
Xtail() |
is its reverse cumulative |
invXtail() |
is its inverse reverse cumulative |
Not all functions necessarily exist and, if they do not, that is not
solely due to laziness on our part. In particular, concerning the
choice between X() and
Xtail(), the functions exist that we have
accurately implemented. In theory, you only need one because
Xtail() = 1-X(), but in
practice, the one-minus subtraction wipes out lots of accuracy. If
one really wants an accurate right-tail or left-tail probability, one
needs a separately written Xtail() or
X() routine, written from the ground up.
Anyway, forget everything you ever knew about Stata's distribution
functions. Here is the new set:
normden() |
same as old normd() |
norm() |
same as old normprob() |
invnorm() |
same as old invnorm() |
chi2() |
related to old chiprob(); see below |
invchi2() |
related to old invchi(); see below |
chi2tail() |
related to old chiprob() |
invchi2tail() |
related to old invchi() |
F() |
related to old fprob() |
invF() |
related to old invfprob() |
Ftail() |
same as old fprob() |
invFtail() |
equal to old invfprob() |
ttail() |
related to old tprob(); see below |
invttail() |
related to old invt(); see below |
nchi2() |
equal to old nchi() |
invnchi2() |
equal to old invnchi() |
npnchi2() |
equal to old npnchi() |
We want to emphasize that if a function exists, it is calculated
accurately. To wit, F() accurately calculates left
tails, and Ftail() accurately calculates right tails;
Ftail() is far more accurate than 1 -
F().
There is no normtail() function. The accurate way to
calculate left-tail probabilities (z<0) is
norm(z). The accurate way to calculate
right-tail probabilities (z>0) is
norm(-z).
All the old functions still exist, but in two cases, they work only
under version control: The old invt(), under the new
naming logic, ought to be the inverse of the cumulative, but is not,
so invt() goes into forced retirement for a release or
two. It works if version is set to 6 or before;
otherwise, you get the error ``unknown function invt()''. Similarly,
the old invchi() goes into forced retirement because
it is too close to the new name invchi2().
|