prob
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
prob [2012/11/16 12:08] – ignacy | prob [2012/12/06 19:08] – ignacy | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | =====Module Prob===== | + | ======Module Prob====== |
- | + | Ignacy Misztal and Deukhwan Lee, University of Georgia | |
- | + | 04/ | |
- | + | ||
- | + | ||
- | Ignacy Misztal and Deukhwan Lee, University of Georgia | + | |
- | 04/ | + | |
- | + | ||
- | === Introduction === | + | |
Module Prob is a collection of random number generators / probabilities / | Module Prob is a collection of random number generators / probabilities / | ||
Line 18: | Line 11: | ||
Module prob uses high-quality generators from public domain package RANLIB for | Module prob uses high-quality generators from public domain package RANLIB for | ||
- | random number generators. Some low level code is from Luis Varona. | + | random number generators. Some low level code is from Luis Varona.\\ |
+ | ==== Subroutines/ | ||
+ | '' | ||
+ | Sets seed for random number generator to integer n. If this subroutine is not | ||
+ | called, the seed will be selected by the system. \\ | ||
+ | \\ | ||
- | === Module Prob === | + | '' |
- | + | a,b - both real (r*) or both integers or both missing.\\ | |
- | + | If a,b are missing, generates samples from uniform(0, | |
- | === Set_seed === | + | If a,b are real (r8), generates samples from uniform(a, |
- | + | If a,b are integers, generates random integer between a and b \\ | |
- | + | \\ | |
- | call set_seed(n) | + | |
- | + | '' | |
- | n - integer | + | mean - (r8) scalar or vector\\ |
- | + | var - (r8) scalar or square matrix\\ | |
- | Sets seed for random number generator to value n. If this subroutine is not | + | x - (r8) scalar or square matrix\\ |
- | called, the seed will be selected by the system. | + | |
- | + | ||
- | + | ||
- | + | ||
- | === Gen_uniform === | + | |
- | + | ||
- | + | ||
- | + | ||
- | x=gen_uniform(a, | + | |
- | + | ||
- | a,b - both real (r*) or both integers or both missing | + | |
- | + | ||
- | If a,b are missing, generates samples from uniform(0, | + | |
- | + | ||
- | If a,b are real (r8), generates samples from uniform(a, | + | |
- | + | ||
- | If a,b are integers, generates random integer between a and b. | + | |
- | + | ||
- | + | ||
- | + | ||
- | === Gen_normal === | + | |
- | + | ||
- | x - gen_normal(mean, | + | |
- | + | ||
- | mean - (r8) scalar or vector | + | |
- | + | ||
- | var - (r8) scalar or square matrix | + | |
- | + | ||
- | x - (r8) scalar or square matrix | + | |
Generates x=N(mean, | Generates x=N(mean, | ||
x=MVN(mean, | x=MVN(mean, | ||
- | |||
Arguments mean and var are optional. If they are missing, sampling is | Arguments mean and var are optional. If they are missing, sampling is | ||
- | from N(0,1) | + | from N(0,1)\\ |
+ | \\ | ||
+ | '' | ||
+ | inv_q_form - (r8) scalar or square matrix containing inverse of quadratic form\\ | ||
+ | df - an integer containing degrees of freedom\\ | ||
- | === Gen_invwishart === | + | Generates samples from inverted chi square or inverted Wishart distributions.\\ |
+ | \\ | ||
+ | '' | ||
+ | x - real(r8) scalar\\ | ||
+ | y - real (r8) contains density(X) for N(0,1)\\ | ||
+ | \\ | ||
+ | '' | ||
+ | x - real (r8) scalar\\ | ||
+ | y - real (r8) cumulative distribution function for N(0,1)\\ | ||
+ | \\ | ||
- | | + | '' |
- | + | x - real (r8) scalar in the range of <0,1>\\ | |
- | inv_q_form - (r8) scalar or square matrix containing inverse of quadratic form | + | y - real (r8) as in: x=normal_cdf(y)\\ |
- | + | \\ | |
- | df - an integer containing degrees of freedom | + | |
- | + | ||
- | + | ||
- | Generates samples from inverted chi square or inverted Wishart distributions. | + | |
- | + | ||
- | + | ||
- | + | ||
- | === Normal === | + | |
- | + | ||
- | + | ||
- | y=normal(x) | + | |
- | + | ||
- | x - real(r8) scalar | + | |
- | + | ||
- | y - real (r8) contains density(X) for N(0,1) | + | |
- | + | ||
- | + | ||
- | + | ||
- | === Normal_cdf === | + | |
- | + | ||
- | + | ||
- | + | ||
- | y=normal_cdf(x) | + | |
- | + | ||
- | x - real (r8) scalar | + | |
- | + | ||
- | y - real (r8) cumulative distribution function for N(0,1) | + | |
- | + | ||
- | + | ||
- | + | ||
- | === Normal_invcdf === | + | |
- | + | ||
- | + | ||
- | y=normal_invcdf(x) | + | |
- | + | ||
- | x - real (r8) scalar in the range of <0,1>. | + | |
- | + | ||
- | y - - real (r8) as in: x=normal_cdf(y) | + | |
- | + | ||
- | + | ||
- | + | ||
- | === Gen_trunc_normal === | + | |
- | + | ||
- | y=generate_trunc_normal(a, | + | |
- | + | ||
- | y - real (r8) scalar or vector | + | |
- | + | ||
- | a,b - real (r8) lower and upper bound of random samples | + | |
- | + | ||
- | mean - real(r8) scalar or vectors of mean, optional if scalar | + | |
- | + | ||
- | var - real(r8) scalar or matricex of variances, optional if scalar | + | |
+ | '' | ||
+ | y - real (r8) scalar or vector\\ | ||
+ | a,b - real (r8) lower and upper bound of random samples\\ | ||
+ | mean - real(r8) scalar or vectors of mean, optional if scalar\\ | ||
+ | var - real(r8) variance or covariance matrix, optional if scalar\\ | ||
+ | \\ | ||
If mean and var are missing, generates random samples from N(0,1) distribution | If mean and var are missing, generates random samples from N(0,1) distribution | ||
- | truncated to interval < | + | truncated to interval < |
+ | \\ | ||
If mean and var are scalars, generates random samples from N(mean, | If mean and var are scalars, generates random samples from N(mean, | ||
- | distribution truncated to interval < | + | distribution truncated to interval < |
If mean is a vector and var is a matrix, generates random samples from | If mean is a vector and var is a matrix, generates random samples from | ||
- | MVN(mean, | + | MVN(mean, |
+ | \\ | ||
=== Other functions/ | === Other functions/ | ||
Line 149: | Line 84: | ||
- |
prob.txt · Last modified: 2024/03/25 18:22 by 127.0.0.1