1.2.3-SNAPSHOT permalink Arrow_down_16x16

pdf-normal

incanter.stats

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

Options:
:mean (default 0)
:sd (default 1)

See also:
cdf-normal, quantile-normal, sample-normal

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

Example:
(pdf-normal 1.96 :mean -2 :sd (sqrt 0.5))

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

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

  Options:
    :mean (default 0)
    :sd (default 1)

  See also:
      cdf-normal, quantile-normal, sample-normal

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

  Example:
      (pdf-normal 1.96 :mean -2 :sd (sqrt 0.5))
"
  ([x & options]
    (let [opts (when options (apply assoc {} options))
          mean (or (:mean opts) 0)
          sd (or (:sd opts) 1)
          dist (Normal. mean sd (DoubleMersenneTwister.))]
      (if (coll? x)
        (map #(.pdf dist %) x)
        (.pdf dist x)))))
Vars in incanter.stats/pdf-normal: coll? defn let map
Used in 0 other vars

Comments top

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