Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

scipy cdf example

from scipy import stats
X = stats.binom(10, 0.2) # Declare X to be a binomial random variable
print X.pmf(3)           # P(X = 3)
print X.cdf(4)           # P(X <= 4)
print X.mean()           # E[X]
print X.var()            # Var(X)
print X.std()            # Std(X)
print X.rvs()            # Get a random sample from X
print X.rvs(10)          # Get 10 random samples form X
Source by web.stanford.edu #
 
PREVIOUS NEXT
Tagged: #scipy #cdf
ADD COMMENT
Topic
Name
9+5 =