[SciPy-user] How to get a ppf for scipy.stats.beta

Michael mnandris@blueyonder.co...
Fri Sep 19 04:58:50 CDT 2008


Hi list,

i am trying to use the percent point function to sample from the cdf for
a beta distribution

beta.ppf() returns an array instead of x; also you cannot create a ppf
using the same idiom as beta.cdf(x,a,b,size=n)

How do i go about getting the ppf for a beta dist? 

thanks in advance - much hairpulling on this <grr>

Michael


from scipy.stats import norm
from scipy.stats import beta
from scipy import linspace

print norm.cdf(1.2)		# 0.884930329778 
print norm.ppf(0.884930329778)	# 1.2

a=2
b=7 
n=10e3
x=linspace(0,1,n)

cdf=beta.cdf(x,a,b,size=n)
print cdf[2371]			# 0.6

B=beta(x,a,b,size=n)

print B.cdf(2371)	
print B.ppf(0.6)		# <-- should be 2371?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://projects.scipy.org/pipermail/scipy-user/attachments/20080919/853ecae6/attachment.bin 


More information about the SciPy-user mailing list