Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Calculating the inverse normal distribution

by thor (Priest)
on Nov 22, 2005 at 20:47 UTC ( [id://510897]=perlquestion: print w/replies, xml ) Need Help??

thor has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,

In my work, I've come across a situation where I'd like to be able to calculate the inverse to the Gaussian distribution given a mean, standard deviation, and target percentage. I poked around on CPAN and didn't see anything particularly relevant. Does anyone have any experience with such a thing, or will I have to roll my own?

Thanks in advance,
thor

Feel the white light, the light within
Be your own disciple, fan the sparks of will
For all of us waiting, your kingdom will come

Replies are listed 'Best First'.
Re: Calculating the inverse normal distribution
by randyk (Parson) on Nov 22, 2005 at 22:44 UTC
Re: Calculating the inverse normal distribution
by QM (Parson) on Nov 22, 2005 at 21:26 UTC
    I'll preface this by saying I know just enough to be dangerous. But since you haven't got a reply yet, here goes...

    Do you want the distribution function? Doesn't the mean and standard deviation determine that uniquely? Why do you need the target percentage?

    I've seen the IGD page on Mathworld, and frankly I'd be concerned about coding that correctly, efficiently, etc. I note that Mathematica doesn't even have it yet.

    Perhaps you can clarify your question (or perhaps it's just me in over my head).

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of

      Hmm...that's not quite it. What I have is the standard Gaussian distribution with a known mean (0) and standard deviation (1). Let's call that G(x). I also have a fixed percentage, let's say 0.85. What I need to find is a point z such that integral(G(x), -infinity, z) = 0.85. Does that make more sense?

      thor

      Feel the white light, the light within
      Be your own disciple, fan the sparks of will
      For all of us waiting, your kingdom will come

Re: Calculating the inverse normal distribution
by jeffguy (Sexton) on Nov 22, 2005 at 21:51 UTC
    I googled:
    perl inverse gaussian distribution
    and followed the link trail to:
    http://home.online.no/~pjacklam/notes/invnorm/impl/acklam/perl/ltqnorm.pl

    Though I haven't looked at it in detail, it looks like it's what you want.

    Update: Wrapped it in a test script -- it's what you want.
Re: Calculating the inverse normal distribution
by swampyankee (Parson) on Nov 22, 2005 at 21:34 UTC

    There is a Statistics::Distributions module; but I'm sure you know about that.

    I'm a bit confused by your post (I'm easily confused, so don't be offended), in that you're saying you've got the distribution, the mean, the standard deviation, and a target percentage. Isn't this over-specified? Or do you want to be able to get z given a target percentage and vice versa?

    Scanning CPAN does seem to indicate you'll have to roll your own; you might have success at http://lib.stat.cmu.edu, but you've probably already looked there.


    Update: One of thor's replies un-confused (or, at least, I think it did) me; Statistics::Distributions gives n = F(z), but he needs the inverse of this. i.e., z = F-1(f).

    emc

Re: Calculating the inverse normal distribution
by aufflick (Deacon) on Nov 23, 2005 at 00:59 UTC
    Everyone in this thread is WAY too smart for their own good ;)

      Including you?

        Sorry - circular reference there. Perhaps I should have implemented my comment with WeakRef :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://510897]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-03-28 08:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found