2 * Introduction to distrib::
3 * Functions and Variables for continuous distributions::
4 * Functions and Variables for discrete distributions::
7 @c Define an m4 macro for the NormalRV function that is used below.
8 @c Can't use @macro because m4 is processed too late for this to work.
9 m4_define(<<<m4_Normal_RV>>>,
10 m4_math(<<<{\rm Normal}($1, $2)>>>, <<<@math{Normal($1, $2)}>>>))
12 @c Define the function student t to denote Student's t random variable
13 m4_define(<<<m4_Student_T_RV>>>,
16 @c Define noncentral Student's t RV
17 m4_define(<<<m4_Noncentral_T_RV>>>,
18 m4_math(<<<{\rm nc\_t}($1, $2)>>>,<<<@math{nc_t($1, $2)}>>>))
20 @c Define Chi^2(n), the chi-squared random variate function.
21 m4_define(<<<m4_Chi2_RV>>>,
22 m4_math(<<<\chi^2($1)>>>, <<<@math{Chi^2($2)}>>>))
24 @c Define the Gamma RV
25 m4_define(<<<m4_Gamma_RV>>>,
26 m4_math(<<<\Gamma\left($1,$2\right)>>>, <<<@math{Gamma($1,$2)}>>>))
28 @c Define the noncentral chi-squared RV
29 m4_define(<<<m4_noncentral_chi2_RV>>>,
30 m4_math(<<<{\rm nc\_Chi}^2($1,$2)>>>, <<<@math{nc_Chi^2($1,$2)}>>>))
32 @c Define the exponential RV
33 m4_define(<<<m4_Exponential_RV>>>,
34 m4_math(<<<{\rm Exponential}($1)>>>, <<<@math{Exponential($1)}>>>))
36 @c Define the Weibull RV
37 m4_define(<<<m4_Weibull_RV>>>,
38 m4_math(<<<{\rm Weibull}($1,$2)>>>, <<<@math{Weibull($1,$2)}>>>))
40 @c Define lognormal RV
41 m4_define(<<<m4_Lognormal_RV>>>,
42 m4_math(<<<{\rm Lognormal}($1,$2)>>>,<<<@math{Lognormal($1,$2)}>>>))
45 m4_define(<<<m4_Beta_RV>>>,
46 m4_math(<<<{\rm Beta}($1,$2)>>>,<<<@math{Beta($1,$2)}>>>))
48 @c Define continuous uniform RV
49 m4_define(<<<m4_Continuous_Uniform_RV>>>,
51 ContinuousUniform}($1,$2)>>>,<<<@math{ContinuousUniform($1,$2)}>>>))
54 m4_define(<<<m4_Logistic_RV>>>,
55 m4_math(<<<{\rm Logistic}($1,$2)>>>,<<<<@math{Logistice($1,$2)}>>>))
58 m4_define(<<<m4_Pareto_RV>>>,
59 m4_math(<<<{\rm Pareto}($1,$2)>>>,<<<@math{Pareto($1,$2)}>>>))
62 m4_define(<<<m4_Rayleigh_RV>>>,
63 m4_math(<<<{\rm Rayleigh}($1)>>>,<<<@math{Rayleigh($1)}>>>))
66 m4_define(<<<m4_Laplace_RV>>>,
67 m4_math(<<<{\rm Laplace}($1,$2)>>>,<<<@math{Laplace($1,$2)}>>>))
70 m4_define(<<<m4_Cauchy_RV>>>,
71 m4_math(<<<{\rm Cauchy}($1,$2)>>>,<<<@math{Cauchy($1,$2)}>>>))
74 m4_define(<<<m4_Gumbel_RV>>>,
75 m4_math(<<<{\rm Gumbel}($1,$2)>>>,<<<@math{Gumbel($1,$2)}>>>))
77 @node Introduction to distrib, Functions and Variables for continuous distributions
78 @section Introduction to distrib
81 Package @code{distrib} contains a set of functions for making probability computations on both discrete and continuous univariate models.
83 What follows is a short reminder of basic probabilistic related definitions.
85 Let @math{f(x)} be the @var{density function} of an absolute continuous random variable @math{X}. The @var{distribution function} is defined as
87 <<<F\left(x\right)=\int_{ -\infty }^{x}{f\left(u\right)\;du}>>>,
99 which equals the probability m4_math(<<<{\rm Pr}(X \le x)>>>, <<<@math{Pr(X <= x)}>>>).
101 The @var{mean} value is a localization parameter and is defined as
103 <<<E\left[X\right]=\int_{ -\infty }^{\infty }{x\,f\left(x\right)\;dx}>>>,
116 The @var{variance} is a measure of variation,
118 <<<V\left[X\right]=\int_{ -\infty }^{\infty }{f\left(x\right)\,\left(x
119 -E\left[X\right]\right)^2\;dx}>>>,
125 V[X] = I f(x) (x - E[X]) dx
131 which is a positive real number. The square root of the variance is
132 the @var{standard deviation}, m4_math(<<<D[x]=\sqrt{V[X]}>>>, <<<@math{D[X]=sqrt(V[X])}>>>), and it is another measure of variation.
134 The @var{skewness coefficient} is a measure of non-symmetry,
136 <<<SK\left[X\right]={{\int_{ -\infty }^{\infty }{f\left(x\right)\,
137 \left(x-E\left[X\right]\right)^3\;dx}}\over{D\left[X\right]^3}}>>>,
143 SK[X] = ----- I f(x) (x - E[X]) dx
150 And the @var{kurtosis coefficient} measures the peakedness of the distribution,
152 <<<KU\left[X\right]={{\int_{ -\infty }^{\infty }{f\left(x\right)\,
153 \left(x-E\left[X\right]\right)^4\;dx}}\over{D\left[X\right]^4}}-3>>>,
159 KU[X] = ----- I f(x) (x - E[X]) dx - 3
165 If @math{X} is gaussian, @math{KU[X]=0}. In fact, both skewness and kurtosis are shape parameters used to measure the non--gaussianity of a distribution.
167 If the random variable @math{X} is discrete, the density, or @var{probability}, function @math{f(x)} takes positive values within certain countable set of numbers @math{x_i}, and zero elsewhere. In this case, the distribution function is
169 <<< F\left(x\right)=\sum_{x_{i}\leq x}{f\left(x_{i}\right)} >>>,
182 The mean, variance, standard deviation, skewness coefficient and kurtosis coefficient take the form
185 E\left[X\right]&=\sum_{x_{i}}{x_{i}f\left(x_{i}\right)}, \cr
186 V\left[X\right]&=\sum_{x_{i}}{f\left(x_{i}\right)\left(x_{i}-E\left[X\right]\right)^2},\cr
187 D\left[X\right]&=\sqrt{V\left[X\right]},\cr
188 SK\left[X\right]&={{\sum_{x_{i}}{f\left(x\right)\,
189 \left(x-E\left[X\right]\right)^3\;dx}}\over{D\left[X\right]^3}}, \cr
190 KU\left[X\right]&={{\sum_{x_{i}}{f\left(x\right)\,
191 \left(x-E\left[X\right]\right)^4\;dx}}\over{D\left[X\right]^4}}-3,
205 V[X] = > f(x ) (x - E[X]) ,
215 SK[X] = ------- > f(x ) (x - E[X])
223 KU[X] = ------- > f(x ) (x - E[X]) - 3 ,
232 There is a naming convention in package @code{distrib}. Every function name has two parts, the first one makes reference to the function or parameter we want to calculate,
235 Density function (pdf_*)
236 Distribution function (cdf_*)
237 Quantile (quantile_*)
240 Standard deviation (std_*)
241 Skewness coefficient (skewness_*)
242 Kurtosis coefficient (kurtosis_*)
243 Random variate (random_*)
246 The second part is an explicit reference to the probabilistic model,
248 Continuous distributions:
252 Noncentral Chi^2 (*noncentral_chi2)
255 Lognormal (*lognormal)
258 Continuous uniform (*continuous_uniform)
267 Discrete distributions:
270 Bernoulli (*bernoulli)
271 Geometric (*geometric)
272 Discrete uniform (*discrete_uniform)
273 hypergeometric (*hypergeometric)
274 Negative binomial (*negative_binomial)
275 Finite discrete (*general_finite_discrete)
278 For example, @code{pdf_student_t(x,n)} is the density function of the Student distribution with @var{n} degrees of freedom, @code{std_pareto(a,b)} is the standard deviation of the Pareto distribution with parameters @var{a} and @var{b} and @code{kurtosis_poisson(m)} is the kurtosis coefficient of the Poisson distribution with mean @var{m}.
281 In order to make use of package @code{distrib} you need first to load it by typing
283 (%i1) load("distrib")$
286 For comments, bugs or suggestions, please contact the author at @var{'riotorto AT yahoo DOT com'}.
288 @opencatbox{Categories:}
289 @category{Statistical functions}
290 @category{Share packages}
291 @category{Package distrib}
297 @node Functions and Variables for continuous distributions, Normal Random Variable, Introduction to distrib
298 @section Functions and Variables for continuous distributions
299 Maxima knows the following kinds of continuous distributions.
302 * Normal Random Variable::
303 * Student's t Random Variable::
304 * Noncentral Student's t Random Variable::
305 * Chi-squared Random Variable::
306 * Noncentral Chi-squared Random Variable::
307 * F Random Variable::
308 * Exponential Random Variable::
309 * Lognormal Random Variable::
310 * Gamma Random Variable::
311 * Beta Random Variable::
312 * Continuous Uniform Random Variable::
313 * Logistic Random Variable::
314 * Pareto Random Variable::
315 * Weibull Random Variable::
316 * Rayleigh Random Variable::
317 * Laplace Random Variable::
318 * Cauchy Random Variable::
319 * Gumbel Random Variable::
322 @node Normal Random Variable, Functions and Variables for discrete distributions, Functions and Variables for continuous distributions
323 @subsection Normal Random Variable
326 * Introduction to Normal Random Variables::
327 * Functions and Variables for Normal Random Variables::
330 @node Introduction to Normal Random Variables
331 @subsubsection Introduction to Normal Random Variables
333 Normal random variables (also called Gaussian) is denoted
334 by m4_Normal_RV(m, s) where
335 @math{m} is the mean and @math{s > 0} is the standard deviation.
337 @node Functions and Variables for Normal Random Variables
338 @subsubsection Functions and Variables for Normal Random Variables
340 @deffn {Function} pdf_normal (@var{x},@var{m},@var{s})
341 Returns the value at @var{x} of the density function of a m4_Normal_RV(m,s) random variable, with @math{s>0}. To make use of this function, write first @code{load("distrib")}.
345 <<<f(x; m, s) = {1\over s\sqrt{2\pi}} e^{\displaystyle -{(x-m)^2\over 2s^2}}>>>,
354 f(x, m, s) = -------------------
359 @opencatbox{Categories:}
360 @category{Package distrib}
367 @deffn {Function} cdf_normal (@var{x},@var{m},@var{s})
368 Returns the value at @var{x} of the distribution function of a m4_Normal_RV(m,s) random variable, with @math{s>0}. This function is defined in terms of Maxima's built-in error function @code{erf}.
370 The cdf can be written analytically:
372 <<<F(x; m, s) = {1\over 2} + {1\over 2} {\rm erf}\left(x-m\over s\sqrt{2}\right)>>>,
378 F(x, m, s) = -------------- + -
385 @c cdf_normal(x,m,s);
388 (%i1) load ("distrib")$
389 (%i2) cdf_normal(x,m,s);
393 (%o2) -------------- + -
397 See also @mrefdot{erf}
399 @opencatbox{Categories:}
400 @category{Package distrib}
406 @anchor{quantile_normal}
407 @deffn {Function} quantile_normal (@var{q},@var{m},@var{s})
408 Returns the @var{q}-quantile of a m4_Normal_RV(m,s) random variable, with @math{s>0}; in other words, this is the inverse of @mrefdot{cdf_normal} Argument @var{q} must be an element of @math{[0,1]}. To make use of this function, write first @code{load("distrib")}.
412 @c quantile_normal(95/100,0,1);
416 (%i1) load ("distrib")$
417 (%i2) quantile_normal(95/100,0,1);
419 (%o2) sqrt(2) inverse_erf(--)
422 (%o3) 1.644853626951472
425 @opencatbox{Categories:}
426 @category{Package distrib}
433 @deffn {Function} mean_normal (@var{m},@var{s})
434 Returns the mean of a m4_Normal_RV(m,s) random variable, with @math{s>0}, namely @var{m}. To make use of this function, write first @code{load("distrib")}.
436 @opencatbox{Categories:}
437 @category{Package distrib}
444 @deffn {Function} var_normal (@var{m},@var{s})
445 Returns the variance of a m4_Normal_RV(m,s) random variable, with @math{s>0}, namely @math{s^2}. To make use of this function, write first @code{load("distrib")}.
447 @opencatbox{Categories:}
448 @category{Package distrib}
454 @deffn {Function} std_normal (@var{m},@var{s})
455 Returns the standard deviation of a m4_Normal_RV(m,s) random variable, with @math{s>0}, namely @var{s}. To make use of this function, write first @code{load("distrib")}.
457 @opencatbox{Categories:}
458 @category{Package distrib}
464 @anchor{skewness_normal}
465 @deffn {Function} skewness_normal (@var{m},@var{s})
466 Returns the skewness coefficient of a m4_Normal_RV(m,s) random variable, with @math{s>0}, which is always equal to 0. To make use of this function, write first @code{load("distrib")}.
468 @opencatbox{Categories:}
469 @category{Package distrib}
475 @anchor{kurtosis_normal}
476 @deffn {Function} kurtosis_normal (@var{m},@var{s})
477 Returns the kurtosis coefficient of a m4_Normal_RV(m,s) random variable, with @math{s>0}, which is always equal to 0. To make use of this function, write first @code{load("distrib")}.
479 @opencatbox{Categories:}
480 @category{Package distrib}
486 @anchor{random_normal}
487 @deffn {Function} random_normal (@var{m},@var{s}) @
488 @fname{random_normal} (@var{m},@var{s},@var{n})
490 Returns a m4_Normal_RV(m,s) random variate, with @math{s>0}. Calling @code{random_normal} with a third argument @var{n}, a random sample of size @var{n} will be simulated.
492 This is an implementation of the Box-Mueller algorithm, as described in Knuth, D.E. (1981) @var{Seminumerical Algorithms. The Art of Computer Programming.} Addison-Wesley.
494 To make use of this function, write first @code{load("distrib")}.
496 @opencatbox{Categories:}
497 @category{Package distrib}
498 @category{Random numbers}
503 @node Student's t Random Variable, Noncentral Student's t Random Variable, Normal Random Variable, Normal Random Variable
504 @subsection Student's t Random Variable
507 * Introduction to Student's t Random Variable::
508 * Functions and Variables for Student's t Random Variable::
511 @node Introduction to Student's t Random Variable
512 @subsubsection Introduction to Student's t Random Variable
514 Student's t random variable is denoted by m4_Student_T_RV(n) where
515 @math{n} is the degrees of freedom with @math{n > 0}. If @math{Z} is
516 a m4_Normal_RV(0,1) variable and @math{V} is an
517 independent m4_math(\chi^2, chi^2) random variable with @math{n} degress of
521 <<<Z \over \sqrt{V/n}>>>,
522 <<<@math{Z/sqrt(V/n)}>>>)
524 has a Student's @math{t}-distribution with @math{n} degrees of freedom.
526 @node Functions and Variables for Student's t Random Variable
527 @subsubsection Functions and Variables for Student's t Random Variable
528 @anchor{pdf_student_t}
529 @deffn {Function} pdf_student_t (@var{x},@var{n})
530 Returns the value at @var{x} of the density function of a Student random variable m4_Student_T_RV(n), with @math{n>0} degrees of freedom. To make use of this function, write first @code{load("distrib")}.
534 <<<f(x; n) = \left[\sqrt{n} B\left({1\over 2}, {n\over 2}\right)\right]^{-1}
535 \left(1+{x^2\over n}\right)^{\displaystyle -{n+1\over 2}}>>>,
541 gamma(-----) (-- + 1)
543 f(x, n) = ------------------------------
545 sqrt(%pi) gamma(-) sqrt(n)
548 @math{(sqrt(n)*beta(1/2,n/2))^(-1) (1+x^2/n)^(-(n+1)/2)}>>>)
550 @opencatbox{Categories:}
551 @category{Package distrib}
557 @anchor{cdf_student_t}
558 @deffn {Function} cdf_student_t (@var{x},@var{n})
559 Returns the value at @var{x} of the distribution function of a Student random variable m4_Student_T_RV(n), with @math{n>0} degrees of freedom.
565 1-\displaystyle{1\over 2} I_t\left({n\over 2}, {1\over 2}\right) & $x \ge 0$ \cr
567 \displaystyle{1\over 2} I_t\left({n\over 2}, {1\over 2}\right) & $x < 0$
571 [ 1-1/2*I_t(n/2, 1/2) x >= 0
573 [ 1/2*I_t(n/2, 1/2) x < 0
577 where m4_math(<<<t = n/(n+x^2)>>>, <<<@math{t = n/(n+x^2)}>>>) and m4_math(<<<I_t(a,b)>>>, <<<@math{I_t(a,b)}>>>) is the
578 @ref{beta_incomplete_regularized} function.
582 @c cdf_student_t(1/2, 7/3);
586 (%i1) load ("distrib")$
587 (%i2) cdf_student_t(1/2, 7/3);
589 beta_incomplete_regularized(-, -, --)
591 (%o2) 1 - -------------------------------------
594 (%o3) .6698450596140415
597 @opencatbox{Categories:}
598 @category{Package distrib}
604 @anchor{quantile_student_t}
605 @deffn {Function} quantile_student_t (@var{q},@var{n})
606 Returns the @var{q}-quantile of a Student random variable m4_Student_T_RV(n), with @math{n>0}; in other words, this is the inverse of @code{cdf_student_t}. Argument @var{q} must be an element of @math{[0,1]}. To make use of this function, write first @code{load("distrib")}.
608 @opencatbox{Categories:}
609 @category{Package distrib}
615 @anchor{mean_student_t}
616 @deffn {Function} mean_student_t (@var{n})
617 Returns the mean of a Student random variable m4_Student_T_RV(n), with @math{n>0}, which is always equal to 0. To make use of this function, write first @code{load("distrib")}.
619 @opencatbox{Categories:}
620 @category{Package distrib}
626 @anchor{var_student_t}
627 @deffn {Function} var_student_t (@var{n})
628 Returns the variance of a Student random variable m4_Student_T_RV(n), with @math{n>2}.
635 (%i1) load ("distrib")$
636 (%i2) var_student_t(n);
642 @opencatbox{Categories:}
643 @category{Package distrib}
649 @anchor{std_student_t}
650 @deffn {Function} std_student_t (@var{n})
651 Returns the standard deviation of a Student random variable m4_Student_T_RV(n), with @math{n>2}. To make use of this function, write first @code{load("distrib")}.
653 @opencatbox{Categories:}
654 @category{Package distrib}
660 @anchor{skewness_student_t}
661 @deffn {Function} skewness_student_t (@var{n})
662 Returns the skewness coefficient of a Student random variable m4_Student_T_RV(n), with @math{n>3}, which is always equal to 0. To make use of this function, write first @code{load("distrib")}.
664 @opencatbox{Categories:}
665 @category{Package distrib}
671 @anchor{kurtosis_student_t}
672 @deffn {Function} kurtosis_student_t (@var{n})
673 Returns the kurtosis coefficient of a Student random variable m4_Student_T_RV(n), with @math{n>4}. To make use of this function, write first @code{load("distrib")}.
675 @opencatbox{Categories:}
676 @category{Package distrib}
682 @anchor{random_student_t}
683 @deffn {Function} random_student_t (@var{n}) @
684 @fname{random_student_t} (@var{n},@var{m})
686 Returns a Student random variate m4_Student_T_RV(n), with @math{n>0}. Calling @code{random_student_t} with a second argument @var{m}, a random sample of size @var{m} will be simulated.
688 The implemented algorithm is based on the fact that if @math{Z} is a
689 normal random variable m4_Normal_RV(0,1) and @math{S^2} is
690 a m4_math(\chi^2, chi squared) random variable with @math{n} degrees of
691 freedom, m4_Chi2_RV(n), then
694 <<<X={{Z}\over{\sqrt{{S^2}\over{n}}}}>>>,
705 is a Student random variable with @math{n} degrees of freedom, m4_Student_T_RV(n).
707 To make use of this function, write first @code{load("distrib")}.
709 @opencatbox{Categories:}
710 @category{Package distrib}
711 @category{Random numbers}
716 @node Noncentral Student's t Random Variable, Chi-squared Random Variable, Student's t Random Variable, Normal Random Variable
717 @subsection Noncentral Student's t Random Variable
720 * Introduction to Noncentral Student's t Random Variable::
721 * Functions and Variables for Noncentral Student's t Random Variable::
724 @node Introduction to Noncentral Student's t Random Variable
725 @subsubsection Introduction to Noncentral Student's t Random Variable
726 Let @math{ncp} be the non-centrality parameter, @math{n} be the
727 degrees of freedom for the non-central Student's @math{t} random
730 Then let @math{X} be a m4_Normal_RV(n,ncp) and @math{S^2} be an independent m4_math(\chi^2,
731 chi squared) random variable with @math{n} degrees of freedom, the
734 <<<U = {X \over \sqrt{S^2\over n}}>>>,
735 <<<@math{U = X/sqrt(S^2/n)}>>>)
737 has a non-central Student's @math{t} distribution with non-centrality
738 parameter @math{ncp}.
740 @node Functions and Variables for Noncentral Student's t Random Variable
741 @subsubsection Functions and Variables for Noncentral Student's t Random Variable
743 @anchor{pdf_noncentral_student_t}
744 @deffn {Function} pdf_noncentral_student_t (@var{x},@var{n},@var{ncp})
745 Returns the value at @var{x} of the density function of a noncentral Student random variable m4_Noncentral_T_RV(n,ncp), with @math{n>0} degrees of freedom and noncentrality parameter @math{ncp}. To make use of this function, write first @code{load("distrib")}.
749 <<<f(x; n, \mu) = \left[\sqrt{n} B\left({1\over 2}, {n\over
750 2}\right)\right]^{-1}\left(1+{x^2\over n}\right)^{-{(n+1)/2}}
752 \bigg[A_n(x; \mu) + B_n(x; \mu)\bigg]>>>,
759 %e (x + 1) (B(x, n, mu) + An(x, n, mu))
760 f(x;n,mu) = -------------------------------------------------
770 A_n(x;\mu) &= {}_1F_1\left({n+1\over 2}; {1\over 2}; {\mu^2 x^2\over
771 2\left(x^2+n\right)}\right) \cr
772 B_n(x;\mu) &= {\sqrt{2}\mu x \over \sqrt{x^2+n}} {\Gamma\left({n\over
773 2} + 1\right)\over \Gamma\left({n+1\over 2}\right)}\;
774 {}_1F_1\left({n\over 2} + 1; {3\over 2}; {\mu^2 x^2\over
775 2\left(x^2+n\right)}\right)
781 A(x, n, mu) = %f ([-----], [-], ----------)
787 sqrt(2) mu %f ([- + 1], [-], ----------) gamma(- + 1) x
790 B(x, n, mu) = ----------------------------------------------------------
792 gamma(-----) sqrt(x + n)
796 and m4_math(\mu, mu) is the non-centrality parameter @math{ncp}.
798 Sometimes an extra work is necessary to get the final result.
802 @c expand(pdf_noncentral_student_t(3,5,0.1));
806 (%i1) load ("distrib")$
807 (%i2) expand(pdf_noncentral_student_t(3,5,0.1));
810 0.04296414417400905 5 1.323650307289301e-6 5
811 (%o2) ------------------------ + -------------------------
815 1.94793720435093e-4 5
816 + ------------------------
820 (%o3) .02080593159405669
823 @opencatbox{Categories:}
824 @category{Package distrib}
830 @anchor{cdf_noncentral_student_t}
831 @deffn {Function} cdf_noncentral_student_t (@var{x},@var{n},@var{ncp})
832 Returns the value at @var{x} of the distribution function of a noncentral Student random variable m4_Noncentral_T_RV(n,ncp), with @math{n>0} degrees of freedom and noncentrality parameter @math{ncp}. This function has no closed form and it is numerically computed.
836 @c cdf_noncentral_student_t(-2,5,-5);
839 (%i1) load ("distrib")$
840 (%i2) cdf_noncentral_student_t(-2,5,-5);
841 (%o2) .9952030093319743
844 @opencatbox{Categories:}
845 @category{Package distrib}
851 @anchor{quantile_noncentral_student_t}
852 @deffn {Function} quantile_noncentral_student_t (@var{q},@var{n},@var{ncp})
853 Returns the @var{q}-quantile of a noncentral Student random variable m4_Noncentral_T_RV(n,ncp), with @math{n>0} degrees of freedom and noncentrality parameter @math{ncp}; in other words, this is the inverse of @code{cdf_noncentral_student_t}. Argument @var{q} must be an element of @math{[0,1]}. To make use of this function, write first @code{load("distrib")}.
855 @opencatbox{Categories:}
856 @category{Package distrib}
862 @anchor{mean_noncentral_student_t}
863 @deffn {Function} mean_noncentral_student_t (@var{n},@var{ncp})
864 Returns the mean of a noncentral Student random variable m4_Noncentral_T_RV(n,ncp), with @math{n>1} degrees of freedom and noncentrality parameter @math{ncp}. To make use of this function, write first @code{load("distrib")}.
868 <<<\mu \sqrt{n}\; \Gamma\left(\displaystyle{n-1\over 2}\right) \over
869 \sqrt{2}\;\Gamma\left(\displaystyle{n\over 2}\right)>>>,
873 mu gamma(-----) sqrt(n)
875 -----------------------
882 where m4_math(\mu, mu) is the noncentrality parameter @math{ncp}.
886 @c mean_noncentral_student_t(df,k);
889 (%i1) load ("distrib")$
890 (%i2) mean_noncentral_student_t(df,k);
892 gamma(------) sqrt(df) k
894 (%o2) ------------------------
900 @opencatbox{Categories:}
901 @category{Package distrib}
907 @anchor{var_noncentral_student_t}
908 @deffn {Function} var_noncentral_student_t (@var{n},@var{ncp})
909 Returns the variance of a noncentral Student random variable m4_Noncentral_T_RV(n,ncp), with @math{n>2} degrees of freedom and noncentrality parameter @math{ncp}. To make use of this function, write first @code{load("distrib")}.
913 <<<{n(\mu^2+1)\over n-2} - {n\mu^2\; \Gamma\left(\displaystyle{n-1\over 2}\right)^2
914 \over 2\Gamma\left(\displaystyle{n\over 2}\right)^2}>>>,
918 2 gamma (-----) n ncp
920 ------------ - --------------------
927 where m4_math(\mu, mu) is the noncentrality parameter @math{ncp}.
929 @opencatbox{Categories:}
930 @category{Package distrib}
936 @anchor{std_noncentral_student_t}
937 @deffn {Function} std_noncentral_student_t (@var{n},@var{ncp})
938 Returns the standard deviation of a noncentral Student random variable m4_Noncentral_T_RV(n,ncp), with @math{n>2} degrees of freedom and noncentrality parameter @math{ncp}. To make use of this function, write first @code{load("distrib")}.
940 @opencatbox{Categories:}
941 @category{Package distrib}
947 @anchor{skewness_noncentral_student_t}
948 @deffn {Function} skewness_noncentral_student_t (@var{n},@var{ncp})
949 Returns the skewness coefficient of a noncentral Student random variable m4_Noncentral_T_RV(n,ncp), with @math{n>3} degrees of freedom and noncentrality parameter @math{ncp}. To make use of this function, write first @code{load("distrib")}.
951 @c The TeX form is obtained from
952 @c tex(skewness_noncentral_student_t(n,mu)). Likewise the info form
953 @c is just cut-n-pasted from maxima's terminal output.
954 If @math{U} is a non-central Student's @math{t} random variable with
955 @math{n} degrees of freedom and a noncentrality parameter m4_math(\mu,
956 @math{mu}), the skewness is
960 {\mu\sqrt{n}\,\Gamma\left({{n-1}\over{2}}\right)
961 \over{\sqrt{2}\Gamma\left({{n
962 }\over{2}}\right)\sigma^{3}}}\left({{n
963 \left(2n+\mu^2-3\right)}\over{\left(n-3\right)\left(n-2\right)}}
964 -2\sigma^2\right) \cr
965 \sigma^2 &= {{n\left(\mu^2+1\right)}\over{n-2}}-{{n \mu^2\,
966 \Gamma\left({{n-1}\over{2}}\right)^2}\over{2\Gamma\left({{n
967 }\over{2}}\right)^2}}
972 skewness_noncentral_student_t(n, mu) =
974 n - 1 n (2 n + mu - 3)
975 (mu gamma(-----) sqrt(n) (-----------------
980 - 2 (----------- - -------------------)))
987 /(sqrt(2) gamma(-) (----------- - -------------------) )
994 @opencatbox{Categories:}
995 @category{Package distrib}
1001 @anchor{kurtosis_noncentral_student_t}
1002 @deffn {Function} kurtosis_noncentral_student_t (@var{n},@var{ncp})
1003 Returns the kurtosis coefficient of a noncentral Student random variable m4_Noncentral_T_RV(n,ncp), with @math{n>4} degrees of freedom and noncentrality parameter @math{ncp}. To make use of this function, write first @code{load("distrib")}.
1005 If @math{U} is a non-central Student's @math{t} random variable with
1006 @math{n} degrees of freedom and a noncentrality parameter m4_math(\mu,
1007 @math{mu}), the kurtosis is
1009 @c The formula we see can be basically derived by computing
1010 @c (kurtosis_noncentral_student_t(n,mu)+3)*var_noncentral_student_t(n,mu)^2,
1011 @c which comes from the definition of kurtosis. The rest is then
1012 @c obtained by replacing a constant by F.
1016 {\mu_4\over \sigma^4} - 3\cr
1017 \mu_4 &= {{\left(\mu^4+6\mu^2+3\right)n^2}\over{(n-4)(n-2)}}
1018 -\left({{n\left(3(3n-5)+\mu^2(n+1)\right)
1019 }\over{(n-3)(n-2)}}-3\sigma^2\right) F \cr
1020 \sigma^2 &= {{n\left(\mu^2+1\right)}\over{n-2}}-{{n \mu^2
1021 \Gamma\left({{n-1}\over{2}}\right)^2}\over{2\Gamma\left({{n
1022 }\over{2}}\right)^2}} \cr
1023 F &= {n\mu^2\Gamma\left({n-1\over 2}\right)^2 \over
1024 2\sigma^4\Gamma\left({n\over 2}\right)^2}
1028 kurtosis_noncentral_student_t(n, mu) =
1030 (mu + 6 mu + 3) n 2 2 n - 1
1031 (-------------------- - (mu gamma (-----) n
1034 2 2 mu gamma (-----) n
1035 n (3 (3 n - 5) + mu (n + 1)) (mu + 1) n 2
1036 (----------------------------- - 3 (----------- - -------------------)))
1037 (n - 3) (n - 2) n - 2 2 n
1041 2 mu gamma (-----) n
1043 /(2 gamma (-)))/(----------- - -------------------) - 3
1050 @opencatbox{Categories:}
1051 @category{Package distrib}
1057 @anchor{random_noncentral_student_t}
1058 @deffn {Function} random_noncentral_student_t (@var{n},@var{ncp}) @
1059 @fname{random_noncentral_student_t} (@var{n},@var{ncp},@var{m})
1061 Returns a noncentral Student random variate m4_Noncentral_T_RV(n,ncp), with @math{n>0}. Calling @code{random_noncentral_student_t} with a third argument @var{m}, a random sample of size @var{m} will be simulated.
1063 The implemented algorithm is based on the fact that if @var{X} is a
1064 normal random variable m4_Normal_RV(ncp,1) and @math{S^2} is
1065 a m4_math(\chi^2, chi square) random variable with @var{n} degrees of freedom, m4_Chi2_RV(n), then
1067 <<<U={{X}\over{\sqrt{{S^2}\over{n}}}}>>>,
1078 is a noncentral Student random variable with @math{n} degrees of freedom and noncentrality parameter @math{ncp}, m4_Noncentral_T_RV(n,ncp).
1080 To make use of this function, write first @code{load("distrib")}.
1082 @opencatbox{Categories:}
1083 @category{Package distrib}
1084 @category{Random numbers}
1090 @node Chi-squared Random Variable, Noncentral Chi-squared Random Variable, Noncentral Student's t Random Variable, Normal Random Variable
1091 @subsection Chi-squared Random Variable
1094 * Introduction to Chi-squared Random Variable::
1095 * Functions and Variables for Chi-squared Random Variable::
1098 @node Introduction to Chi-squared Random Variable
1099 @subsubsection Introduction to Chi-squared Random Variable
1101 Let m4_math(<<<X_1, X_2, \ldots, X_n>>>, <<<@math{X_1, X_2, ...,
1102 X_k}>>>) be independent and identically distributed m4_Normal_RV(0,1) variables. Then
1104 <<<X^2 = \sum_{i=1}^n X_i^2>>>,
1105 <<<@math{X^2 = sum(X_i^2, i, 1, n)}>>>)
1107 is said to follow a chi-square distribution with @math{n} degrees of
1110 @node Functions and Variables for Chi-squared Random Variable
1111 @subsubsection Functions and Variables for Chi-squared Random Variable
1114 @deffn {Function} pdf_chi2 (@var{x},@var{n})
1115 Returns the value at @var{x} of the density function of a Chi-square random variable m4_Chi2_RV(n), with @math{n>0}.
1116 The m4_Chi2_RV(n) random variable is equivalent to the m4_Gamma_RV(n/2,2).
1123 \displaystyle{x^{n/2-1} e^{-x/2} \over 2^{n/2}
1124 \Gamma\left(\displaystyle{n\over 2}\right)} & for $x
1133 [ ----------------------------- for x >= 0
1135 f(x, n) = [ gamma(-) 2
1143 @c load ("distrib")$
1147 (%i1) load ("distrib")$
1148 (%i2) pdf_chi2(x,n);
1151 (%o2) ----------------
1157 @opencatbox{Categories:}
1158 @category{Package distrib}
1165 @deffn {Function} cdf_chi2 (@var{x},@var{n})
1166 Returns the value at @math{x} of the distribution function of a Chi-square random variable m4_Chi2_RV(n), with @math{n>0}.
1172 1 - Q\left(\displaystyle{n\over 2}, {x\over 2}\right) & $x > 0$ \cr
1178 [ (1 - Q(-, -)) for x >= 0
1184 where @math{Q(a,z)} is the @ref{gamma_incomplete_regularized} function.
1187 @c load ("distrib")$
1192 (%i1) load ("distrib")$
1193 (%i2) cdf_chi2(3,4);
1195 (%o2) 1 - gamma_incomplete_regularized(2, -)
1198 (%o3) .4421745996289256
1201 @opencatbox{Categories:}
1202 @category{Package distrib}
1208 @anchor{quantile_chi2}
1209 @deffn {Function} quantile_chi2 (@var{q},@var{n})
1210 Returns the @var{q}-quantile of a Chi-square random variable m4_Chi2_RV(n), with @math{n>0}; in other words, this is the inverse of @code{cdf_chi2}. Argument @var{q} must be an element of @math{[0,1]}.
1212 This function has no closed form and it is numerically computed.
1215 @c load ("distrib")$
1216 @c quantile_chi2(0.99,9);
1219 (%i1) load ("distrib")$
1220 (%i2) quantile_chi2(0.99,9);
1221 (%o2) 21.66599433346194
1224 @opencatbox{Categories:}
1225 @category{Package distrib}
1232 @deffn {Function} mean_chi2 (@var{n})
1233 Returns the mean of a Chi-square random variable m4_Chi2_RV(n), with @math{n>0}.
1235 The m4_Chi2_RV(n) random variable is equivalent to the m4_Gamma_RV(n/2,2).
1238 @c load ("distrib")$
1242 (%i1) load ("distrib")$
1247 @opencatbox{Categories:}
1248 @category{Package distrib}
1255 @deffn {Function} var_chi2 (@var{n})
1256 Returns the variance of a Chi-square random variable m4_Chi2_RV(n), with @math{n>0}.
1258 The m4_Chi2_RV(n) random variable is equivalent to the m4_Gamma_RV(n/2,2).
1261 @c load ("distrib")$
1265 (%i1) load ("distrib")$
1270 @opencatbox{Categories:}
1271 @category{Package distrib}
1278 @deffn {Function} std_chi2 (@var{n})
1279 Returns the standard deviation of a Chi-square random variable m4_Chi2_RV(n), with @math{n>0}.
1281 The m4_Chi2_RV(n) random variable is equivalent to the m4_Gamma_RV(n/2,2).
1284 @c load ("distrib")$
1288 (%i1) load ("distrib")$
1290 (%o2) sqrt(2) sqrt(n)
1293 @opencatbox{Categories:}
1294 @category{Package distrib}
1300 @anchor{skewness_chi2}
1301 @deffn {Function} skewness_chi2 (@var{n})
1302 Returns the skewness coefficient of a Chi-square random variable m4_Chi2_RV(n), with @math{n>0}.
1304 The m4_Chi2_RV(n) random variable is equivalent to the m4_Gamma_RV(n/2,2).
1307 @c load ("distrib")$
1308 @c skewness_chi2(n);
1311 (%i1) load ("distrib")$
1312 (%i2) skewness_chi2(n);
1319 @opencatbox{Categories:}
1320 @category{Package distrib}
1326 @anchor{kurtosis_chi2}
1327 @deffn {Function} kurtosis_chi2 (@var{n})
1328 Returns the kurtosis coefficient of a Chi-square random variable m4_Chi2_RV(n), with @math{n>0}.
1330 The m4_Chi2_RV(n) random variable is equivalent to the m4_Gamma_RV(n/2,2).
1333 @c load ("distrib")$
1334 @c kurtosis_chi2(n);
1337 (%i1) load ("distrib")$
1338 (%i2) kurtosis_chi2(n);
1344 @opencatbox{Categories:}
1345 @category{Package distrib}
1351 @anchor{random_chi2}
1352 @deffn {Function} random_chi2 (@var{n}) @
1353 @fname{random_chi2} (@var{n},@var{m})
1355 Returns a Chi-square random variate m4_Chi2_RV(n), with @math{n>0}. Calling @code{random_chi2} with a second argument @var{m}, a random sample of size @var{m} will be simulated.
1357 The simulation is based on the Ahrens-Cheng algorithm. See @code{random_gamma} for details.
1359 To make use of this function, write first @code{load("distrib")}.
1361 @opencatbox{Categories:}
1362 @category{Package distrib}
1363 @category{Random numbers}
1369 @node Noncentral Chi-squared Random Variable, F Random Variable, Chi-squared Random Variable, Normal Random Variable
1370 @subsection Noncentral Chi-squared Random Variable
1372 * Introduction to Noncentral Chi-squared Random Variable::
1373 * Functions and Variables for Noncentral Chi-squared Random Variable::
1376 @node Introduction to Noncentral Chi-squared Random Variable
1377 @subsubsection Introduction to Noncentral Chi-squared Random Variable
1379 Let m4_math(<<<X_1, X_2, ..., X_n>>>, <<<@math{X[1], X[2], ..., X[n]}>>>) be @math{n}
1380 independent normally distributed random variables with
1381 means m4_math(\mu_k, mu[k]) and unit variances. Then the random variable
1384 <<<\sum_{k=1}^n X_k^2>>>,
1385 <<<@math{sum(X[k]^2, k, 1, n)}>>>)
1387 has a noncentral m4_math(\chi^2, chi-squared) distribution. The
1388 number of degrees of freedom is @math{n}, and the noncentrality
1389 parameter is defined by
1392 <<<\sum_{k=1}^n \mu_k^2>>>,
1393 <<<@math{sum(mu[k]^2, k, 1, n)}>>>)
1396 @node Functions and Variables for Noncentral Chi-squared Random Variable
1397 @subsubsection Functions and Variables for Noncentral Chi-squared Random Variable
1398 @anchor{pdf_noncentral_chi2}
1399 @deffn {Function} pdf_noncentral_chi2 (@var{x},@var{n},@var{ncp})
1400 Returns the value at @math{x} of the density function of a
1401 noncentral m4_math(\chi^2, Chi-square) random
1402 variable m4_noncentral_chi2(n,ncp), with @math{n>0} and noncentrality parameter @math{ncp>=0}. To
1403 make use of this function, write first @code{load("distrib")}.
1405 For @math{x < 0}, the pdf is 0, and for m4_math(x \ge 0, @math{x >= 0}) the pdf is
1407 <<<f(x; n, \lambda) =
1408 {1\over 2}e^{-(x+\lambda)/2} \left(x\over
1409 \lambda\right)^{n/4-1/2}I_{{n\over 2} - 1}\left(\sqrt{n \lambda}\right)
1417 bessel_i(- - 1, sqrt(ncp x)) (---) %e unit_step(x)
1419 ----------------------------------------------------------------------
1424 @opencatbox{Categories:}
1425 @category{Package distrib}
1431 @anchor{cdf_noncentral_chi2}
1432 @deffn {Function} cdf_noncentral_chi2 (@var{x},@var{n},@var{ncp})
1433 Returns the value at @var{x} of the distribution function of a noncentral Chi-square random variable m4_noncentral_chi2(n,ncp), with @math{n>0} and noncentrality parameter @math{ncp>=0}. To make use of this function, write first @code{load("distrib")}.
1435 @opencatbox{Categories:}
1436 @category{Package distrib}
1442 @anchor{quantile_noncentral_chi2}
1443 @deffn {Function} quantile_noncentral_chi2 (@var{q},@var{n},@var{ncp})
1444 Returns the @var{q}-quantile of a noncentral Chi-square random variable m4_noncentral_chi2(n,ncp), with @math{n>0} and noncentrality parameter @math{ncp>=0}; in other words, this is the inverse of @code{cdf_noncentral_chi2}. Argument @var{q} must be an element of @math{[0,1]}.
1446 This function has no closed form and it is numerically computed.
1448 @opencatbox{Categories:}
1449 @category{Package distrib}
1455 @anchor{mean_noncentral_chi2}
1456 @deffn {Function} mean_noncentral_chi2 (@var{n},@var{ncp})
1457 Returns the mean of a noncentral Chi-square random variable m4_noncentral_chi2(n,ncp), with @math{n>0} and noncentrality parameter @math{ncp>=0}.
1459 @opencatbox{Categories:}
1460 @category{Package distrib}
1466 @anchor{var_noncentral_chi2}
1467 @deffn {Function} var_noncentral_chi2 (@var{n},@var{ncp})
1468 Returns the variance of a noncentral Chi-square random variable m4_noncentral_chi2(n,ncp), with @math{n>0} and noncentrality parameter @math{ncp>=0}.
1470 @opencatbox{Categories:}
1471 @category{Package distrib}
1477 @anchor{std_noncentral_chi2}
1478 @deffn {Function} std_noncentral_chi2 (@var{n},@var{ncp})
1479 Returns the standard deviation of a noncentral Chi-square random variable m4_noncentral_chi2(n,ncp), with @math{n>0} and noncentrality parameter @math{ncp>=0}.
1481 @opencatbox{Categories:}
1482 @category{Package distrib}
1488 @anchor{skewness_noncentral_chi2}
1489 @deffn {Function} skewness_noncentral_chi2 (@var{n},@var{ncp})
1490 Returns the skewness coefficient of a noncentral Chi-square random variable m4_noncentral_chi2(n,ncp), with @math{n>0} and noncentrality parameter @math{ncp>=0}.
1492 @opencatbox{Categories:}
1493 @category{Package distrib}
1499 @anchor{kurtosis_noncentral_chi2}
1500 @deffn {Function} kurtosis_noncentral_chi2 (@var{n},@var{ncp})
1501 Returns the kurtosis coefficient of a noncentral Chi-square random variable m4_noncentral_chi2(n,ncp), with @math{n>0} and noncentrality parameter @math{ncp>=0}.
1503 @opencatbox{Categories:}
1504 @category{Package distrib}
1510 @anchor{random_noncentral_chi2}
1511 @deffn {Function} random_noncentral_chi2 (@var{n},@var{ncp}) @
1512 @fname{random_noncentral_chi2} (@var{n},@var{ncp},@var{m})
1514 Returns a noncentral Chi-square random variate m4_noncentral_chi2(n,ncp), with @math{n>0} and noncentrality parameter @math{ncp>=0}. Calling @code{random_noncentral_chi2} with a third argument @var{m}, a random sample of size @var{m} will be simulated.
1516 To make use of this function, write first @code{load("distrib")}.
1518 @opencatbox{Categories:}
1519 @category{Package distrib}
1520 @category{Random numbers}
1527 @node F Random Variable, Exponential Random Variable, Noncentral Chi-squared Random Variable, Normal Random Variable
1528 @subsection F Random Variable
1530 * Introduction to F Random Variable::
1531 * Functions and Variables for F Random Variable::
1534 @node Introduction to F Random Variable
1535 @subsubsection Introduction to F Random Variable
1536 Let @math{S_1} and @math{S_2} be independent random variables with
1537 a m4_math(\chi^2, chi-squared) distribution with degrees of freedom
1538 @math{n} and @math{m}, respectively. Then
1540 <<<F = {S_1/n \over S_2/m}>>>,
1541 <<<@math{F = (S_1/n)/(S_2/m)}>>>) has an @math{F} distribution with @math{n} and @math{m} degrees of
1544 @node Functions and Variables for F Random Variable
1545 @subsubsection Functions and Variables for F Random Variable
1547 @deffn {Function} pdf_f (@var{x},@var{m},@var{n})
1548 Returns the value at @var{x} of the density function of a F random variable @math{F(m,n)}, with @math{m,n>0}. To make use of this function, write first @code{load("distrib")}.
1554 B\left(\displaystyle{n\over 2}, \displaystyle{m\over 2}\right)^{-1}
1555 \left(\displaystyle{n\over m}\right)^{n/ 2}
1557 \left(1 + \displaystyle{n\over m}x\right)^{-\left(n+m\right)/2} & $x >
1567 n n/2 n + m n/2 - 1 n x 2
1568 (-) gamma(-----) x (--- + 1) unit_step(x)
1570 ------------------------------------------------------------
1577 @opencatbox{Categories:}
1578 @category{Package distrib}
1585 @deffn {Function} cdf_f (@var{x},@var{m},@var{n})
1586 Returns the value at @var{x} of the distribution function of a F random variable @math{F(m,n)}, with @math{m,n>0}.
1592 1 - I_z\left(\displaystyle{n\over 2}, {m\over 2}\right) & $x > 0$ \cr
1598 F(x, n, m) = (1 - beta_incomplete_regularized(-, -, -------))
1607 <<<z = {m\over nx+m}>>>,
1610 and m4_math(I_z(a,b)) is the @ref{beta_incomplete_regularized}
1614 @c load ("distrib")$
1619 (%i1) load ("distrib")$
1620 (%i2) cdf_f(2,3,9/4);
1622 (%o2) 1 - beta_incomplete_regularized(-, -, --)
1625 (%o3) 0.66756728179008
1628 @opencatbox{Categories:}
1629 @category{Package distrib}
1636 @deffn {Function} quantile_f (@var{q},@var{m},@var{n})
1637 Returns the @var{q}-quantile of a F random variable @math{F(m,n)}, with @math{m,n>0}; in other words, this is the inverse of @code{cdf_f}. Argument @var{q} must be an element of @math{[0,1]}.
1640 @c load ("distrib")$
1641 @c quantile_f(2/5,sqrt(3),5);
1644 (%i1) load ("distrib")$
1645 (%i2) quantile_f(2/5,sqrt(3),5);
1646 (%o2) 0.518947838573693
1649 @opencatbox{Categories:}
1650 @category{Package distrib}
1657 @deffn {Function} mean_f (@var{m},@var{n})
1658 Returns the mean of a F random variable @math{F(m,n)}, with @math{m>0, n>2}. To make use of this function, write first @code{load("distrib")}.
1660 @opencatbox{Categories:}
1661 @category{Package distrib}
1668 @deffn {Function} var_f (@var{m},@var{n})
1669 Returns the variance of a F random variable @math{F(m,n)}, with @math{m>0, n>4}. To make use of this function, write first @code{load("distrib")}.
1671 @opencatbox{Categories:}
1672 @category{Package distrib}
1679 @deffn {Function} std_f (@var{m},@var{n})
1680 Returns the standard deviation of a F random variable @math{F(m,n)}, with @math{m>0, n>4}. To make use of this function, write first @code{load("distrib")}.
1682 @opencatbox{Categories:}
1683 @category{Package distrib}
1690 @deffn {Function} skewness_f (@var{m},@var{n})
1691 Returns the skewness coefficient of a F random variable @math{F(m,n)}, with @math{m>0, n>6}. To make use of this function, write first @code{load("distrib")}.
1693 @opencatbox{Categories:}
1694 @category{Package distrib}
1701 @deffn {Function} kurtosis_f (@var{m},@var{n})
1702 Returns the kurtosis coefficient of a F random variable @math{F(m,n)}, with @math{m>0, n>8}. To make use of this function, write first @code{load("distrib")}.
1704 @opencatbox{Categories:}
1705 @category{Package distrib}
1712 @deffn {Function} random_f (@var{m},@var{n}) @
1713 @fname{random_f} (@var{m},@var{n},@var{k})
1715 Returns a F random variate @math{F(m,n)}, with @math{m,n>0}. Calling @code{random_f} with a third argument @var{k}, a random sample of size @var{k} will be simulated.
1717 The simulation algorithm is based on the fact that if @var{X} is a @math{Chi^2(m)} random variable and @math{Y} is a m4_Chi2_RV(n) random variable, then
1719 <<<F={{n X}\over{m Y}}>>>,
1727 is a F random variable with @var{m} and @var{n} degrees of freedom, @math{F(m,n)}.
1729 To make use of this function, write first @code{load("distrib")}.
1731 @opencatbox{Categories:}
1732 @category{Package distrib}
1733 @category{Random numbers}
1739 @node Exponential Random Variable, Lognormal Random Variable, F Random Variable, Normal Random Variable
1740 @subsection Exponential Random Variable
1742 * Introduction to Exponential Random Variable::
1743 * Functions and Variables for Exponential Random Variable::
1746 @node Introduction to Exponential Random Variable
1747 @subsubsection Introduction to Exponential Random Variable
1748 The @emph{exponential distribution} is the probablity distribution of
1749 the time between events in a process where the events occur
1750 continuously and independently at a constant average rate.
1752 @node Functions and Variables for Exponential Random Variable
1753 @subsubsection Functions and Variables for Exponential Random Variable
1755 @deffn {Function} pdf_exp (@var{x},@var{m})
1756 Returns the value at @var{x} of the density function of an m4_Exponential_RV(m) random variable, with @math{m>0}.
1758 The m4_Exponential_RV(m) random variable is equivalent to the m4_Weibull_RV(1,1/m).
1764 me^{-mx} & for $x \ge 0$ \cr
1768 [ m*exp(-m*x) for x >= 0
1774 @c load ("distrib")$
1778 (%i1) load ("distrib")$
1784 @opencatbox{Categories:}
1785 @category{Package distrib}
1792 @deffn {Function} cdf_exp (@var{x},@var{m})
1793 Returns the value at @var{x} of the distribution function of an m4_Exponential_RV(m) random variable, with @math{m>0}.
1795 The m4_Exponential_RV(m) random variable is equivalent to the m4_Weibull_RV(1,1/m).
1801 1 - e^{-mx} & $x \ge 0$ \cr
1806 [ 1 - exp(-m*x) for x >= 0
1812 @c load ("distrib")$
1816 (%i1) load ("distrib")$
1822 @opencatbox{Categories:}
1823 @category{Package distrib}
1829 @anchor{quantile_exp}
1830 @deffn {Function} quantile_exp (@var{q},@var{m})
1831 Returns the @var{q}-quantile of an m4_Exponential_RV(m) random variable, with @math{m>0}; in other words, this is the inverse of @code{cdf_exp}. Argument @var{q} must be an element of @math{[0,1]}.
1833 The m4_Exponential_RV(m) random variable is equivalent to the m4_Weibull_RV(1,1/m).
1836 @c load ("distrib")$
1837 @c quantile_exp(0.56,5);
1838 @c quantile_exp(0.56,m);
1841 (%i1) load ("distrib")$
1842 (%i2) quantile_exp(0.56,5);
1843 (%o2) .1641961104139661
1844 (%i3) quantile_exp(0.56,m);
1846 (%o3) ------------------
1850 @opencatbox{Categories:}
1851 @category{Package distrib}
1858 @deffn {Function} mean_exp (@var{m})
1859 Returns the mean of an m4_Exponential_RV(m) random variable, with @math{m>0}.
1861 The m4_Exponential_RV(m) random variable is equivalent to the m4_Weibull_RV(1,1/m).
1864 @c load ("distrib")$
1868 (%i1) load ("distrib")$
1875 @opencatbox{Categories:}
1876 @category{Package distrib}
1883 @deffn {Function} var_exp (@var{m})
1884 Returns the variance of an m4_Exponential_RV(m) random variable, with @math{m>0}.
1886 The m4_Exponential_RV(m) random variable is equivalent to the m4_Weibull_RV(1,1/m).
1889 @c load ("distrib")$
1893 (%i1) load ("distrib")$
1901 @opencatbox{Categories:}
1902 @category{Package distrib}
1909 @deffn {Function} std_exp (@var{m})
1910 Returns the standard deviation of an m4_Exponential_RV(m) random variable, with @math{m>0}.
1912 The m4_Exponential_RV(m) random variable is equivalent to the m4_Weibull_RV(1,1/m).
1915 @c load ("distrib")$
1919 (%i1) load ("distrib")$
1926 @opencatbox{Categories:}
1927 @category{Package distrib}
1933 @anchor{skewness_exp}
1934 @deffn {Function} skewness_exp (@var{m})
1935 Returns the skewness coefficient of an m4_Exponential_RV(m) random variable, with @math{m>0}.
1937 The m4_Exponential_RV(m) random variable is equivalent to the m4_Weibull_RV(1,1/m).
1940 @c load ("distrib")$
1944 (%i1) load ("distrib")$
1945 (%i2) skewness_exp(m);
1949 @opencatbox{Categories:}
1950 @category{Package distrib}
1956 @anchor{kurtosis_exp}
1957 @deffn {Function} kurtosis_exp (@var{m})
1958 Returns the kurtosis coefficient of an m4_Exponential_RV(m) random variable, with @math{m>0}.
1960 The m4_Exponential_RV(m) random variable is equivalent to the m4_Weibull_RV(1,1/m).
1963 @c load ("distrib")$
1967 (%i1) load ("distrib")$
1968 (%i2) kurtosis_exp(m);
1972 @opencatbox{Categories:}
1973 @category{Package distrib}
1980 @deffn {Function} random_exp (@var{m}) @
1981 @fname{random_exp} (@var{m},@var{k})
1983 Returns an m4_Exponential_RV(m) random variate, with @math{m>0}. Calling @code{random_exp} with a second argument @var{k}, a random sample of size @var{k} will be simulated.
1985 The simulation algorithm is based on the general inverse method.
1987 To make use of this function, write first @code{load("distrib")}.
1989 @opencatbox{Categories:}
1990 @category{Package distrib}
1991 @category{Random numbers}
1997 @node Lognormal Random Variable, Gamma Random Variable, Exponential Random Variable, Normal Random Variable
1998 @subsection Lognormal Random Variable
2000 * Introduction to Lognormal Random Variable::
2001 * Functions and Variables for Lognormal Random Variable::
2004 @node Introduction to Lognormal Random Variable
2005 @subsubsection Introduction to Lognormal Random Variable
2006 The @emph{lognormal} distribution is distribution for a random
2007 variable whose logarithm is normally distributed.
2009 @node Functions and Variables for Lognormal Random Variable
2010 @subsubsection Functions and Variables for Lognormal Random Variable
2011 @anchor{pdf_lognormal}
2012 @deffn {Function} pdf_lognormal (@var{x},@var{m},@var{s})
2013 Returns the value at @var{x} of the density function of a m4_Lognormal_RV(m,s) random variable, with @math{s>0}. To make use of this function, write first @code{load("distrib")}.
2019 \displaystyle{1\over x s \sqrt{2\pi}}
2020 \exp\left(-\displaystyle{\left(\log x - m\right)^2\over 2s^2}\right) & for $x \ge
2033 f(x, m, s) = [ --------------------- for x >= 0
2034 [ sqrt(2) sqrt(%pi) s x
2039 @opencatbox{Categories:}
2040 @category{Package distrib}
2046 @anchor{cdf_lognormal}
2047 @deffn {Function} cdf_lognormal (@var{x},@var{m},@var{s})
2048 Returns the value at @var{x} of the distribution function of a m4_Lognormal_RV(m,s) random variable, with @math{s>0}. This function is defined in terms of Maxima's built-in error function @code{erf}.
2051 @c load ("distrib")$
2052 @c cdf_lognormal(x,m,s);
2055 (%i1) load ("distrib")$
2056 (%i2) cdf_lognormal(x,m,s);
2061 (%o2) --------------- + -
2066 See also @mrefdot{erf}
2068 @opencatbox{Categories:}
2069 @category{Package distrib}
2075 @anchor{quantile_lognormal}
2076 @deffn {Function} quantile_lognormal (@var{q},@var{m},@var{s})
2077 Returns the @var{q}-quantile of a m4_Lognormal_RV(m,s) random variable, with @math{s>0}; in other words, this is the inverse of @code{cdf_lognormal}. Argument @var{q} must be an element of @math{[0,1]}. To make use of this function, write first @code{load("distrib")}.
2080 @c load ("distrib")$
2081 @c quantile_lognormal(95/100,0,1);
2085 (%i1) load ("distrib")$
2086 (%i2) quantile_lognormal(95/100,0,1);
2087 sqrt(2) inverse_erf(9/10)
2090 (%o3) 5.180251602233015
2093 @opencatbox{Categories:}
2094 @category{Package distrib}
2100 @anchor{mean_lognormal}
2101 @deffn {Function} mean_lognormal (@var{m},@var{s})
2102 Returns the mean of a m4_Lognormal_RV(m,s) random variable, with @math{s>0}. To make use of this function, write first @code{load("distrib")}.
2104 @opencatbox{Categories:}
2105 @category{Package distrib}
2111 @anchor{var_lognormal}
2112 @deffn {Function} var_lognormal (@var{m},@var{s})
2113 Returns the variance of a m4_Lognormal_RV(m,s) random variable, with @math{s>0}. To make use of this function, write first @code{load("distrib")}.
2115 @opencatbox{Categories:}
2116 @category{Package distrib}
2121 @anchor{std_lognormal}
2122 @deffn {Function} std_lognormal (@var{m},@var{s})
2123 Returns the standard deviation of a m4_Lognormal_RV(m,s) random variable, with @math{s>0}. To make use of this function, write first @code{load("distrib")}.
2125 @opencatbox{Categories:}
2126 @category{Package distrib}
2132 @anchor{skewness_lognormal}
2133 @deffn {Function} skewness_lognormal (@var{m},@var{s})
2134 Returns the skewness coefficient of a m4_Lognormal_RV(m,s) random variable, with @math{s>0}. To make use of this function, write first @code{load("distrib")}.
2136 @opencatbox{Categories:}
2137 @category{Package distrib}
2143 @anchor{kurtosis_lognormal}
2144 @deffn {Function} kurtosis_lognormal (@var{m},@var{s})
2145 Returns the kurtosis coefficient of a m4_Lognormal_RV(m,s) random variable, with @math{s>0}. To make use of this function, write first @code{load("distrib")}.
2147 @opencatbox{Categories:}
2148 @category{Package distrib}
2154 @anchor{random_lognormal}
2155 @deffn {Function} random_lognormal (@var{m},@var{s}) @
2156 @fname{random_lognormal} (@var{m},@var{s},@var{n})
2158 Returns a m4_Lognormal_RV(m,s) random variate, with @math{s>0}. Calling @code{random_lognormal} with a third argument @var{n}, a random sample of size @var{n} will be simulated.
2160 Log-normal variates are simulated by means of random normal variates. See @code{random_normal} for details.
2162 To make use of this function, write first @code{load("distrib")}.
2164 @opencatbox{Categories:}
2165 @category{Package distrib}
2166 @category{Random numbers}
2172 @node Gamma Random Variable, Beta Random Variable, Lognormal Random Variable, Normal Random Variable
2173 @subsection Gamma Random Variable
2175 * Introduction to Gamma Random Variable::
2176 * Functions and Variables for Gamma Random Variable::
2179 @node Introduction to Gamma Random Variable
2180 @subsubsection Introduction to Gamma Random Variable
2181 The @emph{gamma distribution} is a two-parameter family of probability
2182 distributions. Maxima uses the parameterization using the shape and
2183 scale for the first and second parameters of the distribution.
2185 @node Functions and Variables for Gamma Random Variable
2186 @subsubsection Functions and Variables for Gamma Random Variable
2188 @deffn {Function} pdf_gamma (@var{x},@var{a},@var{b})
2189 Returns the value at @var{x} of the density function of a m4_Gamma_RV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2191 The shape parameter is @math{a}, and the scale parameter is @math{b}.
2195 <<<f(x; a, b) = {x^{a-1}e^{-x/b}\over b^a \Gamma(a)}>>>,
2200 f(x, a, b) = ---------------------------
2206 @opencatbox{Categories:}
2207 @category{Package distrib}
2214 @deffn {Function} cdf_gamma (@var{x},@var{a},@var{b})
2215 Returns the value at @var{x} of the distribution function of a m4_Gamma_RV(a,b) random variable, with @math{a,b>0}.
2221 1-Q(a,{x\over b}) & for $x \ge 0$ \cr
2227 [ 1 - Q(a,x/b) for x>= 0
2232 where @math{Q(a,z)} is the @ref{gamma_incomplete_regularized} function.
2234 @c load ("distrib")$
2235 @c cdf_gamma(3,5,21);
2239 (%i1) load ("distrib")$
2240 (%i2) cdf_gamma(3,5,21);
2242 (%o2) 1 - gamma_incomplete_regularized(5, -)
2245 (%o3) 4.402663157376807E-7
2248 @opencatbox{Categories:}
2249 @category{Package distrib}
2255 @anchor{quantile_gamma}
2256 @deffn {Function} quantile_gamma (@var{q},@var{a},@var{b})
2257 Returns the @var{q}-quantile of a m4_Gamma_RV(a,b) random variable, with @math{a,b>0}; in other words, this is the inverse of @code{cdf_gamma}. Argument @var{q} must be an element of @math{[0,1]}. To make use of this function, write first @code{load("distrib")}.
2259 @opencatbox{Categories:}
2260 @category{Package distrib}
2267 @deffn {Function} mean_gamma (@var{a},@var{b})
2268 Returns the mean of a m4_Gamma_RV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2270 @opencatbox{Categories:}
2271 @category{Package distrib}
2278 @deffn {Function} var_gamma (@var{a},@var{b})
2279 Returns the variance of a m4_Gamma_RV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2281 @opencatbox{Categories:}
2282 @category{Package distrib}
2288 @deffn {Function} std_gamma (@var{a},@var{b})
2289 Returns the standard deviation of a m4_Gamma_RV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2291 @opencatbox{Categories:}
2292 @category{Package distrib}
2298 @anchor{skewness_gamma}
2299 @deffn {Function} skewness_gamma (@var{a},@var{b})
2300 Returns the skewness coefficient of a m4_Gamma_RV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2302 @opencatbox{Categories:}
2303 @category{Package distrib}
2309 @anchor{kurtosis_gamma}
2310 @deffn {Function} kurtosis_gamma (@var{a},@var{b})
2311 Returns the kurtosis coefficient of a m4_Gamma_RV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2313 @opencatbox{Categories:}
2314 @category{Package distrib}
2320 @anchor{random_gamma}
2321 @deffn {Function} random_gamma (@var{a},@var{b}) @
2322 @fname{random_gamma} (@var{a},@var{b},@var{n})
2324 Returns a m4_Gamma_RV(a,b) random variate, with @math{a,b>0}. Calling @code{random_gamma} with a third argument @var{n}, a random sample of size @var{n} will be simulated.
2326 The implemented algorithm is a combination of two procedures, depending on the value of parameter @var{a}:
2328 For @math{a>=1}, Cheng, R.C.H. and Feast, G.M. (1979). @var{Some simple gamma variate generators}. Appl. Stat., 28, 3, 290-295.
2330 For @math{0<a<1}, Ahrens, J.H. and Dieter, U. (1974). @var{Computer methods for sampling from gamma, , poisson and binomial cdf_tributions}. Computing, 12, 223-246.
2332 To make use of this function, write first @code{load("distrib")}.
2334 @opencatbox{Categories:}
2335 @category{Package distrib}
2336 @category{Random numbers}
2342 @node Beta Random Variable, Continuous Uniform Random Variable, Gamma Random Variable, Normal Random Variable
2343 @subsection Beta Random Variable
2345 * Introduction to Beta Random Variable::
2346 * Functions and Variables for Beta Random Variable::
2349 @node Introduction to Beta Random Variable
2350 @subsubsection Introduction to Beta Random Variable
2351 The @emph{beta} distribution is a family of distributions defined over
2352 @math{[0,1]} parameterized by two positive shape parameters @math{a},
2355 @node Functions and Variables for Beta Random Variable
2356 @subsubsection Functions and Variables for Beta Random Variable
2358 @deffn {Function} pdf_beta (@var{x},@var{a},@var{b})
2359 Returns the value at @var{x} of the density function of a m4_Beta_RV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2361 For m4_math(<<<0 \le x \le 1>>>, <<<@math{0 <= x <= 1}>>>), the pdf is
2365 {1\over B(a,b)}x^{a-1}(1-x)^{b-1} & for $0 \le x \le 1$ \cr
2372 f(x, a, b) = [ ------------------- for 0 <= x <= 1
2378 Otherwise, the pdf is 0.
2380 @opencatbox{Categories:}
2381 @category{Package distrib}
2389 @deffn {Function} cdf_beta (@var{x},@var{a},@var{b})
2390 Returns the value at @var{x} of the distribution function of a m4_Beta_RV(a,b) random variable, with @math{a,b>0}.
2397 I_x(a,b) & $0 \le x \le 1$ \cr
2404 F(x, a, b) = [ beta_incomplete_regularized(a, b, x) for 0 <= x <= 1
2410 @c load ("distrib")$
2411 @c cdf_beta(1/3,15,2);
2415 (%i1) load ("distrib")$
2416 (%i2) cdf_beta(1/3,15,2);
2421 (%o3) 7.666089131388195E-7
2424 @opencatbox{Categories:}
2425 @category{Package distrib}
2431 @anchor{quantile_beta}
2432 @deffn {Function} quantile_beta (@var{q},@var{a},@var{b})
2433 Returns the @var{q}-quantile of a m4_Beta_RV(a,b) random variable, with @math{a,b>0}; in other words, this is the inverse of @code{cdf_beta}. Argument @var{q} must be an element of @math{[0,1]}. To make use of this function, write first @code{load("distrib")}.
2435 @opencatbox{Categories:}
2436 @category{Package distrib}
2443 @deffn {Function} mean_beta (@var{a},@var{b})
2444 Returns the mean of a m4_Beta_RV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2446 @opencatbox{Categories:}
2447 @category{Package distrib}
2454 @deffn {Function} var_beta (@var{a},@var{b})
2455 Returns the variance of a m4_Beta_RV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2457 @opencatbox{Categories:}
2458 @category{Package distrib}
2464 @deffn {Function} std_beta (@var{a},@var{b})
2465 Returns the standard deviation of a m4_Beta_RV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2467 @opencatbox{Categories:}
2468 @category{Package distrib}
2474 @anchor{skewness_beta}
2475 @deffn {Function} skewness_beta (@var{a},@var{b})
2476 Returns the skewness coefficient of a m4_Beta_RV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2478 @opencatbox{Categories:}
2479 @category{Package distrib}
2485 @anchor{kurtosis_beta}
2486 @deffn {Function} kurtosis_beta (@var{a},@var{b})
2487 Returns the kurtosis coefficient of a m4_Beta_RV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2489 @opencatbox{Categories:}
2490 @category{Package distrib}
2496 @anchor{random_beta}
2497 @deffn {Function} random_beta (@var{a},@var{b}) @
2498 @fname{random_beta} (@var{a},@var{b},@var{n})
2500 Returns a m4_Beta_RV(a,b) random variate, with @math{a,b>0}. Calling @code{random_beta} with a third argument @var{n}, a random sample of size @var{n} will be simulated.
2502 The implemented algorithm is defined in Cheng, R.C.H. (1978). @var{Generating Beta Variates with Nonintegral Shape Parameters}. Communications of the ACM, 21:317-322
2504 To make use of this function, write first @code{load("distrib")}.
2506 @opencatbox{Categories:}
2507 @category{Package distrib}
2508 @category{Random numbers}
2513 @node Continuous Uniform Random Variable, Logistic Random Variable, Beta Random Variable, Normal Random Variable
2514 @subsection Continuous Uniform Random Variable
2516 * Introduction to Continuous Uniform Random Variable::
2517 * Functions and Variables for Continuous Uniform Random Variable::
2520 @node Introduction to Continuous Uniform Random Variable
2521 @subsubsection Introduction to Continuous Uniform Random Variable
2522 The @emph{continuous uniform} distribution is constant over the
2523 interval @math{[a,b]} and is zero elsewhere.
2524 @node Functions and Variables for Continuous Uniform Random Variable
2525 @subsubsection Functions and Variables for Continuous Uniform Random Variable
2526 @anchor{pdf_continuous_uniform}
2527 @deffn {Function} pdf_continuous_uniform (@var{x},@var{a},@var{b})
2528 Returns the value at @var{x} of the density function of a m4_Continuous_Uniform_RV(a,b) random variable, with @math{a<b}. To make use of this function, write first @code{load("distrib")}.
2530 The pdf for m4_math(<<<x \in [0,1]>>>, <<<@math{x in [0,1]}>>>) is
2534 \displaystyle{1\over b-a} & for $0 \le x \le 1$ \cr
2540 [ 1/(b-a) for 0 <= x <= 1
2544 @math{f(x,a,b) = 1/(b-a)}>>>)
2547 @opencatbox{Categories:}
2548 @category{Package distrib}
2554 @anchor{cdf_continuous_uniform}
2555 @deffn {Function} cdf_continuous_uniform (@var{x},@var{a},@var{b})
2556 Returns the value at @var{x} of the distribution function of a m4_Continuous_Uniform_RV(a,b) random variable, with @math{a<b}. To make use of this function, write first @code{load("distrib")}.
2564 \displaystyle{x-a\over b-a} & for $a \le x \le b$ \cr
2571 F(x,a,b) = [ (x-a)/(b-a) for a <= x <= b
2575 @opencatbox{Categories:}
2576 @category{Package distrib}
2582 @anchor{quantile_continuous_uniform}
2583 @deffn {Function} quantile_continuous_uniform (@var{q},@var{a},@var{b})
2584 Returns the @var{q}-quantile of a m4_Continuous_Uniform_RV(a,b) random variable, with @math{a<b}; in other words, this is the inverse of @code{cdf_continuous_uniform}. Argument @var{q} must be an element of @math{[0,1]}. To make use of this function, write first @code{load("distrib")}.
2586 @opencatbox{Categories:}
2587 @category{Package distrib}
2593 @anchor{mean_continuous_uniform}
2594 @deffn {Function} mean_continuous_uniform (@var{a},@var{b})
2595 Returns the mean of a m4_Continuous_Uniform_RV(a,b) random variable, with @math{a<b}. To make use of this function, write first @code{load("distrib")}.
2597 @opencatbox{Categories:}
2598 @category{Package distrib}
2604 @anchor{var_continuous_uniform}
2605 @deffn {Function} var_continuous_uniform (@var{a},@var{b})
2606 Returns the variance of a m4_Continuous_Uniform_RV(a,b) random variable, with @math{a<b}. To make use of this function, write first @code{load("distrib")}.
2608 @opencatbox{Categories:}
2609 @category{Package distrib}
2614 @anchor{std_continuous_uniform}
2615 @deffn {Function} std_continuous_uniform (@var{a},@var{b})
2616 Returns the standard deviation of a m4_Continuous_Uniform_RV(a,b) random variable, with @math{a<b}. To make use of this function, write first @code{load("distrib")}.
2618 @opencatbox{Categories:}
2619 @category{Package distrib}
2625 @anchor{skewness_continuous_uniform}
2626 @deffn {Function} skewness_continuous_uniform (@var{a},@var{b})
2627 Returns the skewness coefficient of a m4_Continuous_Uniform_RV(a,b) random variable, with @math{a<b}. To make use of this function, write first @code{load("distrib")}.
2629 @opencatbox{Categories:}
2630 @category{Package distrib}
2636 @anchor{kurtosis_continuous_uniform}
2637 @deffn {Function} kurtosis_continuous_uniform (@var{a},@var{b})
2638 Returns the kurtosis coefficient of a m4_Continuous_Uniform_RV(a,b) random variable, with @math{a<b}. To make use of this function, write first @code{load("distrib")}.
2640 @opencatbox{Categories:}
2641 @category{Package distrib}
2647 @anchor{random_continuous_uniform}
2648 @deffn {Function} random_continuous_uniform (@var{a},@var{b}) @
2649 @fname{random_continuous_uniform} (@var{a},@var{b},@var{n})
2651 Returns a m4_Continuous_Uniform_RV(a,b) random variate, with @math{a<b}. Calling @code{random_continuous_uniform} with a third argument @var{n}, a random sample of size @var{n} will be simulated.
2653 This is a direct application of the @code{random} built-in Maxima function.
2655 See also @mrefdot{random} To make use of this function, write first @code{load("distrib")}.
2657 @opencatbox{Categories:}
2658 @category{Package distrib}
2659 @category{Random numbers}
2665 @node Logistic Random Variable, Pareto Random Variable, Continuous Uniform Random Variable, Normal Random Variable
2666 @subsection Logistic Random Variable
2668 * Introduction to Logistic Random Variable::
2669 * Functions and Variables for Logistic Random Variable::
2672 @node Introduction to Logistic Random Variable
2673 @subsubsection Introduction to Logistic Random Variable
2674 The @emph{logistic} distribution is a continuous distribution where
2675 it's cumulative distribution function is the logistic function.
2677 @node Functions and Variables for Logistic Random Variable
2678 @subsubsection Functions and Variables for Logistic Random Variable
2679 @anchor{pdf_logistic}
2680 @deffn {Function} pdf_logistic (@var{x},@var{a},@var{b})
2681 Returns the value at @var{x} of the density function of a m4_Logistic_RV(a,b) random variable , with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
2683 @math{a} is the location parameter and @math{b} is the scale
2688 <<<f(x; a, b) = {e^{-(x-a)/b} \over b\left(1 + e^{-(x-a)/b}\right)^2}>>>,
2695 f(x, a, b) = ----------------
2702 @opencatbox{Categories:}
2703 @category{Package distrib}
2709 @anchor{cdf_logistic}
2710 @deffn {Function} cdf_logistic (@var{x},@var{a},@var{b})
2711 Returns the value at @var{x} of the distribution function of a m4_Logistic_RV(a,b) random variable , with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
2715 <<<F(x; a, b) = {1\over 1+e^{-(x-a)/b}}>>>,
2716 <<<@math{1/(1+exp(-(x-a)/b))}>>>)
2718 @opencatbox{Categories:}
2719 @category{Package distrib}
2725 @anchor{quantile_logistic}
2726 @deffn {Function} quantile_logistic (@var{q},@var{a},@var{b})
2727 Returns the @var{q}-quantile of a m4_Logistic_RV(a,b) random variable , with @math{b>0}; in other words, this is the inverse of @code{cdf_logistic}. Argument @var{q} must be an element of @math{[0,1]}. To make use of this function, write first @code{load("distrib")}.
2729 @opencatbox{Categories:}
2730 @category{Package distrib}
2736 @anchor{mean_logistic}
2737 @deffn {Function} mean_logistic (@var{a},@var{b})
2738 Returns the mean of a m4_Logistic_RV(a,b) random variable , with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
2740 @opencatbox{Categories:}
2741 @category{Package distrib}
2747 @anchor{var_logistic}
2748 @deffn {Function} var_logistic (@var{a},@var{b})
2749 Returns the variance of a m4_Logistic_RV(a,b) random variable , with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
2751 @opencatbox{Categories:}
2752 @category{Package distrib}
2758 @anchor{std_logistic}
2759 @deffn {Function} std_logistic (@var{a},@var{b})
2760 Returns the standard deviation of a m4_Logistic_RV(a,b) random variable , with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
2762 @opencatbox{Categories:}
2763 @category{Package distrib}
2769 @anchor{skewness_logistic}
2770 @deffn {Function} skewness_logistic (@var{a},@var{b})
2771 Returns the skewness coefficient of a m4_Logistic_RV(a,b) random variable , with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
2773 @opencatbox{Categories:}
2774 @category{Package distrib}
2780 @anchor{kurtosis_logistic}
2781 @deffn {Function} kurtosis_logistic (@var{a},@var{b})
2782 Returns the kurtosis coefficient of a m4_Logistic_RV(a,b) random variable , with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
2784 @opencatbox{Categories:}
2785 @category{Package distrib}
2791 @anchor{random_logistic}
2792 @deffn {Function} random_logistic (@var{a},@var{b}) @
2793 @fname{random_logistic} (@var{a},@var{b},@var{n})
2795 Returns a m4_Logistic_RV(a,b) random variate, with @math{b>0}. Calling @code{random_logistic} with a third argument @var{n}, a random sample of size @var{n} will be simulated.
2797 The implemented algorithm is based on the general inverse method.
2799 To make use of this function, write first @code{load("distrib")}.
2801 @opencatbox{Categories:}
2802 @category{Package distrib}
2803 @category{Random numbers}
2809 @node Pareto Random Variable, Weibull Random Variable, Logistic Random Variable, Normal Random Variable
2810 @subsection Pareto Random Variable
2812 * Introduction to Pareto Random Variable::
2813 * Functions and Variables for Pareto Random Variable::
2816 @node Introduction to Pareto Random Variable
2817 @subsubsection Introduction to Pareto Random Variable
2818 @node Functions and Variables for Pareto Random Variable
2819 @subsubsection Functions and Variables for Pareto Random Variable
2821 @deffn {Function} pdf_pareto (@var{x},@var{a},@var{b})
2822 Returns the value at @var{x} of the density function of a m4_Pareto_RV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2828 \displaystyle{a b^a \over x^{a+1}} & for $x \ge b$ \cr
2834 [ a*b^a/x^(a+1) for x >= b
2840 @opencatbox{Categories:}
2841 @category{Package distrib}
2848 @deffn {Function} cdf_pareto (@var{x},@var{a},@var{b})
2849 Returns the value at @var{x} of the distribution function of a m4_Pareto_RV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2855 1-\left(\displaystyle{b\over x}\right)^a & for $x \ge b$\cr
2860 [ 1 - (b/x)^a for x >= 0
2865 @opencatbox{Categories:}
2866 @category{Package distrib}
2872 @anchor{quantile_pareto}
2873 @deffn {Function} quantile_pareto (@var{q},@var{a},@var{b})
2874 Returns the @var{q}-quantile of a m4_Pareto_RV(a,b) random variable, with @math{a,b>0}; in other words, this is the inverse of @code{cdf_pareto}. Argument @var{q} must be an element of @math{[0,1]}. To make use of this function, write first @code{load("distrib")}.
2876 @opencatbox{Categories:}
2877 @category{Package distrib}
2883 @anchor{mean_pareto}
2884 @deffn {Function} mean_pareto (@var{a},@var{b})
2885 Returns the mean of a m4_Pareto_RV(a,b) random variable, with @math{a>1,b>0}. To make use of this function, write first @code{load("distrib")}.
2887 @opencatbox{Categories:}
2888 @category{Package distrib}
2895 @deffn {Function} var_pareto (@var{a},@var{b})
2896 Returns the variance of a m4_Pareto_RV(a,b) random variable, with @math{a>2,b>0}. To make use of this function, write first @code{load("distrib")}.
2898 @opencatbox{Categories:}
2899 @category{Package distrib}
2905 @deffn {Function} std_pareto (@var{a},@var{b})
2906 Returns the standard deviation of a m4_Pareto_RV(a,b) random variable, with @math{a>2,b>0}. To make use of this function, write first @code{load("distrib")}.
2908 @opencatbox{Categories:}
2909 @category{Package distrib}
2916 @anchor{skewness_pareto}
2917 @deffn {Function} skewness_pareto (@var{a},@var{b})
2918 Returns the skewness coefficient of a m4_Pareto_RV(a,b) random variable, with @math{a>3,b>0}. To make use of this function, write first @code{load("distrib")}.
2920 @opencatbox{Categories:}
2921 @category{Package distrib}
2927 @anchor{kurtosis_pareto}
2928 @deffn {Function} kurtosis_pareto (@var{a},@var{b})
2929 Returns the kurtosis coefficient of a m4_Pareto_RV(a,b) random variable, with @math{a>4,b>0}. To make use of this function, write first @code{load("distrib")}.
2931 @opencatbox{Categories:}
2932 @category{Package distrib}
2938 @anchor{random_pareto}
2939 @deffn {Function} random_pareto (@var{a},@var{b}) @
2940 @fname{random_pareto} (@var{a},@var{b},@var{n})
2942 Returns a m4_Pareto_RV(a,b) random variate, with @math{a>0,b>0}. Calling @code{random_pareto} with a third argument @var{n}, a random sample of size @var{n} will be simulated.
2944 The implemented algorithm is based on the general inverse method.
2946 To make use of this function, write first @code{load("distrib")}.
2948 @opencatbox{Categories:}
2949 @category{Package distrib}
2950 @category{Random numbers}
2956 @node Weibull Random Variable, Rayleigh Random Variable, Pareto Random Variable, Normal Random Variable
2957 @subsection Weibull Random Variable
2959 * Introduction to Weibull Random Variable::
2960 * Functions and Variables for Weibull Random Variable::
2963 @node Introduction to Weibull Random Variable
2964 @subsubsection Introduction to Weibull Random Variable
2965 @node Functions and Variables for Weibull Random Variable
2966 @subsubsection Functions and Variables for Weibull Random Variable
2967 @anchor{pdf_weibull}
2968 @deffn {Function} pdf_weibull (@var{x},@var{a},@var{b})
2969 Returns the value at @var{x} of the density function of a m4_Weibull_RV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2975 \displaystyle{1\over b} \left({x\over b}\right)^{a-1} e^{-(x/b)^a} &
2984 [ a (-) %e unit_step(x)
2986 [ ---------------------------------- for x >= 0
2992 @opencatbox{Categories:}
2993 @category{Package distrib}
2999 @anchor{cdf_weibull}
3000 @deffn {Function} cdf_weibull (@var{x},@var{a},@var{b})
3001 Returns the value at @var{x} of the distribution function of a m4_Weibull_RV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
3007 1 - e^{-(x/b)^a} & for $x \ge 0$ \cr
3012 [ 1 - exp(-(x/b)^a) for x >= 0
3017 @opencatbox{Categories:}
3018 @category{Package distrib}
3024 @anchor{quantile_weibull}
3025 @deffn {Function} quantile_weibull (@var{q},@var{a},@var{b})
3026 Returns the @var{q}-quantile of a m4_Weibull_RV(a,b) random variable, with @math{a,b>0}; in other words, this is the inverse of @code{cdf_weibull}. Argument @var{q} must be an element of @math{[0,1]}. To make use of this function, write first @code{load("distrib")}.
3028 @opencatbox{Categories:}
3029 @category{Package distrib}
3035 @anchor{mean_weibull}
3036 @deffn {Function} mean_weibull (@var{a},@var{b})
3037 Returns the mean of a m4_Weibull_RV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
3039 @opencatbox{Categories:}
3040 @category{Package distrib}
3046 @anchor{var_weibull}
3047 @deffn {Function} var_weibull (@var{a},@var{b})
3048 Returns the variance of a m4_Weibull_RV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
3050 @opencatbox{Categories:}
3051 @category{Package distrib}
3056 @anchor{std_weibull}
3057 @deffn {Function} std_weibull (@var{a},@var{b})
3058 Returns the standard deviation of a m4_Weibull_RV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
3060 @opencatbox{Categories:}
3061 @category{Package distrib}
3068 @anchor{skewness_weibull}
3069 @deffn {Function} skewness_weibull (@var{a},@var{b})
3070 Returns the skewness coefficient of a m4_Weibull_RV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
3072 @opencatbox{Categories:}
3073 @category{Package distrib}
3079 @anchor{kurtosis_weibull}
3080 @deffn {Function} kurtosis_weibull (@var{a},@var{b})
3081 Returns the kurtosis coefficient of a m4_Weibull_RV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
3083 @opencatbox{Categories:}
3084 @category{Package distrib}
3090 @anchor{random_weibull}
3091 @deffn {Function} random_weibull (@var{a},@var{b}) @
3092 @fname{random_weibull} (@var{a},@var{b},@var{n})
3094 Returns a m4_Weibull_RV(a,b) random variate, with @math{a,b>0}. Calling @code{random_weibull} with a third argument @var{n}, a random sample of size @var{n} will be simulated.
3096 The implemented algorithm is based on the general inverse method.
3098 To make use of this function, write first @code{load("distrib")}.
3100 @opencatbox{Categories:}
3101 @category{Package distrib}
3102 @category{Random numbers}
3109 @node Rayleigh Random Variable, Laplace Random Variable, Weibull Random Variable, Normal Random Variable
3110 @subsection Rayleigh Random Variable
3112 * Introduction to Rayleigh Random Variable::
3113 * Functions and Variables for Rayleigh Random Variable::
3116 @node Introduction to Rayleigh Random Variable
3117 @subsubsection Introduction to Rayleigh Random Variable
3118 The @emph{Rayleigh} distribution coincides with the m4_math(\chi^2,
3119 chi-squared) distribution with two degrees of freedom.
3121 @node Functions and Variables for Rayleigh Random Variable
3122 @subsubsection Functions and Variables for Rayleigh Random Variable
3123 @anchor{pdf_rayleigh}
3124 @deffn {Function} pdf_rayleigh (@var{x},@var{b})
3125 Returns the value at @var{x} of the density function of a m4_Rayleigh_RV(b) random variable, with @math{b>0}.
3127 The m4_Rayleigh_RV(b) random variable is equivalent to the m4_Weibull_RV(2,1/b).
3133 2b^2 x e^{-b^2 x^2} & for $x \ge 0$ \cr
3138 [ 2*b^2*x*exp(-b^2*x^2) for x>= 0
3144 @c load ("distrib")$
3145 @c pdf_rayleigh(x,b);
3148 (%i1) load ("distrib")$
3149 (%i2) pdf_rayleigh(x,b);
3155 @opencatbox{Categories:}
3156 @category{Package distrib}
3162 @anchor{cdf_rayleigh}
3163 @deffn {Function} cdf_rayleigh (@var{x},@var{b})
3164 Returns the value at @var{x} of the distribution function of a m4_Rayleigh_RV(b) random variable, with @math{b>0}.
3166 The m4_Rayleigh_RV(b) random variable is equivalent to the m4_Weibull_RV(2,1/b).
3172 1 - e^{-b^2 x^2} & for $x \ge 0$\cr
3177 [ 1 - exp(-b^2*x^2) for x >= 0
3183 @c load ("distrib")$
3184 @c cdf_rayleigh(x,b);
3187 (%i1) load ("distrib")$
3188 (%i2) cdf_rayleigh(x,b);
3194 @opencatbox{Categories:}
3195 @category{Package distrib}
3201 @anchor{quantile_rayleigh}
3202 @deffn {Function} quantile_rayleigh (@var{q},@var{b})
3203 Returns the @var{q}-quantile of a m4_Rayleigh_RV(b) random variable, with @math{b>0}; in other words, this is the inverse of @code{cdf_rayleigh}. Argument @var{q} must be an element of @math{[0,1]}.
3205 The m4_Rayleigh_RV(b) random variable is equivalent to the m4_Weibull_RV(2,1/b).
3208 @c load ("distrib")$
3209 @c quantile_rayleigh(0.99,b);
3212 (%i1) load ("distrib")$
3213 (%i2) quantile_rayleigh(0.99,b);
3215 (%o2) -----------------
3219 @opencatbox{Categories:}
3220 @category{Package distrib}
3226 @anchor{mean_rayleigh}
3227 @deffn {Function} mean_rayleigh (@var{b})
3228 Returns the mean of a m4_Rayleigh_RV(b) random variable, with @math{b>0}.
3230 The m4_Rayleigh_RV(b) random variable is equivalent to the m4_Weibull_RV(2,1/b).
3233 @c load ("distrib")$
3234 @c mean_rayleigh(b);
3237 (%i1) load ("distrib")$
3238 (%i2) mean_rayleigh(b);
3244 @opencatbox{Categories:}
3245 @category{Package distrib}
3251 @anchor{var_rayleigh}
3252 @deffn {Function} var_rayleigh (@var{b})
3253 Returns the variance of a m4_Rayleigh_RV(b) random variable, with @math{b>0}.
3255 The m4_Rayleigh_RV(b) random variable is equivalent to the m4_Weibull_RV(2,1/b).
3258 @c load ("distrib")$
3262 (%i1) load ("distrib")$
3263 (%i2) var_rayleigh(b);
3272 @opencatbox{Categories:}
3273 @category{Package distrib}
3279 @anchor{std_rayleigh}
3280 @deffn {Function} std_rayleigh (@var{b})
3281 Returns the standard deviation of a m4_Rayleigh_RV(b) random variable, with @math{b>0}.
3283 The m4_Rayleigh_RV(b) random variable is equivalent to the m4_Weibull_RV(2,1/b).
3286 @c load ("distrib")$
3290 (%i1) load ("distrib")$
3291 (%i2) std_rayleigh(b);
3299 @opencatbox{Categories:}
3300 @category{Package distrib}
3306 @anchor{skewness_rayleigh}
3307 @deffn {Function} skewness_rayleigh (@var{b})
3308 Returns the skewness coefficient of a m4_Rayleigh_RV(b) random variable, with @math{b>0}.
3310 The m4_Rayleigh_RV(b) random variable is equivalent to the m4_Weibull_RV(2,1/b).
3313 @c load ("distrib")$
3314 @c skewness_rayleigh(b);
3317 (%i1) load ("distrib")$
3318 (%i2) skewness_rayleigh(b);
3321 ------ - -----------
3323 (%o2) --------------------
3329 @opencatbox{Categories:}
3330 @category{Package distrib}
3336 @anchor{kurtosis_rayleigh}
3337 @deffn {Function} kurtosis_rayleigh (@var{b})
3338 Returns the kurtosis coefficient of a m4_Rayleigh_RV(b) random variable, with @math{b>0}.
3340 The m4_Rayleigh_RV(b) random variable is equivalent to the m4_Weibull_RV(2,1/b).
3343 @c load ("distrib")$
3344 @c kurtosis_rayleigh(b);
3347 (%i1) load ("distrib")$
3348 (%i2) kurtosis_rayleigh(b);
3353 (%o2) ---------- - 3
3359 @opencatbox{Categories:}
3360 @category{Package distrib}
3366 @anchor{random_rayleigh}
3367 @deffn {Function} random_rayleigh (@var{b}) @
3368 @fname{random_rayleigh} (@var{b},@var{n})
3370 Returns a m4_Rayleigh_RV(b) random variate, with @math{b>0}. Calling @code{random_rayleigh} with a second argument @var{n}, a random sample of size @var{n} will be simulated.
3372 The implemented algorithm is based on the general inverse method.
3374 To make use of this function, write first @code{load("distrib")}.
3376 @opencatbox{Categories:}
3377 @category{Package distrib}
3378 @category{Random numbers}
3385 @node Laplace Random Variable, Cauchy Random Variable, Rayleigh Random Variable, Normal Random Variable
3386 @subsection Laplace Random Variable
3388 * Introduction to Laplace Random Variable::
3389 * Functions and Variables for Laplace Random Variable::
3392 @node Introduction to Laplace Random Variable
3393 @subsubsection Introduction to Laplace Random Variable
3394 The @emph{Laplace} distribution is a continuous probability
3395 distribution that is sometimes called the double exponential
3396 distribution because it can be thought of as two exponential
3397 distributions spliced back to back.
3399 @node Functions and Variables for Laplace Random Variable
3400 @subsubsection Functions and Variables for Laplace Random Variable
3401 @anchor{pdf_laplace}
3402 @deffn {Function} pdf_laplace (@var{x},@var{a},@var{b})
3403 Returns the value at @var{x} of the density function of a m4_Laplace_RV(a,b) random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3405 Here, @math{a} is the location parameter (or mean), and @math{b} is
3406 the scale parameter, related to the variance.
3410 <<<f(x; a, b) = {1\over 2b}\exp\left(-{|x-a|\over b}\right)>>>,
3417 f(x, a, b) = --------------
3420 @math{1/(2*b)*exp(-abs(x-a)/b)}>>>)
3422 @opencatbox{Categories:}
3423 @category{Package distrib}
3429 @anchor{cdf_laplace}
3430 @deffn {Function} cdf_laplace (@var{x},@var{a},@var{b})
3431 Returns the value at @var{x} of the distribution function of a m4_Laplace_RV(a,b) random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3437 \displaystyle{1\over 2} \exp\left({x-a\over b}\right) & for $x < a$\cr
3439 1-\displaystyle{1\over 2} \exp\left({x-a\over b}\right) & for $x \ge a$
3443 [ 1/2*exp((x-a)/b) for x < a
3445 [ 1-1/2*exp((x-a)/b) for x >= a
3448 @opencatbox{Categories:}
3449 @category{Package distrib}
3455 @anchor{quantile_laplace}
3456 @deffn {Function} quantile_laplace (@var{q},@var{a},@var{b})
3457 Returns the @var{q}-quantile of a m4_Laplace_RV(a,b) random variable, with @math{b>0}; in other words, this is the inverse of @code{cdf_laplace}. Argument @var{q} must be an element of @math{[0,1]}. To make use of this function, write first @code{load("distrib")}.
3459 @opencatbox{Categories:}
3460 @category{Package distrib}
3466 @anchor{mean_laplace}
3467 @deffn {Function} mean_laplace (@var{a},@var{b})
3468 Returns the mean of a m4_Laplace_RV(a,b) random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3470 @opencatbox{Categories:}
3471 @category{Package distrib}
3477 @anchor{var_laplace}
3478 @deffn {Function} var_laplace (@var{a},@var{b})
3479 Returns the variance of a m4_Laplace_RV(a,b) random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3481 @opencatbox{Categories:}
3482 @category{Package distrib}
3488 @anchor{std_laplace}
3489 @deffn {Function} std_laplace (@var{a},@var{b})
3490 Returns the standard deviation of a m4_Laplace_RV(a,b) random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3492 @opencatbox{Categories:}
3493 @category{Package distrib}
3499 @anchor{skewness_laplace}
3500 @deffn {Function} skewness_laplace (@var{a},@var{b})
3501 Returns the skewness coefficient of a m4_Laplace_RV(a,b) random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3503 @opencatbox{Categories:}
3504 @category{Package distrib}
3510 @anchor{kurtosis_laplace}
3511 @deffn {Function} kurtosis_laplace (@var{a},@var{b})
3512 Returns the kurtosis coefficient of a m4_Laplace_RV(a,b) random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3514 @opencatbox{Categories:}
3515 @category{Package distrib}
3521 @anchor{random_laplace}
3522 @deffn {Function} random_laplace (@var{a},@var{b}) @
3523 @fname{random_laplace} (@var{a},@var{b},@var{n})
3525 Returns a m4_Laplace_RV(a,b) random variate, with @math{b>0}. Calling @code{random_laplace} with a third argument @var{n}, a random sample of size @var{n} will be simulated.
3527 The implemented algorithm is based on the general inverse method.
3529 To make use of this function, write first @code{load("distrib")}.
3531 @opencatbox{Categories:}
3532 @category{Package distrib}
3533 @category{Random numbers}
3540 @node Cauchy Random Variable, Gumbel Random Variable, Laplace Random Variable, Normal Random Variable
3541 @subsection Cauchy Random Variable
3543 * Introduction to Cauchy Random Variable::
3544 * Functions and Variables for Cauchy Random Variable::
3547 @node Introduction to Cauchy Random Variable
3548 @subsubsection Introduction to Cauchy Random Variable
3549 The @emph{Cauchy} distribution (also known as the Lorentz
3550 distribution) is the distribution of of the ratio of two independent
3551 normally distributed random variables with mean zero.
3553 @node Functions and Variables for Cauchy Random Variable
3554 @subsubsection Functions and Variables for Cauchy Random Variable
3556 @deffn {Function} pdf_cauchy (@var{x},@var{a},@var{b})
3557 Returns the value at @var{x} of the density function of a m4_Cauchy_RV(a,b) random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3561 <<<f(x; a, b) = {b\over \pi\left((x-a)^2+b^2\right)}>>>,
3565 f(x, a, b) = -------------------
3570 @opencatbox{Categories:}
3571 @category{Package distrib}
3578 @deffn {Function} cdf_cauchy (@var{x},@var{a},@var{b})
3579 Returns the value at @var{x} of the distribution function of a m4_Cauchy_RV(a,b) random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3583 <<<F(x; a, b) = {1\over 2} + {1\over \pi} \tan^{-1} {x-a\over b}>>>,
3584 <<<@math{1/2 + 1/%pi*atan((x-a)/b)}>>>)
3585 @opencatbox{Categories:}
3586 @category{Package distrib}
3592 @anchor{quantile_cauchy}
3593 @deffn {Function} quantile_cauchy (@var{q},@var{a},@var{b})
3594 Returns the @var{q}-quantile of a m4_Cauchy_RV(a,b) random variable, with @math{b>0}; in other words, this is the inverse of @code{cdf_cauchy}. Argument @var{q} must be an element of @math{[0,1]}. To make use of this function, write first @code{load("distrib")}.
3596 @opencatbox{Categories:}
3597 @category{Package distrib}
3603 @anchor{random_cauchy}
3604 @deffn {Function} random_cauchy (@var{a},@var{b}) @
3605 @fname{random_cauchy} (@var{a},@var{b},@var{n})
3607 Returns a m4_Cauchy_RV(a,b) random variate, with @math{b>0}. Calling @code{random_cauchy} with a third argument @var{n}, a random sample of size @var{n} will be simulated.
3609 The implemented algorithm is based on the general inverse method.
3611 To make use of this function, write first @code{load("distrib")}.
3613 @opencatbox{Categories:}
3614 @category{Package distrib}
3615 @category{Random numbers}
3622 @node Gumbel Random Variable, , Cauchy Random Variable, Normal Random Variable
3623 @subsection Gumbel Random Variable
3625 * Introduction to Gumbel Random Variable::
3626 * Functions and Variables for Gumbel Random Variable::
3629 @node Introduction to Gumbel Random Variable
3630 @subsubsection Introduction to Gumbel Random Variable
3631 @node Functions and Variables for Gumbel Random Variable
3632 @subsubsection Functions and Variables for Gumbel Random Variable
3634 @deffn {Function} pdf_gumbel (@var{x},@var{a},@var{b})
3635 Returns the value at @var{x} of the density function of a m4_Gumbel_RV(a,b) random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3639 <<<f(x; a, b) = {1\over b} \exp\left[{a-x\over b} - \exp\left({a-x\over b}\right)\right]>>>,
3648 f(x, a, b) = -----------------
3653 @opencatbox{Categories:}
3654 @category{Package distrib}
3661 @deffn {Function} cdf_gumbel (@var{x},@var{a},@var{b})
3662 Returns the value at @var{x} of the distribution function of a m4_Gumbel_RV(a,b) random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3666 <<<F(x; a, b) = \exp\left[-\exp\left({a-x\over b}\right)\right]>>>,
3676 @opencatbox{Categories:}
3677 @category{Package distrib}
3683 @anchor{quantile_gumbel}
3684 @deffn {Function} quantile_gumbel (@var{q},@var{a},@var{b})
3685 Returns the @var{q}-quantile of a m4_Gumbel_RV(a,b) random variable, with @math{b>0}; in other words, this is the inverse of @code{cdf_gumbel}. Argument @var{q} must be an element of @math{[0,1]}. To make use of this function, write first @code{load("distrib")}.
3687 @opencatbox{Categories:}
3688 @category{Package distrib}
3694 @anchor{mean_gumbel}
3695 @deffn {Function} mean_gumbel (@var{a},@var{b})
3696 Returns the mean of a m4_Gumbel_RV(a,b) random variable, with @math{b>0}.
3699 @c load ("distrib")$
3700 @c mean_gumbel(a,b);
3703 (%i1) load ("distrib")$
3704 (%i2) mean_gumbel(a,b);
3707 where symbol @code{%gamma} stands for the Euler-Mascheroni constant. See also @mrefdot{%gamma}
3709 @opencatbox{Categories:}
3710 @category{Package distrib}
3717 @deffn {Function} var_gumbel (@var{a},@var{b})
3718 Returns the variance of a m4_Gumbel_RV(a,b) random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3720 @opencatbox{Categories:}
3721 @category{Package distrib}
3728 @deffn {Function} std_gumbel (@var{a},@var{b})
3729 Returns the standard deviation of a m4_Gumbel_RV(a,b) random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3731 @opencatbox{Categories:}
3732 @category{Package distrib}
3738 @anchor{skewness_gumbel}
3739 @deffn {Function} skewness_gumbel (@var{a},@var{b})
3740 Returns the skewness coefficient of a m4_Gumbel_RV(a,b) random variable, with @math{b>0}.
3743 @c load ("distrib")$
3744 @c skewness_gumbel(a,b);
3747 (%i1) load ("distrib")$
3748 (%i2) skewness_gumbel(a,b);
3751 (%o2) --------------
3755 where @code{zeta} stands for the Riemann's zeta function.
3757 @opencatbox{Categories:}
3758 @category{Package distrib}
3764 @anchor{kurtosis_gumbel}
3765 @deffn {Function} kurtosis_gumbel (@var{a},@var{b})
3766 Returns the kurtosis coefficient of a m4_Gumbel_RV(a,b) random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3768 @opencatbox{Categories:}
3769 @category{Package distrib}
3770 @category{Package distrib}
3776 @anchor{random_gumbel}
3777 @deffn {Function} random_gumbel (@var{a},@var{b}) @
3778 @fname{random_gumbel} (@var{a},@var{b},@var{n})
3780 Returns a m4_Gumbel_RV(a,b) random variate, with @math{b>0}. Calling @code{random_gumbel} with a third argument @var{n}, a random sample of size @var{n} will be simulated.
3782 The implemented algorithm is based on the general inverse method.
3784 To make use of this function, write first @code{load("distrib")}.
3786 @opencatbox{Categories:}
3787 @category{Package distrib}
3788 @category{Random numbers}
3794 @node Functions and Variables for discrete distributions, , Normal Random Variable
3795 @section Functions and Variables for discrete distributions
3798 @anchor{pdf_general_finite_discrete}
3799 @deffn {Function} pdf_general_finite_discrete (@var{x},@var{v})
3800 Returns the value at @var{x} of the probability function of a general finite discrete random variable, with vector probabilities @math{v}, such that @code{Pr(X=i) = v_i}. Vector @math{v} can be a list of nonnegative expressions, whose components will be normalized to get a vector of probabilities. To make use of this function, write first @code{load("distrib")}.
3803 @c load ("distrib")$
3804 @c pdf_general_finite_discrete(2, [1/7, 4/7, 2/7]);
3805 @c pdf_general_finite_discrete(2, [1, 4, 2]);
3808 (%i1) load ("distrib")$
3809 (%i2) pdf_general_finite_discrete(2, [1/7, 4/7, 2/7]);
3813 (%i3) pdf_general_finite_discrete(2, [1, 4, 2]);
3819 @opencatbox{Categories:}
3820 @category{Package distrib}
3826 @anchor{cdf_general_finite_discrete}
3827 @deffn {Function} cdf_general_finite_discrete (@var{x},@var{v})
3828 Returns the value at @var{x} of the distribution function of a general finite discrete random variable, with vector probabilities @math{v}.
3830 See @code{pdf_general_finite_discrete} for more details.
3833 @c load ("distrib")$
3834 @c cdf_general_finite_discrete(2, [1/7, 4/7, 2/7]);
3835 @c cdf_general_finite_discrete(2, [1, 4, 2]);
3836 @c cdf_general_finite_discrete(2+1/2, [1, 4, 2]);
3839 (%i1) load ("distrib")$
3840 (%i2) cdf_general_finite_discrete(2, [1/7, 4/7, 2/7]);
3844 (%i3) cdf_general_finite_discrete(2, [1, 4, 2]);
3848 (%i4) cdf_general_finite_discrete(2+1/2, [1, 4, 2]);
3854 @opencatbox{Categories:}
3855 @category{Package distrib}
3861 @anchor{quantile_general_finite_discrete}
3862 @deffn {Function} quantile_general_finite_discrete (@var{q},@var{v})
3863 Returns the @var{q}-quantile of a general finite discrete random variable, with vector probabilities @math{v}.
3865 See @code{pdf_general_finite_discrete} for more details.
3867 @opencatbox{Categories:}
3868 @category{Package distrib}
3874 @anchor{mean_general_finite_discrete}
3875 @deffn {Function} mean_general_finite_discrete (@var{v})
3876 Returns the mean of a general finite discrete random variable, with vector probabilities @math{v}.
3878 See @code{pdf_general_finite_discrete} for more details.
3880 @opencatbox{Categories:}
3881 @category{Package distrib}
3887 @anchor{var_general_finite_discrete}
3888 @deffn {Function} var_general_finite_discrete (@var{v})
3889 Returns the variance of a general finite discrete random variable, with vector probabilities @math{v}.
3891 See @code{pdf_general_finite_discrete} for more details.
3893 @opencatbox{Categories:}
3894 @category{Package distrib}
3900 @anchor{std_general_finite_discrete}
3901 @deffn {Function} std_general_finite_discrete (@var{v})
3902 Returns the standard deviation of a general finite discrete random variable, with vector probabilities @math{v}.
3904 See @code{pdf_general_finite_discrete} for more details.
3906 @opencatbox{Categories:}
3907 @category{Package distrib}
3913 @anchor{skewness_general_finite_discrete}
3914 @deffn {Function} skewness_general_finite_discrete (@var{v})
3915 Returns the skewness coefficient of a general finite discrete random variable, with vector probabilities @math{v}.
3917 See @code{pdf_general_finite_discrete} for more details.
3919 @opencatbox{Categories:}
3920 @category{Package distrib}
3926 @anchor{kurtosis_general_finite_discrete}
3927 @deffn {Function} kurtosis_general_finite_discrete (@var{v})
3928 Returns the kurtosis coefficient of a general finite discrete random variable, with vector probabilities @math{v}.
3930 See @code{pdf_general_finite_discrete} for more details.
3932 @opencatbox{Categories:}
3933 @category{Package distrib}
3939 @anchor{random_general_finite_discrete}
3940 @deffn {Function} random_general_finite_discrete (@var{v}) @
3941 @fname{random_general_finite_discrete} (@var{v},@var{m})
3943 Returns a general finite discrete random variate, with vector probabilities @math{v}. Calling @code{random_general_finite_discrete} with a second argument @var{m}, a random sample of size @var{m} will be simulated.
3945 See @code{pdf_general_finite_discrete} for more details.
3948 @c load ("distrib")$
3949 @c random_general_finite_discrete([1,3,1,5]);
3950 @c random_general_finite_discrete([1,3,1,5], 10);
3953 (%i1) load ("distrib")$
3954 (%i2) random_general_finite_discrete([1,3,1,5]);
3956 (%i3) random_general_finite_discrete([1,3,1,5], 10);
3957 (%o3) [4, 2, 2, 3, 2, 4, 4, 1, 2, 2]
3960 @opencatbox{Categories:}
3961 @category{Package distrib}
3962 @category{Random numbers}
3968 @anchor{pdf_binomial}
3969 @deffn {Function} pdf_binomial (@var{x},@var{n},@var{p})
3970 Returns the value at @var{x} of the probability function of a @math{Binomial(n,p)} random variable, with @math{0 \leq p \leq 1} and @math{n} a positive integer. To make use of this function, write first @code{load("distrib")}.
3972 @opencatbox{Categories:}
3973 @category{Package distrib}
3979 @anchor{cdf_binomial}
3980 @deffn {Function} cdf_binomial (@var{x},@var{n},@var{p})
3981 Returns the value at @var{x} of the distribution function of a @math{Binomial(n,p)} random variable, with @math{0 \leq p \leq 1} and @math{n} a positive integer.
3984 @c load ("distrib")$
3985 @c cdf_binomial(5,7,1/6);
3989 (%i1) load ("distrib")$
3990 (%i2) cdf_binomial(5,7,1/6);
3995 (%o3) .9998713991769548
3998 @opencatbox{Categories:}
3999 @category{Package distrib}
4005 @anchor{quantile_binomial}
4006 @deffn {Function} quantile_binomial (@var{q},@var{n},@var{p})
4007 Returns the @var{q}-quantile of a @math{Binomial(n,p)} random variable, with @math{0 \leq p \leq 1} and @math{n} a positive integer; in other words, this is the inverse of @code{cdf_binomial}. Argument @var{q} must be an element of @math{[0,1]}. To make use of this function, write first @code{load("distrib")}.
4009 @opencatbox{Categories:}
4010 @category{Package distrib}
4016 @anchor{mean_binomial}
4017 @deffn {Function} mean_binomial (@var{n},@var{p})
4018 Returns the mean of a @math{Binomial(n,p)} random variable, with @math{0 \leq p \leq 1} and @math{n} a positive integer. To make use of this function, write first @code{load("distrib")}.
4020 @opencatbox{Categories:}
4021 @category{Package distrib}
4027 @anchor{var_binomial}
4028 @deffn {Function} var_binomial (@var{n},@var{p})
4029 Returns the variance of a @math{Binomial(n,p)} random variable, with @math{0 \leq p \leq 1} and @math{n} a positive integer. To make use of this function, write first @code{load("distrib")}.
4031 @opencatbox{Categories:}
4032 @category{Package distrib}
4038 @anchor{std_binomial}
4039 @deffn {Function} std_binomial (@var{n},@var{p})
4040 Returns the standard deviation of a @math{Binomial(n,p)} random variable, with @math{0 \leq p \leq 1} and @math{n} a positive integer. To make use of this function, write first @code{load("distrib")}.
4042 @opencatbox{Categories:}
4043 @category{Package distrib}
4049 @anchor{skewness_binomial}
4050 @deffn {Function} skewness_binomial (@var{n},@var{p})
4051 Returns the skewness coefficient of a @math{Binomial(n,p)} random variable, with @math{0 \leq p \leq 1} and @math{n} a positive integer. To make use of this function, write first @code{load("distrib")}.
4053 @opencatbox{Categories:}
4054 @category{Package distrib}
4060 @anchor{kurtosis_binomial}
4061 @deffn {Function} kurtosis_binomial (@var{n},@var{p})
4062 Returns the kurtosis coefficient of a @math{Binomial(n,p)} random variable, with @math{0 \leq p \leq 1} and @math{n} a positive integer. To make use of this function, write first @code{load("distrib")}.
4064 @opencatbox{Categories:}
4065 @category{Package distrib}
4071 @anchor{random_binomial}
4072 @deffn {Function} random_binomial (@var{n},@var{p}) @
4073 @fname{random_binomial} (@var{n},@var{p},@var{m})
4075 Returns a @math{Binomial(n,p)} random variate, with @math{0 \leq p \leq 1} and @math{n} a positive integer. Calling @code{random_binomial} with a third argument @var{m}, a random sample of size @var{m} will be simulated.
4077 The implemented algorithm is based on the one described in Kachitvichyanukul, V. and Schmeiser, B.W. (1988) @var{Binomial Random Variate Generation}. Communications of the ACM, 31, Feb., 216.
4079 To make use of this function, write first @code{load("distrib")}.
4081 @opencatbox{Categories:}
4082 @category{Package distrib}
4083 @category{Random numbers}
4089 @anchor{pdf_poisson}
4090 @deffn {Function} pdf_poisson (@var{x},@var{m})
4091 Returns the value at @var{x} of the probability function of a @math{Poisson(m)} random variable, with @math{m>0}. To make use of this function, write first @code{load("distrib")}.
4093 @opencatbox{Categories:}
4094 @category{Package distrib}
4100 @anchor{cdf_poisson}
4101 @deffn {Function} cdf_poisson (@var{x},@var{m})
4102 Returns the value at @var{x} of the distribution function of a @math{Poisson(m)} random variable, with @math{m>0}.
4105 @c load ("distrib")$
4106 @c cdf_poisson(3,5);
4110 (%i1) load ("distrib")$
4111 (%i2) cdf_poisson(3,5);
4112 (%o2) gamma_incomplete_regularized(4, 5)
4114 (%o3) .2650259152973623
4117 @opencatbox{Categories:}
4118 @category{Package distrib}
4124 @anchor{quantile_poisson}
4125 @deffn {Function} quantile_poisson (@var{q},@var{m})
4126 Returns the @var{q}-quantile of a @math{Poisson(m)} random variable, with @math{m>0}; in other words, this is the inverse of @code{cdf_poisson}. Argument @var{q} must be an element of @math{[0,1]}. To make use of this function, write first @code{load("distrib")}.
4128 @opencatbox{Categories:}
4129 @category{Package distrib}
4135 @anchor{mean_poisson}
4136 @deffn {Function} mean_poisson (@var{m})
4137 Returns the mean of a @math{Poisson(m)} random variable, with @math{m>0}. To make use of this function, write first @code{load("distrib")}.
4139 @opencatbox{Categories:}
4140 @category{Package distrib}
4146 @anchor{var_poisson}
4147 @deffn {Function} var_poisson (@var{m})
4148 Returns the variance of a @math{Poisson(m)} random variable, with @math{m>0}. To make use of this function, write first @code{load("distrib")}.
4150 @opencatbox{Categories:}
4151 @category{Package distrib}
4157 @anchor{std_poisson}
4158 @deffn {Function} std_poisson (@var{m})
4159 Returns the standard deviation of a @math{Poisson(m)} random variable, with @math{m>0}. To make use of this function, write first @code{load("distrib")}.
4161 @opencatbox{Categories:}
4162 @category{Package distrib}
4168 @anchor{skewness_poisson}
4169 @deffn {Function} skewness_poisson (@var{m})
4170 Returns the skewness coefficient of a @math{Poisson(m)} random variable, with @math{m>0}. To make use of this function, write first @code{load("distrib")}.
4172 @opencatbox{Categories:}
4173 @category{Package distrib}
4179 @anchor{kurtosis_poisson}
4180 @deffn {Function} kurtosis_poisson (@var{m})
4181 Returns the kurtosis coefficient of a Poisson random variable @math{Poi(m)}, with @math{m>0}. To make use of this function, write first @code{load("distrib")}.
4183 @opencatbox{Categories:}
4184 @category{Package distrib}
4190 @anchor{random_poisson}
4191 @deffn {Function} random_poisson (@var{m}) @
4192 @fname{random_poisson} (@var{m},@var{n})
4194 Returns a @math{Poisson(m)} random variate, with @math{m>0}. Calling @code{random_poisson} with a second argument @var{n}, a random sample of size @var{n} will be simulated.
4196 The implemented algorithm is the one described in Ahrens, J.H. and Dieter, U. (1982) @var{Computer Generation of Poisson Deviates From Modified Normal Distributions}. ACM Trans. Math. Software, 8, 2, June,163-179.
4198 To make use of this function, write first @code{load("distrib")}.
4200 @opencatbox{Categories:}
4201 @category{Package distrib}
4202 @category{Random numbers}
4208 @anchor{pdf_bernoulli}
4209 @deffn {Function} pdf_bernoulli (@var{x},@var{p})
4210 Returns the value at @var{x} of the probability function of a @math{Bernoulli(p)} random variable, with @math{0 \leq p \leq 1}.
4212 The @math{Bernoulli(p)} random variable is equivalent to the @math{Binomial(1,p)}.
4215 @c load ("distrib")$
4216 @c pdf_bernoulli(1,p);
4219 (%i1) load ("distrib")$
4220 (%i2) pdf_bernoulli(1,p);
4224 @opencatbox{Categories:}
4225 @category{Package distrib}
4231 @anchor{cdf_bernoulli}
4232 @deffn {Function} cdf_bernoulli (@var{x},@var{p})
4233 Returns the value at @var{x} of the distribution function of a @math{Bernoulli(p)} random variable, with @math{0 \leq p \leq 1}. To make use of this function, write first @code{load("distrib")}.
4235 @opencatbox{Categories:}
4236 @category{Package distrib}
4242 @anchor{quantile_bernoulli}
4243 @deffn {Function} quantile_bernoulli (@var{q},@var{p})
4244 Returns the @var{q}-quantile of a @math{Bernoulli(p)} random variable, with @math{0 \leq p \leq 1}; in other words, this is the inverse of @code{cdf_bernoulli}. Argument @var{q} must be an element of @math{[0,1]}. To make use of this function, write first @code{load("distrib")}.
4246 @opencatbox{Categories:}
4247 @category{Package distrib}
4253 @anchor{mean_bernoulli}
4254 @deffn {Function} mean_bernoulli (@var{p})
4255 Returns the mean of a @math{Bernoulli(p)} random variable, with @math{0 \leq p \leq 1}.
4257 The @math{Bernoulli(p)} random variable is equivalent to the @math{Binomial(1,p)}.
4260 @c load ("distrib")$
4261 @c mean_bernoulli(p);
4264 (%i1) load ("distrib")$
4265 (%i2) mean_bernoulli(p);
4269 @opencatbox{Categories:}
4270 @category{Package distrib}
4276 @anchor{var_bernoulli}
4277 @deffn {Function} var_bernoulli (@var{p})
4278 Returns the variance of a @math{Bernoulli(p)} random variable, with @math{0 \leq p \leq 1}.
4280 The @math{Bernoulli(p)} random variable is equivalent to the @math{Binomial(1,p)}.
4283 @c load ("distrib")$
4284 @c var_bernoulli(p);
4287 (%i1) load ("distrib")$
4288 (%i2) var_bernoulli(p);
4292 @opencatbox{Categories:}
4293 @category{Package distrib}
4299 @anchor{std_bernoulli}
4300 @deffn {Function} std_bernoulli (@var{p})
4301 Returns the standard deviation of a @math{Bernoulli(p)} random variable, with @math{0 \leq p \leq 1}.
4303 The @math{Bernoulli(p)} random variable is equivalent to the @math{Binomial(1,p)}.
4306 @c load ("distrib")$
4307 @c std_bernoulli(p);
4310 (%i1) load ("distrib")$
4311 (%i2) std_bernoulli(p);
4312 (%o2) sqrt((1 - p) p)
4315 @opencatbox{Categories:}
4316 @category{Package distrib}
4322 @anchor{skewness_bernoulli}
4323 @deffn {Function} skewness_bernoulli (@var{p})
4324 Returns the skewness coefficient of a @math{Bernoulli(p)} random variable, with @math{0 \leq p \leq 1}.
4326 The @math{Bernoulli(p)} random variable is equivalent to the @math{Binomial(1,p)}.
4329 @c load ("distrib")$
4330 @c skewness_bernoulli(p);
4333 (%i1) load ("distrib")$
4334 (%i2) skewness_bernoulli(p);
4336 (%o2) ---------------
4340 @opencatbox{Categories:}
4341 @category{Package distrib}
4347 @anchor{kurtosis_bernoulli}
4348 @deffn {Function} kurtosis_bernoulli (@var{p})
4349 Returns the kurtosis coefficient of a @math{Bernoulli(p)} random variable, with @math{0 \leq p \leq 1}.
4351 The @math{Bernoulli(p)} random variable is equivalent to the @math{Binomial(1,p)}.
4354 @c load ("distrib")$
4355 @c kurtosis_bernoulli(p);
4358 (%i1) load ("distrib")$
4359 (%i2) kurtosis_bernoulli(p);
4361 (%o2) ---------------
4365 @opencatbox{Categories:}
4366 @category{Package distrib}
4372 @anchor{random_bernoulli}
4373 @deffn {Function} random_bernoulli (@var{p}) @
4374 @fname{random_bernoulli} (@var{p},@var{n})
4376 Returns a @math{Bernoulli(p)} random variate, with @math{0 \leq p \leq 1}. Calling @code{random_bernoulli} with a second argument @var{n}, a random sample of size @var{n} will be simulated.
4378 This is a direct application of the @code{random} built-in Maxima function.
4380 See also @mrefdot{random} To make use of this function, write first @code{load("distrib")}.
4382 @opencatbox{Categories:}
4383 @category{Package distrib}
4384 @category{Random numbers}
4389 @anchor{pdf_geometric}
4390 @deffn {Function} pdf_geometric (@var{x},@var{p})
4391 Returns the value at @var{x} of the probability function of a @math{Geometric(p)} random variable, with
4396 @math{0 < p \leq 1}.
4399 The probability function is defined as @math{p (1 - p)^x}.
4400 This is interpreted as the probability of @math{x} failures before the first success.
4402 @code{load("distrib")} loads this function.
4404 @opencatbox{Categories:}
4405 @category{Package distrib}
4411 @anchor{cdf_geometric}
4412 @deffn {Function} cdf_geometric (@var{x},@var{p})
4413 Returns the value at @var{x} of the distribution function of a @math{Geometric(p)} random variable, with
4418 @math{0 < p \leq 1}.
4421 The probability from which the distribution function is derived is defined as @math{p (1 - p)^x}.
4422 This is interpreted as the probability of @math{x} failures before the first success.
4424 @code{load("distrib")} loads this function.
4426 @opencatbox{Categories:}
4427 @category{Package distrib}
4433 @anchor{quantile_geometric}
4434 @deffn {Function} quantile_geometric (@var{q},@var{p})
4435 Returns the @var{q}-quantile of a @math{Geometric(p)} random variable, with
4440 @math{0 < p \leq 1};
4442 in other words, this is the inverse of @code{cdf_geometric}.
4443 Argument @var{q} must be an element of @math{[0,1]}.
4445 The probability from which the quantile is derived is defined as @math{p (1 - p)^x}.
4446 This is interpreted as the probability of @math{x} failures before the first success.
4448 @code{load("distrib")} loads this function.
4450 @opencatbox{Categories:}
4451 @category{Package distrib}
4457 @anchor{mean_geometric}
4458 @deffn {Function} mean_geometric (@var{p})
4459 Returns the mean of a @math{Geometric(p)} random variable, with
4464 @math{0 < p \leq 1}.
4467 The probability from which the mean is derived is defined as @math{p (1 - p)^x}.
4468 This is interpreted as the probability of @math{x} failures before the first success.
4470 @code{load("distrib")} loads this function.
4472 @opencatbox{Categories:}
4473 @category{Package distrib}
4479 @anchor{var_geometric}
4480 @deffn {Function} var_geometric (@var{p})
4481 Returns the variance of a @math{Geometric(p)} random variable, with
4486 @math{0 < p \leq 1}.
4489 The probability from which the variance is derived is defined as @math{p (1 - p)^x}.
4490 This is interpreted as the probability of @math{x} failures before the first success.
4492 @code{load("distrib")} loads this function.
4494 @opencatbox{Categories:}
4495 @category{Package distrib}
4501 @anchor{std_geometric}
4502 @deffn {Function} std_geometric (@var{p})
4503 Returns the standard deviation of a @math{Geometric(p)} random variable, with
4508 @math{0 < p \leq 1}.
4511 The probability from which the standard deviation is derived is defined as @math{p (1 - p)^x}.
4512 This is interpreted as the probability of @math{x} failures before the first success.
4514 @code{load("distrib")} loads this function.
4516 @opencatbox{Categories:}
4517 @category{Package distrib}
4523 @anchor{skewness_geometric}
4524 @deffn {Function} skewness_geometric (@var{p})
4525 Returns the skewness coefficient of a @math{Geometric(p)} random variable, with
4530 @math{0 < p \leq 1}.
4533 The probability from which the skewness is derived is defined as @math{p (1 - p)^x}.
4534 This is interpreted as the probability of @math{x} failures before the first success.
4536 @code{load("distrib")} loads this function.
4538 @opencatbox{Categories:}
4539 @category{Package distrib}
4545 @anchor{kurtosis_geometric}
4546 @deffn {Function} kurtosis_geometric (@var{p})
4547 Returns the kurtosis coefficient of a geometric random variable @math{Geometric(p)}, with
4552 @math{0 < p \leq 1}.
4555 The probability from which the kurtosis is derived is defined as @math{p (1 - p)^x}.
4556 This is interpreted as the probability of @math{x} failures before the first success.
4558 @code{load("distrib")} loads this function.
4560 @opencatbox{Categories:}
4561 @category{Package distrib}
4567 @anchor{random_geometric}
4568 @deffn {Function} random_geometric (@var{p}) @
4569 @fname{random_geometric} (@var{p},@var{n})
4571 @code{random_geometric(@var{p})} returns one random sample from a @math{Geometric(p)} distribution, with
4576 @math{0 < p \leq 1}.
4579 @code{random_geometric(@var{p}, @var{n})} returns a list of @var{n} random samples.
4581 The algorithm is based on simulation of Bernoulli trials.
4583 The probability from which the random sample is derived is defined as @math{p (1 - p)^x}.
4584 This is interpreted as the probability of @math{x} failures before the first success.
4586 @code{load("distrib")} loads this function.
4589 @opencatbox{Categories:}
4590 @category{Package distrib}
4591 @category{Random numbers}
4597 @anchor{pdf_discrete_uniform}
4598 @deffn {Function} pdf_discrete_uniform (@var{x},@var{n})
4599 Returns the value at @var{x} of the probability function of a @math{Discrete Uniform(n)} random variable, with @math{n} a strictly positive integer. To make use of this function, write first @code{load("distrib")}.
4601 @opencatbox{Categories:}
4602 @category{Package distrib}
4608 @anchor{cdf_discrete_uniform}
4609 @deffn {Function} cdf_discrete_uniform (@var{x},@var{n})
4610 Returns the value at @var{x} of the distribution function of a @math{Discrete Uniform(n)} random variable, with @math{n} a strictly positive integer. To make use of this function, write first @code{load("distrib")}.
4612 @opencatbox{Categories:}
4613 @category{Package distrib}
4619 @anchor{quantile_discrete_uniform}
4620 @deffn {Function} quantile_discrete_uniform (@var{q},@var{n})
4621 Returns the @var{q}-quantile of a @math{Discrete Uniform(n)} random variable, with @math{n} a strictly positive integer; in other words, this is the inverse of @code{cdf_discrete_uniform}. Argument @var{q} must be an element of @math{[0,1]}. To make use of this function, write first @code{load("distrib")}.
4623 @opencatbox{Categories:}
4624 @category{Package distrib}
4630 @anchor{mean_discrete_uniform}
4631 @deffn {Function} mean_discrete_uniform (@var{n})
4632 Returns the mean of a @math{Discrete Uniform(n)} random variable, with @math{n} a strictly positive integer. To make use of this function, write first @code{load("distrib")}.
4634 @opencatbox{Categories:}
4635 @category{Package distrib}
4641 @anchor{var_discrete_uniform}
4642 @deffn {Function} var_discrete_uniform (@var{n})
4643 Returns the variance of a @math{Discrete Uniform(n)} random variable, with @math{n} a strictly positive integer. To make use of this function, write first @code{load("distrib")}.
4645 @opencatbox{Categories:}
4646 @category{Package distrib}
4652 @anchor{std_discrete_uniform}
4653 @deffn {Function} std_discrete_uniform (@var{n})
4654 Returns the standard deviation of a @math{Discrete Uniform(n)} random variable, with @math{n} a strictly positive integer. To make use of this function, write first @code{load("distrib")}.
4656 @opencatbox{Categories:}
4657 @category{Package distrib}
4663 @anchor{skewness_discrete_uniform}
4664 @deffn {Function} skewness_discrete_uniform (@var{n})
4665 Returns the skewness coefficient of a @math{Discrete Uniform(n)} random variable, with @math{n} a strictly positive integer. To make use of this function, write first @code{load("distrib")}.
4667 @opencatbox{Categories:}
4668 @category{Package distrib}
4674 @anchor{kurtosis_discrete_uniform}
4675 @deffn {Function} kurtosis_discrete_uniform (@var{n})
4676 Returns the kurtosis coefficient of a @math{Discrete Uniform(n)} random variable, with @math{n} a strictly positive integer. To make use of this function, write first @code{load("distrib")}.
4678 @opencatbox{Categories:}
4679 @category{Package distrib}
4685 @anchor{random_discrete_uniform}
4686 @deffn {Function} random_discrete_uniform (@var{n}) @
4687 @fname{random_discrete_uniform} (@var{n},@var{m})
4689 Returns a @math{Discrete Uniform(n)} random variate, with @math{n} a strictly positive integer. Calling @code{random_discrete_uniform} with a second argument @var{m}, a random sample of size @var{m} will be simulated.
4691 This is a direct application of the @code{random} built-in Maxima function.
4693 See also @mrefdot{random} To make use of this function, write first @code{load("distrib")}.
4695 @opencatbox{Categories:}
4696 @category{Package distrib}
4697 @category{Random numbers}
4703 @anchor{pdf_hypergeometric}
4704 @deffn {Function} pdf_hypergeometric (@var{x},@var{n1},@var{n2},@var{n})
4705 Returns the value at @var{x} of the probability function of a @math{Hypergeometric(n1,n2,n)}
4706 random variable, with @var{n1}, @var{n2} and @var{n} non negative integers and @math{n<=n1+n2}.
4707 Being @var{n1} the number of objects of class A, @var{n2} the number of objects of class B, and
4708 @var{n} the size of the sample without replacement, this function returns the probability of
4709 event "exactly @var{x} objects are of class A".
4711 To make use of this function, write first @code{load("distrib")}.
4713 @opencatbox{Categories:}
4714 @category{Package distrib}
4720 @anchor{cdf_hypergeometric}
4721 @deffn {Function} cdf_hypergeometric (@var{x},@var{n1},@var{n2},@var{n})
4722 Returns the value at @var{x} of the distribution function of a @math{Hypergeometric(n1,n2,n)}
4723 random variable, with @var{n1}, @var{n2} and @var{n} non negative integers and @math{n<=n1+n2}.
4724 See @code{pdf_hypergeometric} for a more complete description.
4726 To make use of this function, write first @code{load("distrib")}.
4728 @opencatbox{Categories:}
4729 @category{Package distrib}
4735 @anchor{quantile_hypergeometric}
4736 @deffn {Function} quantile_hypergeometric (@var{q},@var{n1},@var{n2},@var{n})
4737 Returns the @var{q}-quantile of a @math{Hypergeometric(n1,n2,n)} random variable, with @var{n1}, @var{n2} and @var{n} non negative integers and @math{n<=n1+n2}; in other words, this is the inverse of @code{cdf_hypergeometric}. Argument @var{q} must be an element of @math{[0,1]}. To make use of this function, write first @code{load("distrib")}.
4739 @opencatbox{Categories:}
4740 @category{Package distrib}
4746 @anchor{mean_hypergeometric}
4747 @deffn {Function} mean_hypergeometric (@var{n1},@var{n2},@var{n})
4748 Returns the mean of a discrete uniform random variable @math{Hyp(n1,n2,n)}, with @var{n1}, @var{n2} and @var{n} non negative integers and @math{n<=n1+n2}. To make use of this function, write first @code{load("distrib")}.
4750 @opencatbox{Categories:}
4751 @category{Package distrib}
4757 @anchor{var_hypergeometric}
4758 @deffn {Function} var_hypergeometric (@var{n1},@var{n2},@var{n})
4759 Returns the variance of a hypergeometric random variable @math{Hyp(n1,n2,n)}, with @var{n1}, @var{n2} and @var{n} non negative integers and @math{n<=n1+n2}. To make use of this function, write first @code{load("distrib")}.
4761 @opencatbox{Categories:}
4762 @category{Package distrib}
4768 @anchor{std_hypergeometric}
4769 @deffn {Function} std_hypergeometric (@var{n1},@var{n2},@var{n})
4770 Returns the standard deviation of a @math{Hypergeometric(n1,n2,n)} random variable, with @var{n1}, @var{n2} and @var{n} non negative integers and @math{n<=n1+n2}. To make use of this function, write first @code{load("distrib")}.
4772 @opencatbox{Categories:}
4773 @category{Package distrib}
4779 @anchor{skewness_hypergeometric}
4780 @deffn {Function} skewness_hypergeometric (@var{n1},@var{n2},@var{n})
4781 Returns the skewness coefficient of a @math{Hypergeometric(n1,n2,n)} random variable, with @var{n1}, @var{n2} and @var{n} non negative integers and @math{n<=n1+n2}. To make use of this function, write first @code{load("distrib")}.
4783 @opencatbox{Categories:}
4784 @category{Package distrib}
4790 @anchor{kurtosis_hypergeometric}
4791 @deffn {Function} kurtosis_hypergeometric (@var{n1},@var{n2},@var{n})
4792 Returns the kurtosis coefficient of a @math{Hypergeometric(n1,n2,n)} random variable, with @var{n1}, @var{n2} and @var{n} non negative integers and @math{n<=n1+n2}. To make use of this function, write first @code{load("distrib")}.
4794 @opencatbox{Categories:}
4795 @category{Package distrib}
4801 @anchor{random_hypergeometric}
4802 @deffn {Function} random_hypergeometric (@var{n1},@var{n2},@var{n}) @
4803 @fname{random_hypergeometric} (@var{n1},@var{n2},@var{n},@var{m})
4805 Returns a @math{Hypergeometric(n1,n2,n)} random variate, with @var{n1}, @var{n2} and @var{n} non negative integers and @math{n<=n1+n2}. Calling @code{random_hypergeometric} with a fourth argument @var{m}, a random sample of size @var{m} will be simulated.
4807 Algorithm described in Kachitvichyanukul, V., Schmeiser, B.W. (1985) @var{Computer generation of hypergeometric random variates.} Journal of Statistical Computation and Simulation 22, 127-145.
4809 To make use of this function, write first @code{load("distrib")}.
4811 @opencatbox{Categories:}
4812 @category{Package distrib}
4813 @category{Random numbers}
4819 @anchor{pdf_negative_binomial}
4820 @deffn {Function} pdf_negative_binomial (@var{x},@var{n},@var{p})
4821 Returns the value at @var{x} of the probability function of a @math{Negative Binomial(n,p)} random variable, with @math{0 < p \leq 1} and @math{n} a positive number. To make use of this function, write first @code{load("distrib")}.
4823 @opencatbox{Categories:}
4824 @category{Package distrib}
4830 @anchor{cdf_negative_binomial}
4831 @deffn {Function} cdf_negative_binomial (@var{x},@var{n},@var{p})
4832 Returns the value at @var{x} of the distribution function of a @math{Negative Binomial(n,p)} random variable, with @math{0 < p \leq 1} and @math{n} a positive number.
4835 @c load ("distrib")$
4836 @c cdf_negative_binomial(3,4,1/8);
4839 (%i1) load ("distrib")$
4840 (%i2) cdf_negative_binomial(3,4,1/8);
4846 @opencatbox{Categories:}
4847 @category{Package distrib}
4853 @anchor{quantile_negative_binomial}
4854 @deffn {Function} quantile_negative_binomial (@var{q},@var{n},@var{p})
4855 Returns the @var{q}-quantile of a @math{Negative Binomial(n,p)} random variable, with @math{0 < p \leq 1} and @math{n} a positive number; in other words, this is the inverse of @code{cdf_negative_binomial}. Argument @var{q} must be an element of @math{[0,1]}. To make use of this function, write first @code{load("distrib")}.
4857 @opencatbox{Categories:}
4858 @category{Package distrib}
4864 @anchor{mean_negative_binomial}
4865 @deffn {Function} mean_negative_binomial (@var{n},@var{p})
4866 Returns the mean of a @math{Negative Binomial(n,p)} random variable, with @math{0 < p \leq 1} and @math{n} a positive number. To make use of this function, write first @code{load("distrib")}.
4868 @opencatbox{Categories:}
4869 @category{Package distrib}
4875 @anchor{var_negative_binomial}
4876 @deffn {Function} var_negative_binomial (@var{n},@var{p})
4877 Returns the variance of a @math{Negative Binomial(n,p)} random variable, with @math{0 < p \leq 1} and @math{n} a positive number. To make use of this function, write first @code{load("distrib")}.
4879 @opencatbox{Categories:}
4880 @category{Package distrib}
4886 @anchor{std_negative_binomial}
4887 @deffn {Function} std_negative_binomial (@var{n},@var{p})
4888 Returns the standard deviation of a @math{Negative Binomial(n,p)} random variable, with @math{0 < p \leq 1} and @math{n} a positive number. To make use of this function, write first @code{load("distrib")}.
4890 @opencatbox{Categories:}
4891 @category{Package distrib}
4897 @anchor{skewness_negative_binomial}
4898 @deffn {Function} skewness_negative_binomial (@var{n},@var{p})
4899 Returns the skewness coefficient of a @math{Negative Binomial(n,p)} random variable, with @math{0 < p \leq 1} and @math{n} a positive number. To make use of this function, write first @code{load("distrib")}.
4901 @opencatbox{Categories:}
4902 @category{Package distrib}
4908 @anchor{kurtosis_negative_binomial}
4909 @deffn {Function} kurtosis_negative_binomial (@var{n},@var{p})
4910 Returns the kurtosis coefficient of a @math{Negative Binomial(n,p)} random variable, with @math{0 < p \leq 1} and @math{n} a positive number. To make use of this function, write first @code{load("distrib")}.
4912 @opencatbox{Categories:}
4913 @category{Package distrib}
4919 @anchor{random_negative_binomial}
4920 @deffn {Function} random_negative_binomial (@var{n},@var{p}) @
4921 @fname{random_negative_binomial} (@var{n},@var{p},@var{m})
4923 Returns a @math{Negative Binomial(n,p)} random variate, with @math{0 < p \leq 1} and @math{n} a positive number. Calling @code{random_negative_binomial} with a third argument @var{m}, a random sample of size @var{m} will be simulated.
4925 Algorithm described in Devroye, L. (1986) @var{Non-Uniform Random Variate Generation}. Springer Verlag, p. 480.
4927 To make use of this function, write first @code{load("distrib")}.
4929 @opencatbox{Categories:}
4930 @category{Package distrib}
4931 @category{Random numbers}
4935 @c Undefine all the m4 macros we defined in this file.
4936 m4_undefine(<<<m4_Normal_RV>>>)