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'
(defn censored-mean-two-sided
" 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'
"
([a b mu sigma]
(let [a-std (psi a mu sigma)
b-std (psi b mu sigma)
cdf-a (cdf-normal a-std)
cdf-b (cdf-normal b-std)]
(+ (* cdf-a a)
(* (- cdf-b cdf-a) (+ mu (* sigma (lambda-two-sided a-std b-std))))
(* (- 1 cdf-b) b)))))
Comments top
No comments for censored-mean-two-sided. Log in to add a comment.