hotpaw2
hotpaw2

Reputation: 70693

Converting a Uniform Distribution to a Fat-tailed Distribution

This previous SO question regards converting a Uniform distribution to a Normal distribution.

For Monte-Carlo simulations, I have a need not only for Normal (Gaussian), but for some computationally efficient ways to generate large numbers of samples from "fat-tailed" or heavy-tailed distributions, using a given (64-bit or double) uniform RNG as input. Examples of these distributions include: Log-normal, Pareto, Student-T, and Cauchy.

Use of inverse CDFs is acceptable given computationally efficient means of computing the inverse CDF as needed.

The tag is for a language-independant algorithms, but the implementations needed are for basic procedural programming languages (C, Basic, procedural Swift, Python, et.al.)

Upvotes: 1

Views: 867

Answers (1)

Peter O.
Peter O.

Reputation: 32878

A Cauchy random number can be expressed as:

scale * tan(pi * (RNDU01OneExc()-0.5)) + mu

Where RNDU01OneExc() is a random number in [0, 1), and mu and scale are the offset and scale, respectively.

A logarithmic normal random number can be expressed as exp(Normal(mu, sigma)), where Normal(mu, sigma) is a normally distributed random number with mean mu and standard deviation sigma.

These and other kinds of distributions are mentioned in my article on random number generation and sampling.

Upvotes: 1

Related Questions