API for probabilities.monte-carlo
- ()
by Konrad Hinsen
Usage:
(ns your-namespace
(:require clojure.contrib.probabilities.monte-carlo))
Overview
Monte-Carlo method support
Monte-Carlo methods transform an input random number stream
(usually having a continuous uniform distribution in the
interval [0, 1)) into a random number stream whose distribution
satisfies certain conditions (usually the expectation value
is equal to some desired quantity). They are thus
transformations from one probability distribution to another one.
This library represents a Monte-Carlo method by a function that
takes as input the state of a random number stream with
uniform distribution (see
clojure.contrib.probabilities.random-numbers) and returns a
vector containing one sample value of the desired output
distribution and the final state of the input random number
stream. Such functions are state monad values and can be
composed using operations defined in clojure.contrib.monads.
Public Variables and Functions
discrete
function
Usage: (discrete dist)
A discrete distribution, defined by a map dist mapping values
to probabilities. The sum of probabilities must be one.
Source
exponential
function
Usage: (exponential lambda)
Transform a sequence of uniform random numbers in the interval [0, 1)
into a sequence of exponential random numbers with parameter lambda.
Source
lognormal
function
Usage: (lognormal mu sigma)
Transform a sequence of uniform random numbesr in the interval [0, 1)
into a sequence of lognormal random numbers with mean mu and standard
deviation sigma.
Source
n-sphere
function
Usage: (n-sphere n r)
Return a uniform distribution of n-dimensional vectors inside an
n-sphere of radius r.
Source
normal
function
Usage: (normal mu sigma)
Transform a sequence urs of uniform random number in the interval [0, 1)
into a sequence of normal random numbers with mean mu and standard
deviation sigma.
Source
normal-box-muller
function
Usage: (normal-box-muller mu sigma)
Transform a sequence of uniform random numbers in the interval [0, 1)
into a sequence of normal random numbers with mean mu and standard
deviation sigma.
Source
random-stream
function
Usage: (random-stream distribution random-stream-state)
Define a random stream by a distribution and the state of a
random number stream with uniform distribution in [0, 1).
Source
reject
function
Usage: (reject p dist)
Return the distribution that results from rejecting the values from
dist that do not satisfy predicate p.
Source
sample
function
Usage: (sample n dist)
Return the distribution of samples of length n from the
distribution dist
Source
sample-mean
function
Usage: (sample-mean n dist)
Return the distribution of the mean over n samples from the
distribution dist
Source
sample-mean-variance
function
Usage: (sample-mean-variance n dist)
Return the distribution of the mean-and-variance (a vector containing
the mean and the variance) over n samples from the distribution dist
Source
sample-reduce
function
Usage: (sample-reduce f n dist)
(sample-reduce f val n dist)
Returns the distribution of the reduction of f over n samples from the
distribution dist.
Source
sample-sum
function
Usage: (sample-sum n dist)
Return the distribution of the sum over n samples from the
distribution dist.
Source