1.2.3-SNAPSHOT Arrow_down_16x16

pdf-exp

incanter.stats

  • (pdf-exp x & options)
Returns the Exponential pdf of the given value of x. It will return a sequence
of values, if x is a sequence. Same as R's dexp

Options:
:rate (default 1)

See also:
cdf-exp and sample-exp

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

Example:
(pdf-exp 2.0 :rate 1/2)

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:863 top

(defn pdf-exp
" Returns the Exponential pdf of the given value of x. It will return a sequence
  of values, if x is a sequence. Same as R's dexp

  Options:
    :rate (default 1)

  See also:
      cdf-exp and sample-exp

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

  Example:
      (pdf-exp 2.0 :rate 1/2)
"
  ([x & options]
    (let [opts (when options (apply assoc {} options))
          rate (or (:rate opts) 1)
          dist (Exponential. rate (DoubleMersenneTwister.))]
      (if (coll? x)
        (map #(.pdf dist %) x)
        (.pdf dist x)))))
Vars in incanter.stats/pdf-exp: coll? defn let map
Used in 0 other vars

Comments top

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