Post Reply 
Best (and Newest?) Approximations for Popular Inverse Distributions
03-15-2019, 12:48 PM (This post was last modified: 03-15-2019 12:52 PM by Namir.)
Post: #1
Best (and Newest?) Approximations for Popular Inverse Distributions
Hello All,

I am looking for the best (and I assume newest) approximations for the Inverse Normal and Inverse Student-t distributions. The HP-65 and HP-67 have these that come from the "Handbook of Mathematical Functions: with Formulas, Graphs, and Mathematical Tables" by Milton Abramowitz and Irene A. Stegun.

I am looking for better approximations that the ones appearing the HP 65/65 Stat Pacs.

Cheers,

Nami
Find all posts by this user
Quote this message in a reply
03-15-2019, 01:02 PM
Post: #2
RE: Best (and Newest?) Approximations for Popular Inverse Distributions
Hello Namir,

Perhaps this one ?
Find all posts by this user
Quote this message in a reply
03-15-2019, 02:49 PM
Post: #3
RE: Best (and Newest?) Approximations for Popular Inverse Distributions
Which raises the question: How many people here have a copy of Big Red?

I do. I bought it at the US Government Bookstore in downtown LA in the 80s. I used to be able to buy my Topo maps there, too.
Find all posts by this user
Quote this message in a reply
03-15-2019, 04:27 PM (This post was last modified: 03-15-2019 05:14 PM by Dieter.)
Post: #4
RE: Best (and Newest?) Approximations for Popular Inverse Distributions
(03-15-2019 12:48 PM)Namir Wrote:  I am looking for better approximations that the ones appearing the HP 65/65 Stat Pacs.

I assume that virtually anything is better that the good old Hastings approximation. ;-)

As far as I can tell the de-facto standard for the inverse Normal distribution is the Wichura algorithm from 1988, published in Applied Statistics as algorithm AS241. It works over the whole IEEE double precision domain and has a relative error less than 1 E-16.

I strongly recommend reading the papers by William T. Shaw, both w.r.t. the inverse Normal as well as other distributions. There is a lot of valuable info to be found.

For my part I prefer a less complex approximation which is then refined in a second step. The HP67/97 program in the Software Library here works this way.

Dieter
Find all posts by this user
Quote this message in a reply
03-16-2019, 01:30 AM
Post: #5
RE: Best (and Newest?) Approximations for Popular Inverse Distributions
I still have one copy left. On the other hand, it's available free on the net.
Find all posts by this user
Quote this message in a reply
03-16-2019, 07:16 AM
Post: #6
RE: Best (and Newest?) Approximations for Popular Inverse Distributions
(03-15-2019 01:02 PM)Pekis Wrote:  Perhaps this one ?

These are programs for the HP-42S:
Code:
00 { 32-Byte Prgm }
01▸LBL "PHI41"
02 10
03 ÷
04 41
05 X<>Y
06 Y↑X
07 1
08 X<>Y
09 -
10 22
11 X<>Y
12 Y↑X
13 +/-
14 2
15 X<>Y
16 Y↑X
17 END

Code:
00 { 36-Byte Prgm }
01▸LBL "iPHI41"
02 LN
03 2
04 LN
05 ÷
06 +/-
07 LN
08 22
09 LN
10 ÷
11 1
12 X<>Y
13 -
14 LN
15 41
16 LN
17 ÷
18 10
19 ×
20 END

Examples:

1
XEQ "PHI41"
0.841442

XEQ "iPHI41"
1.000000

They are easily ported to the HP-25:
Code:
01: 31    :    ENTER
02: 01    :    1
03: 00    :    0
04: 71    :    ÷
05: 04    :    4
06: 01    :    1
07: 21    :    X<>Y
08: 14 03 :    Y↑X
09: 01    :    1
10: 21    :    X<>Y
11: 41    :    -
12: 02    :    2
13: 02    :    2
14: 21    :    X<>Y
15: 14 03 :    Y↑X
16: 32    :    CHS
17: 02    :    2
18: 21    :    X<>Y
19: 14 03 :    Y↑X
20: 13 00 :    GTO 00
21: 14 07 :    LN
22: 02    :    2
23: 14 07 :    LN
24: 71    :    ÷
25: 32    :    CHS
26: 14 07 :    LN
27: 02    :    2
28: 02    :    2
29: 14 07 :    LN
30: 71    :    ÷
31: 01    :    1
32: 21    :    X<>Y
33: 41    :    -
34: 14 07 :    LN
35: 04    :    4
36: 01    :    1
37: 14 07 :    LN
38: 71    :    ÷
39: 01    :    1
40: 00    :    0
41: 61    :    ×
42: 13 00 :    GTO 00

Examples:

CLEAR PGRM
1
R/S
0.841442

GTO 21
R/S
1.000000

Thanks for sharing
Thomas
Find all posts by this user
Quote this message in a reply
03-16-2019, 10:02 AM
Post: #7
RE: Best (and Newest?) Approximations for Popular Inverse Distributions
(03-16-2019 07:16 AM)Thomas Klemm Wrote:  
(03-15-2019 01:02 PM)Pekis Wrote:  Perhaps this one ?

