fstats_sampling Module



Contents


Functions

public function box_muller_sample(mu, sigma, n) result(rst)

Utilizes the Box-Muller transformation approach to generate the requested number of random samples from a normal distribution of the specified mean and standard deviation.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: mu

The mean of the distribution.

real(kind=real64), intent(in) :: sigma

The standard deviation of the distribution.

integer(kind=int32), intent(in) :: n

The number of random samples to generate.

Return Value real(kind=real64), allocatable, dimension(:)

An N-element array containing the values.

public function rejection_sample(tdist, n, xmin, xmax) result(rst)

Uses rejection sampling to randomly sample a target distribution.

Arguments

Type IntentOptional Attributes Name
class(distribution), intent(in) :: tdist

The distribution to sample

integer(kind=int32), intent(in) :: n

The number of samples to make.

real(kind=real64), intent(in) :: xmin

The minimum range to explore.

real(kind=real64), intent(in) :: xmax

The maximum range to explore.

Return Value real(kind=real64), allocatable, dimension(:)

An N-element array containing the N samples from the distribution.

public function sample_normal_multivariate(dist) result(rst)

Samples a multivariate normal distribution such that , where is the lower form of the Cholesky factorization of the covariance matrix, and is a randomly generated vector that exists on the set

Arguments

Type IntentOptional Attributes Name
class(multivariate_normal_distribution), intent(in) :: dist

The multivariate normal distribution to sample.

Return Value real(kind=real64), allocatable, dimension(:)

The resulting vector.