TruncatedNormal.jl

Compute mean and variance of the univariate truncated normal distribution (works far from the peak).
Author cossio
Popularity
8 Stars
Updated Last
1 Year Ago
Started In
December 2017

TruncatedNormal

Note: Merged in to Distributions.jl, see JuliaStats/Distributions.jl#1058, JuliaStats/Distributions.jl#691.

Installation

Install with

using Pkg
Pkg.add(url="https://github.com/cossio/TruncatedNormal.jl")

Usage

This package does not export any symbols. The following functions are defined.

Mean of the truncated standard normal distribution:

TruncatedNormal.tnmean(a,b)

Mean of the truncated normal distribution, where μ,σ are the mean and standard deviation of the untruncated distribution:

TruncatedNormal.tnmean(a, b, μ, σ)

Variance of the truncated standard normal distribution:

TruncatedNormal.tnvar(a,b)

Variance of the truncated normal distribution, where μ,σ are the mean and standard deviation of the untruncated distribution:

TruncatedNormal.tnvar(a, b, μ, σ)

It works even if the truncation interval is far from the mode of the distribution. See https://github.com/cossio/TruncatedNormal.jl/blob/master/notes/normal.pdf for mathematical details.