1.2.3-SNAPSHOT Arrow_down_16x16

sample-exp

incanter.stats

  • (sample-exp size & options)
Returns a sample of the given size from a Exponential distribution.
Same as R's rexp

Options:
:rate (default 1)

See also:
pdf-exp, and cdf-exp

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

Example:
(sample-exp 1000 :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:917 top

(defn sample-exp
" Returns a sample of the given size from a Exponential distribution.
  Same as R's rexp

  Options:
    :rate (default 1)

  See also:
      pdf-exp, and cdf-exp

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

  Example:
      (sample-exp 1000 :rate 1/2)
"
  ([size & options]
    (let [opts (when options (apply assoc {} options))
          rate (or (:rate opts) 1)]
      (if (= size 1)
        (Exponential/staticNextDouble rate)
        (for [_ (range size)] (Exponential/staticNextDouble rate))))))
Vars in incanter.stats/sample-exp: = defn for let
Used in 0 other vars

Comments top

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