Giter VIP home page Giter VIP logo

-vincmazet-rtnorm's Introduction

Simulation of truncated Gaussian Distribution

In 2005, we developped a first method to generate random variables distributed from a Gaussian distribution defined on a semi-finite interval [a,+∞[. This method was implemented in Scilab, Matlab and Java.

Following the article published in 2011 by Nicolas Chopin, we have developped a method to simulate a Gaussian distribution defined on a finite interval [a,b]. This method is still able to consider semi-finite interval by setting b=+∞. The principle is to divide the interval into regions with the same area where acceptation-reject algorithms with appropriate distributions are used.

Nicolas Chopin's methodis coded in C, but only on a semi-finite interval [a,+∞[. We extend his method to a finite interval [a,b], following its recommandations. The method is implemented in Matlab and C++; it is faster than our former implementation and also allows to consider a finite interval. However, it is still not able to generate a random vector, contrary to the version of 2005.

The following table summarize the implementations and their characteristics, as well as similar implementations in other languages :

Code Author Year Size Language Dimensions Truncation Interval
truncgauss N. Chopin 2011 462 kb C/Python 1/2 semi-finite/semi-finite or finite
rpnorm V. Mazet 2005 2 kb Matlab 1 or greater semi-finite
rpnorm V. Mazet 2005 2 kb Scilab 1 or greater semi-finite
rpnorm B. Perret, V. Mazet 2010 4 kb Java 1 or greater semi-finite
rtnorm V. Mazet 2012 58 kb Matlab 1 semi-finite or finite
rtnorm G. Dollé, V. Mazet 2012 67 kb C++ 1 semi-finite or finite
rtnorm C. Lassner 2013 60 kb Python 1 semi-finite or finite
dtnorm Alan R. Rogers 2016 232 kb C 1 finite

I did not compare theses implementations with the truncnorm function in Scipy.

Documents and codes

-vincmazet-rtnorm's People

Contributors

vincmazet avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.