1.2.3-SNAPSHOT permalink Arrow_down_16x16

pdf-uniform

incanter.stats

  • (pdf-uniform x & options)
Returns the Uniform pdf of the given value of x. It will return a sequence
of values, if x is a sequence. This is equivalent to R's dunif function.

Options:
:min (default 0)
:max (default 1)

See also:
cdf-uniform and sample-uniform

References:
http://incanter.org/docs/parallelcolt/api/cern/jet/random/tdouble/DoubleUniform.html
http://en.wikipedia.org/wiki/Uniform_distribution
http://en.wikipedia.org/wiki/Probability_density_function

Example:
(pdf-uniform 5)
(pdf-uniform 5 :min 1 :max 10)

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/stats.clj:348 top

(defn pdf-uniform
" Returns the Uniform pdf of the given value of x. It will return a sequence
  of values, if x is a sequence. This is equivalent to R's dunif function.

  Options:
    :min (default 0)
    :max (default 1)

  See also:
      cdf-uniform and sample-uniform

  References:
      http://incanter.org/docs/parallelcolt/api/cern/jet/random/tdouble/DoubleUniform.html
      http://en.wikipedia.org/wiki/Uniform_distribution
      http://en.wikipedia.org/wiki/Probability_density_function

  Example:
      (pdf-uniform 5)
      (pdf-uniform 5 :min 1 :max 10)
"
  ([x & options]
    (let [opts (when options (apply assoc {} options))
          min (double (or (:min opts) 0.0))
          max (double (or (:max opts) 1.0))
          dist (DoubleUniform. min max (DoubleMersenneTwister.))]
      (if (coll? x)
        (map #(.pdf dist %) x)
        (.pdf dist x)))))
Vars in incanter.stats/pdf-uniform: coll? defn let map
Used in 0 other vars

Comments top

No comments for pdf-uniform. Log in to add a comment.