These are programs for the HP-42S:

Yes, these are very simple approximations of the Normal Integral that can be directly inverted so that you get the inverse, the Normal quantile. But the error is larger than in the old 1950s approximations Namir mentioned, and they do not work well for probabilities close to 0 or 1. So I wonder if this is what Namir had in mind when he wrote he was looking for "the best ... approximations".

I think in this regard other methods are much more suited. Most of them use rational approximations. Various of such approximations have been published: by Odeh and Evans, Beasley, Moro and Springer, Wichura, Acklam and others.

But you don't have to rely on the results of others. Rational approximations can be developed in Mathematica or Maple, you can even do it in Excel. Just state the domain (down to 1E–99? More? Less?) and the accepted error level, and do your own custom approximation.

Dieter
Find all posts by this user
Quote this message in a reply
03-17-2019, 11:17 AM
Post: #8
RE: Best (and Newest?) Approximations for Popular Inverse Distributions
(03-15-2019 01:02 PM)Pekis Wrote:  Hello Namir,

Perhaps this one ?

Thanks for the article. It contains a reference to another article that lists a whole set of functions that approximate the normal pdf.

Namir
Find all posts by this user
Quote this message in a reply
03-18-2019, 06:52 AM
Post: #9
RE: Best (and Newest?) Approximations for Popular Inverse Distributions
I collected several Inverse Normal formulas last year. Pekis' post is a good reference. I used in practice https://apps.dtic.mil/dtic/tr/fulltext/u2/a060390.pdf

For probability p, (p^.135 - (1-p(^.135))/.1975 which is rather simple.
Find all posts by this user
Quote this message in a reply
03-18-2019, 07:10 AM
Post: #10
RE: Best (and Newest?) Approximations for Popular Inverse Distributions
Thanks ttw!
Find all posts by this user
Quote this message in a reply
03-18-2019, 02:45 PM (This post was last modified: 03-18-2019 02:59 PM by Pekis.)
Post: #11
RE: Best (and Newest?) Approximations for Popular Inverse Distributions
Hello Namir,

I found this not too heavy erfinv function by Mike Giles with these notes:

... Regarding accuracy, the maximum error of the new single precision approximation,
compared to the existing double precision version, is around
7×10−7 ...


I then transformed it in VBA using invphi(p) = sqrt(2) * erfinv(2*p-1)

Public Function invphi(prob As Double)
Dim x As Double, t As Double
Dim w As Double, p As Double

t = 2 * prob - 1
x = Abs(t)
w = -Log((1 - x) * (1 + x))
If (w < 5) Then
w = w - 2.5
p = 2.81022636E-08
p = 0.000000343273939 + p * w
p = -0.0000035233877 + p * w
p = -0.00000439150654 + p * w
p = 0.00021858087 + p * w
p = -0.00125372503 + p * w
p = -0.00417768164 + p * w
p = 0.246640727 + p * w
p = 1.50140941 + p * w
Else
w = Sqr(w) - 3
p = -0.000200214257
p = 0.000100950558 + p * w
p = 0.00134934322 + p * w
p = -0.00367342844 + p * w
p = 0.00573950773 + p * w
p = -0.0076224613 + p * w
p = 0.00943887047 + p * w
p = 1.00167406 + p * w
p = 2.83297682 + p * w
End If
invphi = Sgn(t) * p * x * Sqr(2)
End Function
Find all posts by this user
Quote this message in a reply
03-18-2019, 03:15 PM
Post: #12
RE: Best (and Newest?) Approximations for Popular Inverse Distributions
Excuse my Noob ignorance but is the ‘Big Red’ quoted (who has one?) also the Abramowitz book that is mentioned? If so, yes I’ve had a copy for years and the OEIS (both book and online version that comes with the book.

Denny Tuckerman
Visit this user's website Find all posts by this user
Quote this message in a reply
03-18-2019, 03:36 PM (This post was last modified: 03-18-2019 05:31 PM by SlideRule.)
Post: #13
RE: Best (and Newest?) Approximations for Popular Inverse Distributions
(03-15-2019 12:48 PM)Namir Wrote:  … I am looking for the best (and I assume newest) approximations for the Inverse Normal … distribution … I am looking for better approximations that the ones appearing the HP 65/65 Stat Pacs ….Namir

You may find An Approximation to the Probability Normal Distribution and its Inverse, Una aproximación a la distribución de probabilidad normal y su inversa, Alamilla-López Jorge Luis, Instituto Mexicano del Petróleo, Dirección de Investigación en Transformación de Hidrocarburos (MAR 2015), useful.

Abstract
Mathematical functions are used to compute Normal probabilities, which absolute errors are small; however their large relative errors make them unsuitable to compute structural failure probabilities or to compute the menace curves of natural hazards. In this work new mathematical functions are proposed to compute Normal probabilities and their inverses in an easy and accurate way. These functions are valid over a wide range of random variable and are useful in applications where computational speed and efficiency are required. In addition, these functions have the advantage that the numerical correspondence between the random value Χ = x and its Normal probability Φ (-x) is bijective.


BEST!
SlideRule
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)