1.2.3-SNAPSHOT permalink Arrow_down_16x16

Distribution

incanter.distributions


The distribution protocol defines operations on probability distributions.
Distributions may be univariate (defined over scalars) or multivariate
(defined over vectors). Distributions may be discrete or continuous.

For a list of types that implement the protocol run (extenders Distribution).
Implementations are provided for the various Clojure collection datatypes.
See the example below for using the distribution methods on these types.

See also:
pdf, cdf, draw, support

References:
http://en.wikipedia.org/wiki/Probability_distribution

Examples:
(support [1 3 4 2 1 3 4 2]) ; returns the set #{1 2 3 4}
(draw [1 3 4 2 1 3 4 2]) ; returns a value from #{1 2 3 4}
(pdf [2 1 2] 1) ; returns the value 1/3
(cdf [2 1 2 3] 2) ; returns the value 3/4

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source incanter/distributions.clj:31 top

(defprotocol Distribution
"
  The distribution protocol defines operations on probability distributions.
	Distributions may be univariate (defined over scalars) or multivariate
	(defined over vectors). Distributions may be discrete or continuous.

	For a list of types that implement the protocol run (extenders Distribution).
	Implementations are provided for the various Clojure collection datatypes.
	See the example below for using the distribution methods on these types.

	See also:
		pdf, cdf, draw, support

	References:
		http://en.wikipedia.org/wiki/Probability_distribution

	Examples:
	  (support [1 3 4 2 1 3 4 2]) ; returns the set #{1 2 3 4}
		(draw [1 3 4 2 1 3 4 2]) ; returns a value from #{1 2 3 4}
		(pdf [2 1 2] 1) ; returns the value 1/3
		(cdf [2 1 2 3] 2) ; returns the value 3/4 
"
	(pdf [d v]
"
  A function of the incanter.distribution.Distribution protocol.

  Returns the value of the probability density/mass function for the
  distribution d at support v.

	See also:
	  Distribution, cdf, draw, support

	References:
	  http://en.wikipedia.org/wiki/Probability_density_function

	Examples:
		(pdf [2 1 2] 1) ; returns the value 1/3\n")
  
	(cdf [d v]
"
  A function of the incanter.distribution.Distribution protocol.

  Returns the value of the cumulative density function for the
  distribution d at support v.

	See also:
	  Distribution, pdf, draw, support

	References:
	  http://en.wikipedia.org/wiki/Cumulative_distribution_function

	Examples:
		(cdf [2 1 2 3] 2) ; returns the value 3/4 \n")

	(draw [d]
"
  A function of the incanter.distribution.Distribution protocol.

  Returns a randomly drawn value from the support of distribution d. 

	See also:
	  Distribution, pdf, cdf, support

	Examples:
		(draw [1 3 4 2 1 3 4 2]) ; returns a value from #{1 2 3 4}\n")
  
  (support [d]
"
	**** EXPERIMENTAL ****
  A function of the incanter.distribution.Distribution protocol.

  Returns the support of the probability distribution d.
	For discrete distributions, the support is a set (i.e. #{1 2 3}).
	For continuous distributions, the support is a 2 element vector
	discribing the range. For example, the uniform distribution over
	the unit interval would return the vector [0 1].

	This function is marked as experimental to note that the output
	format might need to adapt to more complex support structures.
	For example, what would best describe a mixture of continuous
	distributions?

	See also:
	  Distribution, pdf, draw, support

	References:
	  http://en.wikipedia.org/wiki/Cumulative_distribution_function

	Examples:
		(cdf [2 1 2 3] 2) ; returns the value 3/4 \n"))
Vars in incanter.distributions/Distribution: defprotocol
Used in 0 other vars

Comments top

No comments for Distribution. Log in to add a comment.