1.2.3-SNAPSHOT Arrow_down_16x16

pdf-gamma

incanter.stats

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

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

See also:
cdf-gamma and sample-gamma

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

Example:
(pdf-gamma 10 :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:545 top

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

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

  See also:
      cdf-gamma and sample-gamma

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

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

Comments top

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