1.2.3-SNAPSHOT permalink Arrow_down_16x16

sample-gamma

incanter.stats

  • (sample-gamma size & options)
Returns a sample of the given size from a Gamma distribution.
This is equivalent to R's rgamma function.

Options:
:shape (default 1)
:rate (default 1)

See also:
pdf-gamma, cdf-gamma, and quantile-gamma

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

Example:
(sample-gamma 1000 :shape 1 :rate 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:610 top

(defn sample-gamma
" Returns a sample of the given size from a Gamma distribution.
  This is equivalent to R's rgamma function.

  Options:
    :shape (default 1)
    :rate (default 1)

  See also:
      pdf-gamma, cdf-gamma, and quantile-gamma

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

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

Comments top

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