API for censored

Full namespace name:
incanter.censored
Overview
Statistical functions for work with 'censored' (truncated) distributions.
Public Variables and Functions
censoredmeanlower
function
Usage: (censoredmeanlower a mu sigma)
Returns the mean of a normal distribution (with mean mu and standard
deviation sigma) with the lower tail censored at 'a'
Source
censoredmeantwosided
function
Usage: (censoredmeantwosided 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'
Source
censoredmeanupper
function
Usage: (censoredmeanupper b mu sigma)
Returns the mean of a normal distribution (with mean mu and standard
deviation sigma) with the upper tail censored at 'b'
Source
censoredvariancelower
function
Usage: (censoredvariancelower a mu sigma)
Returns the variance of a normal distribution (with mean mu and standard
deviation sigma) with the lower tail censored at 'a'
Source
censoredvariancetwosided
function
Usage: (censoredvariancetwosided 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'
Source
censoredvarianceupper
function
Usage: (censoredvarianceupper b mu sigma)
Returns the variance of a normal distribution (with mean mu and standard
deviation sigma) with the upper tail censored at 'b'
Source
truncatedvariance
function
Usage: (truncatedvariance & {:keys [mean sd a b], :or {mean 0, sd 1, a NEGATIVE_INFINITY, b 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))
(truncatedvariance :a 1.96 :b 1.96)
(truncatedvariance :a 0)
(truncatedvariance :b 0)
(use 'incanter.charts)
(def x (range 3 3 0.1))
(def plot (xyplot x (map #(truncatedvariance :a %) x)))
(view plot)
(addlines plot x (map #(truncatedvariance :b %) x))
(def samp (samplenormal 10000))
(addlines plot x (map #(variance (filter (fn [s] (> s %)) samp)) x))
(addlines 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.
WileyIEEE.
http://en.wikipedia.org/wiki/Truncated_normal_distribution
Source