Python for Finance: Analyze Big Financial Data

(Elle) #1
standard_cauchy [ size] Samples from standard Cauchy distribution with mode = 0

standard_exponential

[ size]

Samples from the standard exponential distribution

standard_gamma

shape[, size]

Samples from a standard gamma distribution

standard_normal

[ size]

Samples from a standard normal distribution (mean=0, stdev=1)

standard_t

df[, size]

Samples from a Student’s t distribution with df degrees of

freedom

triangular

left, mode, right[, size]

Samples from the triangular distribution

uniform

[ low, high, size]

Samples from a uniform distribution

vonmises

mu, kappa[, size]

Samples from a von Mises distribution

wald

mean, scale[, size]

Samples from a Wald, or inverse Gaussian, distribution

weibull

a[, size]

Samples from a Weibull distribution

zipf

a[, size]

Samples from a Zipf distribution

Although there is much criticism around the use of (standard) normal distributions in


finance, they are an indispensible tool and still the most widely used type of distribution,


in analytical as well as numerical applications. One reason is that many financial models


directly rest in one way or another on a normal distribution or a log-normal distribution.


Another reason is that many financial models that do not rest directly on a (log-)normal


assumption can be discretized, and therewith approximated for simulation purposes, by the


use of the normal distribution.


As an illustration, we want to visualize random draws from the following distributions:


Standard normal with mean of 0 and standard deviation of 1


Normal with mean of 100 and standard deviation of 20


Chi square with 0.5 degrees of freedom


Poisson with lambda of 1


We do this as follows:


In  [ 8 ]:  sample_size =    500
rn1 = npr.standard_normal(sample_size)
Free download pdf