The scripts below do normal distribution stuff, but they are not what 
you have asked for. However, I have needed what you want in the past, 
and rather than spend too long looking for a method I simply 
generated 2000 random values drawn from the normal distribution in 
Excel (using the Data Analysis add-in) and stored them as a custom 
property. Randomly selecting one of those values each time gives a 
very close approximation to randomly selecting from the normal 
distribution. If you need the values (or any number of them, really) 
then let me know.

--calculates an approximate Inverse Normal Integral
--using the rational approximation from the
--Handbook of Mathematical Functions, National Bureau of Standards, 1968
on mouseUp
   --get area of interest, Q
   ask "What Q?"
   put it into Q
   put sqrt(ln(Q^(-2))) into t
   put t*t into t2
   put t2*t into t3
   put 
t-(2.515517+0.802853*t+0.010328*t2)/(1+1.432788*t+0.189269*t2+0.001308*t3) 
into x
   put x
end mouseUp

--calculates an approximate Normal Integral (tail from z to inf)
--using the rational approximation from the
--Handbook of Mathematical Functions, National Bureau of Standards, 1968
--checked against table A3 in Snedecor & Cochran
on mouseUp
   --get value of interest, Z
   ask "What Z?"
   put it into Z
   put 1/(1+0.2316419*z) into t
   put t*t into t2
   put t2*t into t3
   put t3*t into t4
   put t4*t into t5
   put 1/(sqrt(2*pi))*exp(-z*z/2) into fx
   put 
fx*(0.31938153*t-0.356563782*t2+1.781477937*t3-1.821255978*t4+1.330274429*t5) 
into area
   put area
end mouseUp

-- 
Michael J. Lew

Senior Lecturer
Department of Pharmacology
The University of Melbourne
Parkville 3010
Victoria
Australia

Phone +613 8344 8304

**
New email address: [EMAIL PROTECTED]
**

Archives: http://www.mail-archive.com/[email protected]/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to