[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Z-Score



PureBytes Links

Trading Reference Links

Hi,

I was looking for an algorithm that will tell me the z-score of a 
given percentile. In other words, I was looking for an algorithm 
that will replicate a reverse lookup in a normal distribution table.

Abramowitz & Stegun is my friend ("Handbook of Mathematical
Functions"). Formula 26.2.22 gives an approximation in z accurate to
within 3e-3, and formula 26.2.23 gives a more complicated but more
accurate formula.

26.2.22 says this (in pseudo-Fortran). p appears to be the
*upper*-tail probability (ie. p=P(Z>z)) and has to be less than 0.5
for this to work. (If not, call the function with argument 1-p and 
put
a minus sign on the result.)

t=sqrt(ln(1/p**2))  [ p squared ]
a0=2.30753
a1=0.27061
b1=0.99229
b2=0.04481
z=t-(a0+a1*t)/(1-t*(b1+b2*t))

The problem is to implement this effeciently in AB.  Ay ideas?
Thanks,
Pal



------------------------ Yahoo! Groups Sponsor ---------------------~-->
ReplayTV: CNet Ranked #1 over Tivo!
Instant Replay & Pause live TV.
Special Sale: 50% off!
http://us.click.yahoo.com/UUMW7B/.5qGAA/ySSFAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/