Quote:

>I am trying to program a function in VB5 that duplicated the NORMSDIST

>function in Excel,

>NORMSDIST Returns the standard normal cumulative distribution. The

>distribution has a mean of 0 (zero) and a standard deviation of one.

>NORMSDIST(Z) where Z is the value for which you want the distribution.

>Excel gives the example NORMSDIST(1.333333) equals 0.908789

>_______________________________________________________

>PI = 3.14159265358979

>The formula I am using is X = ( 1/SQR(2 * PI) ) * EXP(- (Z ^ 2 / 2) )

>well it doesn't work, I don't mean I get a syntax error, I just get wrong

>numbers returned.

The formula you are using is the probability density function, i.e. it

returns the *height* of the curve at point Z, not the area under the curve

to the left of Z. To calculate the area, you need to take the *integral* of

your equation from negative infinity to Z.

I would look around for some statistics packages for VB -- commercial or

otherwise. I have Crescent Software's QuickPak Scientific for DOS Basic,

but its function is accurate to only 4 significant digits. In comparing the

results with those from Excel's function, there are differences in the 6th

decimal place.