📄 randist.texi
字号:
for @math{x > 0}.@comment If @xmath{X} and @xmath{Y} are independent gamma-distributed random@comment variables of order @xmath{a} and @xmath{b}, then @xmath{X+Y} has a gamma@comment distribution of order @xmath{a+b}.@cindex Erlang distributionThe gamma distribution with an integer parameter @var{a} is known as the Erlang distribution.The variates are computed using the algorithms from Knuth (vol 2).@end deftypefun@deftypefun double gsl_ran_gamma_mt (const gsl_rng * @var{r}, double @var{a}, double @var{b})This function returns a gamma variate using the Marsaglia-Tsang fast gamma method.@end deftypefun@deftypefun double gsl_ran_gamma_pdf (double @var{x}, double @var{a}, double @var{b})This function computes the probability density @math{p(x)} at @var{x}for a gamma distribution with parameters @var{a} and @var{b}, using theformula given above.@end deftypefun@sp 1@tex\centerline{\input rand-gamma.tex}@end tex@deftypefun double gsl_cdf_gamma_P (double @var{x}, double @var{a}, double @var{b})@deftypefunx double gsl_cdf_gamma_Q (double @var{x}, double @var{a}, double @var{b})@deftypefunx double gsl_cdf_gamma_Pinv (double @var{P}, double @var{a}, double @var{b})@deftypefunx double gsl_cdf_gamma_Qinv (double @var{Q}, double @var{a}, double @var{b})These functions compute the cumulative distribution functions@math{P(x)}, @math{Q(x)} and their inverses for the gammadistribution with parameters @var{a} and @var{b}.@end deftypefun@page@node The Flat (Uniform) Distribution@section The Flat (Uniform) Distribution@deftypefun double gsl_ran_flat (const gsl_rng * @var{r}, double @var{a}, double @var{b})@cindex flat distribution@cindex uniform distributionThis function returns a random variate from the flat (uniform)distribution from @var{a} to @var{b}. The distribution is,@tex\beforedisplay$$p(x) dx = {1 \over (b-a)} dx$$\afterdisplay@end tex@ifinfo@examplep(x) dx = @{1 \over (b-a)@} dx@end example@end ifinfo@noindentif @c{$a \le x < b$}@math{a <= x < b} and 0 otherwise.@end deftypefun@deftypefun double gsl_ran_flat_pdf (double @var{x}, double @var{a}, double @var{b})This function computes the probability density @math{p(x)} at @var{x}for a uniform distribution from @var{a} to @var{b}, using the formulagiven above.@end deftypefun@sp 1@tex\centerline{\input rand-flat.tex}@end tex@deftypefun double gsl_cdf_flat_P (double @var{x}, double @var{a}, double @var{b})@deftypefunx double gsl_cdf_flat_Q (double @var{x}, double @var{a}, double @var{b})@deftypefunx double gsl_cdf_flat_Pinv (double @var{P}, double @var{a}, double @var{b})@deftypefunx double gsl_cdf_flat_Qinv (double @var{Q}, double @var{a}, double @var{b})These functions compute the cumulative distribution functions@math{P(x)}, @math{Q(x)} and their inverses for a uniform distributionfrom @var{a} to @var{b}.@end deftypefun@page@node The Lognormal Distribution@section The Lognormal Distribution@deftypefun double gsl_ran_lognormal (const gsl_rng * @var{r}, double @var{zeta}, double @var{sigma})@cindex Lognormal distributionThis function returns a random variate from the lognormaldistribution. The distribution function is,@tex\beforedisplay$$p(x) dx = {1 \over x \sqrt{2 \pi \sigma^2}} \exp(-(\ln(x) - \zeta)^2/2 \sigma^2) dx$$\afterdisplay@end tex@ifinfo@examplep(x) dx = @{1 \over x \sqrt@{2 \pi \sigma^2@} @} \exp(-(\ln(x) - \zeta)^2/2 \sigma^2) dx@end example@end ifinfo@noindentfor @math{x > 0}.@end deftypefun@deftypefun double gsl_ran_lognormal_pdf (double @var{x}, double @var{zeta}, double @var{sigma})This function computes the probability density @math{p(x)} at @var{x}for a lognormal distribution with parameters @var{zeta} and @var{sigma},using the formula given above.@end deftypefun@sp 1@tex\centerline{\input rand-lognormal.tex}@end tex@deftypefun double gsl_cdf_lognormal_P (double @var{x}, double @var{zeta}, double @var{sigma})@deftypefunx double gsl_cdf_lognormal_Q (double @var{x}, double @var{zeta}, double @var{sigma})@deftypefunx double gsl_cdf_lognormal_Pinv (double @var{P}, double @var{zeta}, double @var{sigma})@deftypefunx double gsl_cdf_lognormal_Qinv (double @var{Q}, double @var{zeta}, double @var{sigma})These functions compute the cumulative distribution functions@math{P(x)}, @math{Q(x)} and their inverses for the lognormaldistribution with parameters @var{zeta} and @var{sigma}.@end deftypefun@page@node The Chi-squared Distribution@section The Chi-squared DistributionThe chi-squared distribution arises in statistics. If @math{Y_i} are@math{n} independent gaussian random variates with unit variance then thesum-of-squares,@tex\beforedisplay$$X_i = \sum_i Y_i^2$$\afterdisplay@end tex@ifinfo@exampleX_i = \sum_i Y_i^2@end example@end ifinfo@noindenthas a chi-squared distribution with @math{n} degrees of freedom.@deftypefun double gsl_ran_chisq (const gsl_rng * @var{r}, double @var{nu})@cindex Chi-squared distributionThis function returns a random variate from the chi-squared distributionwith @var{nu} degrees of freedom. The distribution function is,@tex\beforedisplay$$p(x) dx = {1 \over 2 \Gamma(\nu/2) } (x/2)^{\nu/2 - 1} \exp(-x/2) dx$$\afterdisplay@end tex@ifinfo@examplep(x) dx = @{1 \over 2 \Gamma(\nu/2) @} (x/2)^@{\nu/2 - 1@} \exp(-x/2) dx@end example@end ifinfo@noindentfor @c{$x \ge 0$}@math{x >= 0}. @end deftypefun@deftypefun double gsl_ran_chisq_pdf (double @var{x}, double @var{nu})This function computes the probability density @math{p(x)} at @var{x}for a chi-squared distribution with @var{nu} degrees of freedom, usingthe formula given above.@end deftypefun@sp 1@tex\centerline{\input rand-chisq.tex}@end tex@deftypefun double gsl_cdf_chisq_P (double @var{x}, double @var{nu})@deftypefunx double gsl_cdf_chisq_Q (double @var{x}, double @var{nu})@deftypefunx double gsl_cdf_chisq_Pinv (double @var{P}, double @var{nu})@deftypefunx double gsl_cdf_chisq_Qinv (double @var{Q}, double @var{nu})These functions compute the cumulative distribution functions@math{P(x)}, @math{Q(x)} and their inverses for the chi-squareddistribution with @var{nu} degrees of freedom.@end deftypefun@page@node The F-distribution@section The F-distributionThe F-distribution arises in statistics. If @math{Y_1} and @math{Y_2}are chi-squared deviates with @math{\nu_1} and @math{\nu_2} degrees offreedom then the ratio,@tex\beforedisplay$$X = { (Y_1 / \nu_1) \over (Y_2 / \nu_2) }$$\afterdisplay@end tex@ifinfo@exampleX = @{ (Y_1 / \nu_1) \over (Y_2 / \nu_2) @}@end example@end ifinfo@noindenthas an F-distribution @math{F(x;\nu_1,\nu_2)}.@deftypefun double gsl_ran_fdist (const gsl_rng * @var{r}, double @var{nu1}, double @var{nu2})@cindex F-distributionThis function returns a random variate from the F-distribution with degrees of freedom @var{nu1} and @var{nu2}. The distribution function is,@tex\beforedisplay$$p(x) dx = { \Gamma((\nu_1 + \nu_2)/2) \over \Gamma(\nu_1/2) \Gamma(\nu_2/2) } \nu_1^{\nu_1/2} \nu_2^{\nu_2/2} x^{\nu_1/2 - 1} (\nu_2 + \nu_1 x)^{-\nu_1/2 -\nu_2/2}$$\afterdisplay@end tex@ifinfo@examplep(x) dx = @{ \Gamma((\nu_1 + \nu_2)/2) \over \Gamma(\nu_1/2) \Gamma(\nu_2/2) @} \nu_1^@{\nu_1/2@} \nu_2^@{\nu_2/2@} x^@{\nu_1/2 - 1@} (\nu_2 + \nu_1 x)^@{-\nu_1/2 -\nu_2/2@}@end example@end ifinfo@noindentfor @c{$x \ge 0$}@math{x >= 0}. @end deftypefun@deftypefun double gsl_ran_fdist_pdf (double @var{x}, double @var{nu1}, double @var{nu2})This function computes the probability density @math{p(x)} at @var{x}for an F-distribution with @var{nu1} and @var{nu2} degrees of freedom,using the formula given above.@end deftypefun@sp 1@tex\centerline{\input rand-fdist.tex}@end tex@deftypefun double gsl_cdf_fdist_P (double @var{x}, double @var{nu1}, double @var{nu2})@deftypefunx double gsl_cdf_fdist_Q (double @var{x}, double @var{nu1}, double @var{nu2})@deftypefunx double gsl_cdf_fdist_Pinv (double @var{P}, double @var{nu1}, double @var{nu2})@deftypefunx double gsl_cdf_fdist_Qinv (double @var{Q}, double @var{nu1}, double @var{nu2})These functions compute the cumulative distribution functions@math{P(x)}, @math{Q(x)} and their inverses for the F-distributionwith @var{nu1} and @var{nu2} degrees of freedom.@end deftypefun@page@node The t-distribution@section The t-distributionThe t-distribution arises in statistics. If @math{Y_1} has a normaldistribution and @math{Y_2} has a chi-squared distribution with@math{\nu} degrees of freedom then the ratio,@tex\beforedisplay$$X = { Y_1 \over \sqrt{Y_2 / \nu} }$$\afterdisplay@end tex@ifinfo@exampleX = @{ Y_1 \over \sqrt@{Y_2 / \nu@} @}@end example@end ifinfo@noindenthas a t-distribution @math{t(x;\nu)} with @math{\nu} degrees of freedom.@deftypefun double gsl_ran_tdist (const gsl_rng * @var{r}, double @var{nu})@cindex t-distribution@cindex Student t-distributionThis function returns a random variate from the t-distribution. Thedistribution function is,@tex\beforedisplay$$p(x) dx = {\Gamma((\nu + 1)/2) \over \sqrt{\pi \nu} \Gamma(\nu/2)} (1 + x^2/\nu)^{-(\nu + 1)/2} dx$$\afterdisplay@end tex@ifinfo@examplep(x) dx = @{\Gamma((\nu + 1)/2) \over \sqrt@{\pi \nu@} \Gamma(\nu/2)@} (1 + x^2/\nu)^@{-(\nu + 1)/2@} dx@end example@end ifinfo@noindentfor @math{-\infty < x < +\infty}.@end deftypefun@deftypefun double gsl_ran_tdist_pdf (double @var{x}, double @var{nu})This function computes the probability density @math{p(x)} at @var{x}for a t-distribution with @var{nu} degrees of freedom, using the formulagiven above.@end deftypefun@sp 1@tex\centerline{\input rand-tdist.tex}@end tex@deftypefun double gsl_cdf_tdist_P (double @var{x}, double @var{nu})@deftypefunx double gsl_cdf_tdist_Q (double @var{x}, double @var{nu})@deftypefunx double gsl_cdf_tdist_Pinv (double @var{P}, double @var{nu})@deftypefunx double gsl_cdf_tdist_Qinv (double @var{Q}, double @var{nu})These functions compute the cumulative distribution functions@math{P(x)}, @math{Q(x)} and their inverses for the t-distributionwith @var{nu} degrees of freedom.@end deftypefun@page@node The Beta Distribution@section The Beta Distribution@deftypefun double gsl_ran_beta (const gsl_rng * @var{r}, double @var{a}, double @var{b})@cindex Beta distributionThis function returns a random variate from the betadistribution. The distribution function is,@tex\beforedisplay$$p(x) dx = {\Gamma(a+b) \over \Gamma(a) \Gamma(b)} x^{a-1} (1-x)^{b-1} dx$$\afterdisplay@end tex@ifinfo@examplep(x) dx = @{\Gamma(a+b) \over \Gamma(a) \Gamma(b)@} x^@{a-1@} (1-x)^@{b-1@} dx@end example@end ifinfo@noindentfor @c{$0 \le x \le 1$}@math{0 <= x <= 1}.@end deftypefun@deftypefun double gsl_ran_beta_pdf (double @var{x}, double @var{a}, double @var{b})This function computes the probability density @math{p(x)} at @var{x}for a beta distribution with parameters @var{a} and @var{b}, using theformula given above.@end deftypefun@sp 1@tex\centerline{\input rand-beta.tex}@end tex@deftypefun double gsl_cdf_beta_P (double @var{x}, double @var{a}, double @var{b})@deftypefunx double gsl_cdf_beta_Q (double @var{x}, double @var{a}, double @var{b})@deftypefunx double gsl_cdf_beta_Pinv (double @var{P}, double @var{a}, double @var{b})@deftypefunx double gsl_cdf_beta_Qinv (double @var{Q}, double @var{a}, double @var{b})These functions compute the cumulative distribution functions@math{P(x)}, @math{Q(x)} and their inverses for the betadistribution with parameters @var{a} and @var{b}.@end deftypefun@page@node The Logistic Distribution@section The Logistic Distribution@deftypefun double gsl_ran_logistic (const gsl_rng * @var{r}, double @var{a})@cindex Logistic distributionThis function returns a random variate from the logisticdistribution. The distribution function is,@tex\beforedisplay$$p(x) dx = { \exp(-x/a) \over a (1 + \exp(-x/a))^2 } dx$$\afterdisplay@end tex@ifinfo@examplep(x) dx = @{ \exp(-x/a) \over a (1 + \exp(-x/a))^2 @} dx@end example@end ifinfo
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -