Skip to content

Compute mean and variance of the univariate truncated normal distribution (works far from the peak).

License

Notifications You must be signed in to change notification settings

cossio/TruncatedNormal.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.