1.2.3-SNAPSHOT Arrow_down_16x16

quantile-normal

incanter.stats

  • (quantile-normal probability & options)
Returns the inverse of the Normal CDF for the given probability.
It will return a sequence of values, if given a sequence of
probabilities. This is equivalent to R's qnorm function.

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

Returns:
a value x, where (cdf-normal x) = probability

See also:
pdf-normal, cdf-normal, and sample-normal

References:
http://incanter.org/docs/parallelcolt/api/cern/jet/stat/tdouble/Probability.html
http://en.wikipedia.org/wiki/Normal_distribution
http://en.wikipedia.org/wiki/Quantile

Example:
(quantile-normal 0.975)
(quantile-normal [0.025 0.975] :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:221 top

(defn quantile-normal
" Returns the inverse of the Normal CDF for the given probability.
  It will return a sequence of values, if given a sequence of
  probabilities. This is equivalent to R's qnorm function.

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

  Returns:
    a value x, where (cdf-normal x) = probability

  See also:
      pdf-normal, cdf-normal, and sample-normal

  References:
      http://incanter.org/docs/parallelcolt/api/cern/jet/stat/tdouble/Probability.html
      http://en.wikipedia.org/wiki/Normal_distribution
      http://en.wikipedia.org/wiki/Quantile

  Example:
      (quantile-normal 0.975)
      (quantile-normal [0.025 0.975] :mean -2 :sd (sqrt 0.5))
"
  ([probability & options]
    (let [opts (when options (apply assoc {} options))
          mean (or (:mean opts) 0)
          sd (or (:sd opts) 1)
          x (if (coll? probability)
              (map #(Probability/normalInverse %) probability)
              (Probability/normalInverse probability))]
      (plus mean (mult sd x)))))
Vars in incanter.stats/quantile-normal: defn let
Used in 0 other vars

Comments top

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