Statistical functions for work with 'censored' (truncated) distributions.
Statistical functions for work with 'censored' (truncated) distributions.
(censored-mean-lower a mu sigma)
Returns the mean of a normal distribution (with mean mu and standard deviation sigma) with the lower tail censored at 'a'
Returns the mean of a normal distribution (with mean mu and standard deviation sigma) with the lower tail censored at 'a'
(censored-mean-two-sided a b mu sigma)
Returns the mean of a normal distribution (with mean mu and standard deviation sigma) with the lower tail censored at 'a' and the upper tail censored at 'b'
Returns the mean of a normal distribution (with mean mu and standard deviation sigma) with the lower tail censored at 'a' and the upper tail censored at 'b'
(censored-mean-upper b mu sigma)
Returns the mean of a normal distribution (with mean mu and standard deviation sigma) with the upper tail censored at 'b'
Returns the mean of a normal distribution (with mean mu and standard deviation sigma) with the upper tail censored at 'b'
(censored-variance-lower a mu sigma)
Returns the variance of a normal distribution (with mean mu and standard deviation sigma) with the lower tail censored at 'a'
Returns the variance of a normal distribution (with mean mu and standard deviation sigma) with the lower tail censored at 'a'
(censored-variance-two-sided a b mu sigma)
Returns the variance of a normal distribution (with mean mu and standard deviation sigma) with the lower tail censored at 'a' and the upper tail censored at 'b'
Returns the variance of a normal distribution (with mean mu and standard deviation sigma) with the lower tail censored at 'a' and the upper tail censored at 'b'
(censored-variance-upper b mu sigma)
Returns the variance of a normal distribution (with mean mu and standard deviation sigma) with the upper tail censored at 'b'
Returns the variance of a normal distribution (with mean mu and standard deviation sigma) with the upper tail censored at 'b'
(truncated-variance
&
{:keys [mean sd a b]
:or {mean 0 sd 1 a Double/NEGATIVE_INFINITY b Double/POSITIVE_INFINITY}})
Returns the variance of a normal distribution truncated at a and b.
Options: :mean (default 0) mean of untruncated normal distribution :sd (default 1) standard deviation of untruncated normal distribution :a (default -infinity) lower truncation point :b (default +infinity) upper truncation point
Examples:
(use '(incanter core stats)) (truncated-variance :a -1.96 :b 1.96) (truncated-variance :a 0) (truncated-variance :b 0)
(use 'incanter.charts) (def x (range -3 3 0.1)) (def plot (xy-plot x (map #(truncated-variance :a %) x))) (view plot) (add-lines plot x (map #(truncated-variance :b %) x))
(def samp (sample-normal 10000)) (add-lines plot x (map #(variance (filter (fn [s] (> s %)) samp)) x)) (add-lines plot x (map #(variance (mult samp (indicator (fn [s] (> s %)) samp))) x))
References: DeMaris, A. (2004) Regression with social data: modeling continuous and limited response variables. Wiley-IEEE.
Returns the variance of a normal distribution truncated at a and b. Options: :mean (default 0) mean of untruncated normal distribution :sd (default 1) standard deviation of untruncated normal distribution :a (default -infinity) lower truncation point :b (default +infinity) upper truncation point Examples: (use '(incanter core stats)) (truncated-variance :a -1.96 :b 1.96) (truncated-variance :a 0) (truncated-variance :b 0) (use 'incanter.charts) (def x (range -3 3 0.1)) (def plot (xy-plot x (map #(truncated-variance :a %) x))) (view plot) (add-lines plot x (map #(truncated-variance :b %) x)) (def samp (sample-normal 10000)) (add-lines plot x (map #(variance (filter (fn [s] (> s %)) samp)) x)) (add-lines plot x (map #(variance (mult samp (indicator (fn [s] (> s %)) samp))) x)) References: DeMaris, A. (2004) Regression with social data: modeling continuous and limited response variables. Wiley-IEEE. http://en.wikipedia.org/wiki/Truncated_normal_distribution
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close