[SciPy-User] Coding Distribution in Python

Skipper Seabold jsseabold at gmail.com
Fri Dec 9 09:24:15 EST 2011


On Fri, Dec 9, 2011 at 9:07 AM, Troy <Troy_Mullins at nps.gov> wrote:
> Can anyone assist in how to python this gaussian normal:
>
> I have m, std(standard deviation) and y . . . .
>
>
>
> EQUATION 1:
>                              -[(x-m)2 / 2std*x2
>                            e
>   f(x) = 1/sqrt(2std*x2*pi)
>
>
>
>
>
> Then take output and put into :
>
>
> EQUATION 2:
>
>                ( y
>                |
>   P = F(y) =   |    f(x).dx
>                |
>                ) 0
>
> Can send an image of equation to anyone if this does not make sense.
>

You just want the normal pdf and cdf?

http://docs.scipy.org/scipy/docs/scipy-docs/tutorial/stats.rst/#stats
http://docs.scipy.org/scipy/docs/scipy-docs/tutorial/stats/continuous.rst/

from scipy import stats

m = 0
std = 1
norm_dist = stats.norm(loc=m, scale=std)
f = norm_dist.pdf
F = norm_dist.cdf

print f(1)
print F(1) - F(0)

hth,

Skipper



More information about the SciPy-User mailing list