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_NormalRV>>>,
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>>>,
16 @c Define Chi^2(n), the chi-squared random variate function.
17 m4_define(<<<m4_chi2>>>,
18 m4_math(<<<\chi^2($1)>>>, <<<@math{Chi^2($2)}>>>))
20 @c Define the Gamma RV
21 m4_define(<<<m4_GammaRV>>>,
22 m4_math(<<<\Gamma\left($1,$2\right)>>>, <<<@math{Gamma($1,$2)}>>>))
24 @c Define the noncentral chi-squared RV
25 m4_define(<<<m4_noncentral_chi2>>>,
26 m4_math(<<<{\rm nc\_Chi}^2($1,$2)>>>, <<<@math{nc_Chi^2($1,$2)}>>>))
28 @c Define the exponential RV
29 m4_define(<<<m4_exponentialRV>>>,
30 m4_math(<<<{\rm Exponential}($1)>>>, <<<@math{Exponential($1)}>>>))
32 @c Define the Weibull RV
33 m4_define(<<<m4_weibullRV>>>,
34 m4_math(<<<{\rm Weibull}($1,$2)>>>, <<<@math{Weibull($1,$2)}>>>))
36 @c Define lognormal RV
37 m4_define(<<<m4_lognormalRV>>>,
38 m4_math(<<<{\rm Lognormal}($1,$2)>>>,<<<@math{Lognormal($1,$2)}>>>))
41 m4_define(<<<m4_betaRV>>>,
42 m4_math(<<<{\rm Beta}($1,$2)>>>,<<<@math{Beta($1,$2)}>>>))
44 @c Define continuous uniform RV
45 m4_define(<<<m4_continuous_uniformRV>>>,
47 ContinuousUniform}($1,$2)>>>,<<<@math{ContinuousUniform($1,$2)}>>>))
50 m4_define(<<<m4_logisticRV>>>,
51 m4_math(<<<{\rm Logistic}($1,$2)>>>,<<<<@math{Logistice($1,$2)}>>>))
54 m4_define(<<<m4_paretoRV>>>,
55 m4_math(<<<{\rm Pareto}($1,$2)>>>,<<<@math{Pareto($1,$2)}>>>))
58 m4_define(<<<m4_rayleighRV>>>,
59 m4_math(<<<{\rm Rayleigh}($1)>>>,<<<@math{Rayleigh($1)}>>>))
61 @node Introduction to distrib, Functions and Variables for continuous distributions
62 @section Introduction to distrib
65 Package @code{distrib} contains a set of functions for making probability computations on both discrete and continuous univariate models.
67 What follows is a short reminder of basic probabilistic related definitions.
69 Let @math{f(x)} be the @var{density function} of an absolute continuous random variable @math{X}. The @var{distribution function} is defined as
71 <<<F\left(x\right)=\int_{ -\infty }^{x}{f\left(u\right)\;du}>>>,
83 which equals the probability m4_math(<<<{\rm Pr}(X \le x)>>>, <<<@math{Pr(X <= x)}>>>).
85 The @var{mean} value is a localization parameter and is defined as
87 <<<E\left[X\right]=\int_{ -\infty }^{\infty }{x\,f\left(x\right)\;dx}>>>,
100 The @var{variance} is a measure of variation,
102 <<<V\left[X\right]=\int_{ -\infty }^{\infty }{f\left(x\right)\,\left(x
103 -E\left[X\right]\right)^2\;dx}>>>,
109 V[X] = I f(x) (x - E[X]) dx
115 which is a positive real number. The square root of the variance is
116 the @var{standard deviation}, m4_math(<<<D[x]=\sqrt{V[X]}>>>, <<<@math{D[X]=sqrt(V[X])}>>>), and it is another measure of variation.
118 The @var{skewness coefficient} is a measure of non-symmetry,
120 <<<SK\left[X\right]={{\int_{ -\infty }^{\infty }{f\left(x\right)\,
121 \left(x-E\left[X\right]\right)^3\;dx}}\over{D\left[X\right]^3}}>>>,
127 SK[X] = ----- I f(x) (x - E[X]) dx
134 And the @var{kurtosis coefficient} measures the peakedness of the distribution,
136 <<<KU\left[X\right]={{\int_{ -\infty }^{\infty }{f\left(x\right)\,
137 \left(x-E\left[X\right]\right)^4\;dx}}\over{D\left[X\right]^4}}-3>>>,
143 KU[X] = ----- I f(x) (x - E[X]) dx - 3
149 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.
151 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
153 <<< F\left(x\right)=\sum_{x_{i}\leq x}{f\left(x_{i}\right)} >>>,
166 The mean, variance, standard deviation, skewness coefficient and kurtosis coefficient take the form
169 E\left[X\right]&=\sum_{x_{i}}{x_{i}f\left(x_{i}\right)}, \cr
170 V\left[X\right]&=\sum_{x_{i}}{f\left(x_{i}\right)\left(x_{i}-E\left[X\right]\right)^2},\cr
171 D\left[X\right]&=\sqrt{V\left[X\right]},\cr
172 SK\left[X\right]&={{\sum_{x_{i}}{f\left(x\right)\,
173 \left(x-E\left[X\right]\right)^3\;dx}}\over{D\left[X\right]^3}}, \cr
174 KU\left[X\right]&={{\sum_{x_{i}}{f\left(x\right)\,
175 \left(x-E\left[X\right]\right)^4\;dx}}\over{D\left[X\right]^4}}-3,
189 V[X] = > f(x ) (x - E[X]) ,
199 SK[X] = ------- > f(x ) (x - E[X])
207 KU[X] = ------- > f(x ) (x - E[X]) - 3 ,
216 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,
219 Density function (pdf_*)
220 Distribution function (cdf_*)
221 Quantile (quantile_*)
224 Standard deviation (std_*)
225 Skewness coefficient (skewness_*)
226 Kurtosis coefficient (kurtosis_*)
227 Random variate (random_*)
230 The second part is an explicit reference to the probabilistic model,
232 Continuous distributions:
236 Noncentral Chi^2 (*noncentral_chi2)
239 Lognormal (*lognormal)
242 Continuous uniform (*continuous_uniform)
251 Discrete distributions:
254 Bernoulli (*bernoulli)
255 Geometric (*geometric)
256 Discrete uniform (*discrete_uniform)
257 hypergeometric (*hypergeometric)
258 Negative binomial (*negative_binomial)
259 Finite discrete (*general_finite_discrete)
262 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}.
265 In order to make use of package @code{distrib} you need first to load it by typing
267 (%i1) load("distrib")$
270 For comments, bugs or suggestions, please contact the author at @var{'riotorto AT yahoo DOT com'}.
272 @opencatbox{Categories:}
273 @category{Statistical functions}
274 @category{Share packages}
275 @category{Package distrib}
281 @node Functions and Variables for continuous distributions, Normal Random Variable, Introduction to distrib
282 @section Functions and Variables for continuous distributions
283 Maxima knows the following kinds of continuous distributions.
286 * Normal Random Variable::
287 * Student's t Random Variable::
290 @node Normal Random Variable, Functions and Variables for discrete distributions, Functions and Variables for continuous distributions
291 @subsection Normal Random Variable
293 @node Introduction to Normal Random Variables
294 @subsubsection Introduction to Normal Random Variables
296 Normal random variables (also called Gaussian) is denoted
297 by m4_NormalRV(m, s) where
298 @math{m} is the mean and @math{s > 0} is the standard deviation.
300 @node Functions and Variables for Normal Random Variables
301 @subsubsection Functions and Variables for Normal Random Variables
303 @deffn {Function} pdf_normal (@var{x},@var{m},@var{s})
304 Returns the value at @var{x} of the density function of a m4_NormalRV(m,s) random variable, with @math{s>0}. To make use of this function, write first @code{load("distrib")}.
306 The pdf is the well-known integral
308 <<<{1\over s\sqrt{2\pi}} e^{\displaystyle -{(x-m)^2\over 2s^2}}>>>,
309 <<<@math{1/(s*sqrt(2*%pi))*exp(-1/(2s^2)*(x-m)^2)}>>>)
311 @opencatbox{Categories:}
312 @category{Package distrib}
319 @deffn {Function} cdf_normal (@var{x},@var{m},@var{s})
320 Returns the value at @var{x} of the distribution function of a m4_NormalRV(m,s) random variable, with @math{s>0}. This function is defined in terms of Maxima's built-in error function @code{erf}.
322 The cdf can be written analytically:
324 <<<{1\over 2} + {1\over 2} {\rm erf}\left(x-m\over s\sqrt{2}\right)>>>,
325 <<<@math{1/2 + 1/2*erf((x-m)/(s*sqrt(2)))}>>>)
329 @c cdf_normal(x,m,s);
332 (%i1) load ("distrib")$
333 (%i2) cdf_normal(x,m,s);
337 (%o2) -------------- + -
341 See also @mrefdot{erf}
343 @opencatbox{Categories:}
344 @category{Package distrib}
350 @anchor{quantile_normal}
351 @deffn {Function} quantile_normal (@var{q},@var{m},@var{s})
352 Returns the @var{q}-quantile of a m4_NormalRV(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")}.
356 @c quantile_normal(95/100,0,1);
360 (%i1) load ("distrib")$
361 (%i2) quantile_normal(95/100,0,1);
363 (%o2) sqrt(2) inverse_erf(--)
366 (%o3) 1.644853626951472
369 @opencatbox{Categories:}
370 @category{Package distrib}
377 @deffn {Function} mean_normal (@var{m},@var{s})
378 Returns the mean of a m4_NormalRV(m,s) random variable, with @math{s>0}, namely @var{m}. To make use of this function, write first @code{load("distrib")}.
380 @opencatbox{Categories:}
381 @category{Package distrib}
388 @deffn {Function} var_normal (@var{m},@var{s})
389 Returns the variance of a m4_NormalRV(m,s) random variable, with @math{s>0}, namely @math{s^2}. To make use of this function, write first @code{load("distrib")}.
391 @opencatbox{Categories:}
392 @category{Package distrib}
398 @deffn {Function} std_normal (@var{m},@var{s})
399 Returns the standard deviation of a m4_NormalRV(m,s) random variable, with @math{s>0}, namely @var{s}. To make use of this function, write first @code{load("distrib")}.
401 @opencatbox{Categories:}
402 @category{Package distrib}
408 @anchor{skewness_normal}
409 @deffn {Function} skewness_normal (@var{m},@var{s})
410 Returns the skewness coefficient of a m4_NormalRV(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")}.
412 @opencatbox{Categories:}
413 @category{Package distrib}
419 @anchor{kurtosis_normal}
420 @deffn {Function} kurtosis_normal (@var{m},@var{s})
421 Returns the kurtosis coefficient of a m4_NormalRV(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")}.
423 @opencatbox{Categories:}
424 @category{Package distrib}
430 @anchor{random_normal}
431 @deffn {Function} random_normal (@var{m},@var{s}) @
432 @fname{random_normal} (@var{m},@var{s},@var{n})
434 Returns a m4_NormalRV(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.
436 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.
438 To make use of this function, write first @code{load("distrib")}.
440 @opencatbox{Categories:}
441 @category{Package distrib}
442 @category{Random numbers}
447 @node Student's t Random Variable, Noncentral Student's t Random Variable, Normal Random Variable, Normal Random Variable
448 @subsection Student's t Random Variable
450 @node Introduction to Student's t Random Variable
451 @subsubsection Introduction to Student's t Random Variable
453 Student's t random variable is denoted by m4_student_t(n) where
454 @math{n} is the degrees of freedom with @math{n > 0}. If @math{Z} is
455 a m4_NormalRV(0,1) variable and @math{V} is an
456 independent m4_math(\chi^2, chi^2) random variable with @math{n} degress of
460 <<<Z \over \sqrt{V/n}>>>,
461 <<<@math{Z/sqrt(V/n)}>>>)
463 has a Student's @math{t}-distribution with @math{n} degrees of freedom.
465 @node Functions and Variables for Student's t Random Variable
466 @subsubsection Functions and Variables for Student's t Random Variable
467 @anchor{pdf_student_t}
468 @deffn {Function} pdf_student_t (@var{x},@var{n})
469 Returns the value at @var{x} of the density function of a Student random variable m4_student_t(n), with @math{n>0} degrees of freedom. To make use of this function, write first @code{load("distrib")}.
473 <<<\left[\sqrt{n} B\left({1\over 2}, {n\over 2}\right)\right]^{-1}
474 \left(1+{x^2\over n}\right)^{\displaystyle -{n+1\over 2}}>>>,
475 <<<@math{(sqrt(n)*beta(1/2,n/2))^(-1) (1+x^2/n)^(-(n+1)/2)}>>>)
477 @opencatbox{Categories:}
478 @category{Package distrib}
484 @anchor{cdf_student_t}
485 @deffn {Function} cdf_student_t (@var{x},@var{n})
486 Returns the value at @var{x} of the distribution function of a Student random variable m4_student_t(n), with @math{n>0} degrees of freedom.
490 <<<{\rm cdf\_student\_t}(x,n) =
492 1-\displaystyle{1\over 2} I_t\left({n\over 2}, {1\over 2}\right) & $x \ge 0$ \cr
493 \displaystyle{1\over 2} I_t\left({n\over 2}, {1\over 2}\right) & $x < 0$
497 [ 1-1/2*I_t(n/2, 1/2) x >= 0
498 cdf_student_t(x,n) = [
499 [ 1/2*I_t(n/2, 1/2) x < 0
503 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
504 @ref{beta_incomplete_regularized} function.
508 @c cdf_student_t(1/2, 7/3);
512 (%i1) load ("distrib")$
513 (%i2) cdf_student_t(1/2, 7/3);
515 beta_incomplete_regularized(-, -, --)
517 (%o2) 1 - -------------------------------------
520 (%o3) .6698450596140415
523 @opencatbox{Categories:}
524 @category{Package distrib}
530 @anchor{quantile_student_t}
531 @deffn {Function} quantile_student_t (@var{q},@var{n})
532 Returns the @var{q}-quantile of a Student random variable m4_student_t(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")}.
534 @opencatbox{Categories:}
535 @category{Package distrib}
541 @anchor{mean_student_t}
542 @deffn {Function} mean_student_t (@var{n})
543 Returns the mean of a Student random variable m4_student_t(n), with @math{n>0}, which is always equal to 0. To make use of this function, write first @code{load("distrib")}.
545 @opencatbox{Categories:}
546 @category{Package distrib}
552 @anchor{var_student_t}
553 @deffn {Function} var_student_t (@var{n})
554 Returns the variance of a Student random variable m4_student_t(n), with @math{n>2}.
561 (%i1) load ("distrib")$
562 (%i2) var_student_t(n);
568 @opencatbox{Categories:}
569 @category{Package distrib}
575 @anchor{std_student_t}
576 @deffn {Function} std_student_t (@var{n})
577 Returns the standard deviation of a Student random variable m4_student_t(n), with @math{n>2}. To make use of this function, write first @code{load("distrib")}.
579 @opencatbox{Categories:}
580 @category{Package distrib}
586 @anchor{skewness_student_t}
587 @deffn {Function} skewness_student_t (@var{n})
588 Returns the skewness coefficient of a Student random variable m4_student_t(n), with @math{n>3}, which is always equal to 0. To make use of this function, write first @code{load("distrib")}.
590 @opencatbox{Categories:}
591 @category{Package distrib}
597 @anchor{kurtosis_student_t}
598 @deffn {Function} kurtosis_student_t (@var{n})
599 Returns the kurtosis coefficient of a Student random variable m4_student_t(n), with @math{n>4}. To make use of this function, write first @code{load("distrib")}.
601 @opencatbox{Categories:}
602 @category{Package distrib}
608 @anchor{random_student_t}
609 @deffn {Function} random_student_t (@var{n}) @
610 @fname{random_student_t} (@var{n},@var{m})
612 Returns a Student random variate m4_student_t(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.
614 The implemented algorithm is based on the fact that if @math{Z} is a
615 normal random variable m4_NormalRV(0,1) and @math{S^2} is
616 a m4_math(\chi^2, chi squared) random variable with @math{n} degrees of
617 freedom, m4_chi2(n), then
620 <<<X={{Z}\over{\sqrt{{S^2}\over{n}}}}>>>,
631 is a Student random variable with @math{n} degrees of freedom, m4_student_t(n).
633 To make use of this function, write first @code{load("distrib")}.
635 @opencatbox{Categories:}
636 @category{Package distrib}
637 @category{Random numbers}
642 @node Noncentral Student's t Random Variable, Chi-squared Random Variable, Student's t Random Variable, Normal Random Variable
643 @subsection Noncentral Student's t Random Variable
645 @c Define m4_nct to produce the nc_t function that displays nicely in
646 @c html/TeX and info.
647 m4_define(<<<m4_noncentral_t>>>,
648 m4_math(<<<{\rm nc\_t}($1, $2)>>>,<<<@math{nc_t($1, $2)}>>>))
650 @node Introduction to Noncentral Student's t Random Variable
651 @subsubsection Introduction to Noncentral Student's t Random Variable
652 Let @math{ncp} be the non-centrality parameter, @math{n} be the
653 degrees of freedom for the non-central Student's @math{t} random
656 Then let @math{X} be a m4_NormalRV(n,ncp) and @math{S^2} be an independent m4_math(\chi^2,
657 chi squared) random variable with @math{n} degrees of freedom, the
660 <<<U = {X \over \sqrt{S^2\over n}}>>>,
661 <<<@math{U = X/sqrt(S^2/n)}>>>)
663 has a non-central Student's @math{t} distribution with non-centrality
664 parameter @math{ncp}.
666 @node Functions and Variables for Noncentral Student's t Random Variable
667 @subsubsection Functions and Variables for Noncentral Student's t Random Variable
669 @anchor{pdf_noncentral_student_t}
670 @deffn {Function} pdf_noncentral_student_t (@var{x},@var{n},@var{ncp})
671 Returns the value at @var{x} of the density function of a noncentral Student random variable m4_noncentral_t(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")}.
675 <<<\left[\sqrt{n} B\left({1\over 2}, {n\over
676 2}\right)\right]^{-1}\left(1+{x^2\over n}\right)^{-{(n+1)/2}}
677 \exp\left(-{\mu^2\over 2}\right)
678 \bigg[A_n(x; \mu) + B_n(x; \mu)\bigg]>>>,
685 %e (x + 1) (B(x, n, mu) + An(x, n, mu))
686 -------------------------------------------------
696 A_n(x;\mu) &= {}_1F_1\left({n+1\over 2}; {1\over 2}; {\mu^2 x^2\over
697 2\left(x^2+n\right)}\right) \cr
698 B_n(x;\mu) &= {\sqrt{2}\mu x \over \sqrt{x^2+n}} {\Gamma\left({n\over
699 2} + 1\right)\over \Gamma\left({n+1\over 2}\right)}\;
700 {}_1F_1\left({n\over 2} + 1; {3\over 2}; {\mu^2 x^2\over
701 2\left(x^2+n\right)}\right)
707 A(x, n, mu) = %f ([-----], [-], ----------)
713 sqrt(2) mu %f ([- + 1], [-], ----------) gamma(- + 1) x
716 B(x, n, mu) = ----------------------------------------------------------
718 gamma(-----) sqrt(x + n)
722 and m4_math(\mu, mu) is the non-centrality parameter @math{ncp}.
724 Sometimes an extra work is necessary to get the final result.
728 @c expand(pdf_noncentral_student_t(3,5,0.1));
732 (%i1) load ("distrib")$
733 (%i2) expand(pdf_noncentral_student_t(3,5,0.1));
736 0.04296414417400905 5 1.323650307289301e-6 5
737 (%o2) ------------------------ + -------------------------
741 1.94793720435093e-4 5
742 + ------------------------
746 (%o3) .02080593159405669
749 @opencatbox{Categories:}
750 @category{Package distrib}
756 @anchor{cdf_noncentral_student_t}
757 @deffn {Function} cdf_noncentral_student_t (@var{x},@var{n},@var{ncp})
758 Returns the value at @var{x} of the distribution function of a noncentral Student random variable m4_noncentral_t(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.
762 @c cdf_noncentral_student_t(-2,5,-5);
765 (%i1) load ("distrib")$
766 (%i2) cdf_noncentral_student_t(-2,5,-5);
767 (%o2) .9952030093319743
770 @opencatbox{Categories:}
771 @category{Package distrib}
777 @anchor{quantile_noncentral_student_t}
778 @deffn {Function} quantile_noncentral_student_t (@var{q},@var{n},@var{ncp})
779 Returns the @var{q}-quantile of a noncentral Student random variable m4_noncentral_t(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")}.
781 @opencatbox{Categories:}
782 @category{Package distrib}
788 @anchor{mean_noncentral_student_t}
789 @deffn {Function} mean_noncentral_student_t (@var{n},@var{ncp})
790 Returns the mean of a noncentral Student random variable m4_noncentral_t(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")}.
794 <<<\mu \sqrt{n}\; \Gamma\left(\displaystyle{n-1\over 2}\right) \over
795 \sqrt{2}\;\Gamma\left(\displaystyle{n\over 2}\right)>>>,
799 mu gamma(-----) sqrt(n)
801 -----------------------
808 where m4_math(\mu, mu) is the noncentrality parameter @math{ncp}.
812 @c mean_noncentral_student_t(df,k);
815 (%i1) load ("distrib")$
816 (%i2) mean_noncentral_student_t(df,k);
818 gamma(------) sqrt(df) k
820 (%o2) ------------------------
826 @opencatbox{Categories:}
827 @category{Package distrib}
833 @anchor{var_noncentral_student_t}
834 @deffn {Function} var_noncentral_student_t (@var{n},@var{ncp})
835 Returns the variance of a noncentral Student random variable m4_noncentral_t(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")}.
839 <<<{n(\mu^2+1)\over n-2} - {n\mu^2\; \Gamma\left(\displaystyle{n-1\over 2}\right)^2
840 \over 2\Gamma\left(\displaystyle{n\over 2}\right)^2}>>>,
844 2 gamma (-----) n ncp
846 ------------ - --------------------
853 where m4_math(\mu, mu) is the noncentrality parameter @math{ncp}.
855 @opencatbox{Categories:}
856 @category{Package distrib}
862 @anchor{std_noncentral_student_t}
863 @deffn {Function} std_noncentral_student_t (@var{n},@var{ncp})
864 Returns the standard deviation of a noncentral Student random variable m4_noncentral_t(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")}.
866 @opencatbox{Categories:}
867 @category{Package distrib}
873 @anchor{skewness_noncentral_student_t}
874 @deffn {Function} skewness_noncentral_student_t (@var{n},@var{ncp})
875 Returns the skewness coefficient of a noncentral Student random variable m4_noncentral_t(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")}.
877 @c The TeX form is obtained from
878 @c tex(skewness_noncentral_student_t(n,mu)). Likewise the info form
879 @c is just cut-n-pasted from maxima's terminal output.
880 If @math{U} is a non-central Student's @math{t} random variable with
881 @math{n} degrees of freedom and a noncentrality parameter m4_math(\mu,
882 @math{mu}), the skewness is
886 {\mu\sqrt{n}\,\Gamma\left({{n-1}\over{2}}\right)
887 \over{\sqrt{2}\Gamma\left({{n
888 }\over{2}}\right)\sigma^{3}}}\left({{n
889 \left(2n+\mu^2-3\right)}\over{\left(n-3\right)\left(n-2\right)}}
890 -2\sigma^2\right) \cr
891 \sigma^2 &= {{n\left(\mu^2+1\right)}\over{n-2}}-{{n \mu^2\,
892 \Gamma\left({{n-1}\over{2}}\right)^2}\over{2\Gamma\left({{n
893 }\over{2}}\right)^2}}
898 skewness_noncentral_student_t(n, mu) =
900 n - 1 n (2 n + mu - 3)
901 (mu gamma(-----) sqrt(n) (-----------------
906 - 2 (----------- - -------------------)))
913 /(sqrt(2) gamma(-) (----------- - -------------------) )
920 @opencatbox{Categories:}
921 @category{Package distrib}
927 @anchor{kurtosis_noncentral_student_t}
928 @deffn {Function} kurtosis_noncentral_student_t (@var{n},@var{ncp})
929 Returns the kurtosis coefficient of a noncentral Student random variable m4_noncentral_t(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")}.
931 If @math{U} is a non-central Student's @math{t} random variable with
932 @math{n} degrees of freedom and a noncentrality parameter m4_math(\mu,
933 @math{mu}), the kurtosis is
935 @c The formula we see can be basically derived by computing
936 @c (kurtosis_noncentral_student_t(n,mu)+3)*var_noncentral_student_t(n,mu)^2,
937 @c which comes from the definition of kurtosis. The rest is then
938 @c obtained by replacing a constant by F.
942 {\mu_4\over \sigma^4} - 3\cr
943 \mu_4 &= {{\left(\mu^4+6\mu^2+3\right)n^2}\over{(n-4)(n-2)}}
944 -\left({{n\left(3(3n-5)+\mu^2(n+1)\right)
945 }\over{(n-3)(n-2)}}-3\sigma^2\right) F \cr
946 \sigma^2 &= {{n\left(\mu^2+1\right)}\over{n-2}}-{{n \mu^2
947 \Gamma\left({{n-1}\over{2}}\right)^2}\over{2\Gamma\left({{n
948 }\over{2}}\right)^2}} \cr
949 F &= {n\mu^2\Gamma\left({n-1\over 2}\right)^2 \over
950 2\sigma^4\Gamma\left({n\over 2}\right)^2}
954 kurtosis_noncentral_student_t(n, mu) =
956 (mu + 6 mu + 3) n 2 2 n - 1
957 (-------------------- - (mu gamma (-----) n
960 2 2 mu gamma (-----) n
961 n (3 (3 n - 5) + mu (n + 1)) (mu + 1) n 2
962 (----------------------------- - 3 (----------- - -------------------)))
963 (n - 3) (n - 2) n - 2 2 n
969 /(2 gamma (-)))/(----------- - -------------------) - 3
976 @opencatbox{Categories:}
977 @category{Package distrib}
983 @anchor{random_noncentral_student_t}
984 @deffn {Function} random_noncentral_student_t (@var{n},@var{ncp}) @
985 @fname{random_noncentral_student_t} (@var{n},@var{ncp},@var{m})
987 Returns a noncentral Student random variate m4_noncentral_t(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.
989 The implemented algorithm is based on the fact that if @var{X} is a
990 normal random variable m4_NormalRV(ncp,1) and @math{S^2} is
991 a m4_math(\chi^2, chi square) random variable with @var{n} degrees of freedom, m4_chi2(n), then
993 <<<U={{X}\over{\sqrt{{S^2}\over{n}}}}>>>,
1004 is a noncentral Student random variable with @math{n} degrees of freedom and noncentrality parameter @math{ncp}, m4_noncentral_t(n,ncp).
1006 To make use of this function, write first @code{load("distrib")}.
1008 @opencatbox{Categories:}
1009 @category{Package distrib}
1010 @category{Random numbers}
1016 @node Chi-squared Random Variable, Noncentral Chi-squared Random Variable, Noncentral Student's t Random Variable, Normal Random Variable
1017 @subsection Chi-squared Random Variable
1019 @node Introduction to Chi-squared Random Variable
1020 @subsubsection Introduction to Chi-squared Random Variable
1022 Let m4_math(<<<X_1, X_2, \ldots, X_n>>>, <<<@math{X_1, X_2, ...,
1023 X_k}>>>) be independent and identically distributed m4_NormalRV(0,1) variables. Then
1025 <<<X^2 = \sum_{i=1}^n X_i^2>>>,
1026 <<<@math{X^2 = sum(X_i^2, i, 1, n)}>>>)
1028 is said to follow a chi-square distribution with @math{n} degrees of
1031 @node Functions and Variables for Chi-squared Random Variable
1032 @subsubsection Functions and Variables for Chi-squared Random Variable
1035 @deffn {Function} pdf_chi2 (@var{x},@var{n})
1036 Returns the value at @var{x} of the density function of a Chi-square random variable m4_chi2(n), with @math{n>0}.
1037 The m4_chi2(n) random variable is equivalent to the m4_GammaRV(n/2,2).
1042 <<<{\rm pdf\_chi2}(x,n) =
1044 \displaystyle{x^{n/2-1} e^{-x/2} \over 2^{n/2} \Gamma\left({n\over 2}\right)} & $x
1052 pdf_chi2(x, n) = -----------------------------
1060 @c load ("distrib")$
1064 (%i1) load ("distrib")$
1065 (%i2) pdf_chi2(x,n);
1068 (%o2) ----------------
1074 @opencatbox{Categories:}
1075 @category{Package distrib}
1082 @deffn {Function} cdf_chi2 (@var{x},@var{n})
1083 Returns the value at @math{x} of the distribution function of a Chi-square random variable m4_chi2(n), with @math{n>0}.
1087 <<<{\rm cdf\_chi2}(x,n) =
1089 1 - Q\left(\displaystyle{n\over 2}, {x\over 2}\right) & $x > 0$ \cr
1095 cdf_chi2(x, n) = (1 - Q(-, -)) unit_step(x)
1099 where @math{Q(a,z)} is the @ref{gamma_incomplete_regularized} function.
1102 @c load ("distrib")$
1107 (%i1) load ("distrib")$
1108 (%i2) cdf_chi2(3,4);
1110 (%o2) 1 - gamma_incomplete_regularized(2, -)
1113 (%o3) .4421745996289256
1116 @opencatbox{Categories:}
1117 @category{Package distrib}
1123 @anchor{quantile_chi2}
1124 @deffn {Function} quantile_chi2 (@var{q},@var{n})
1125 Returns the @var{q}-quantile of a Chi-square random variable m4_chi2(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]}.
1127 This function has no closed form and it is numerically computed.
1130 @c load ("distrib")$
1131 @c quantile_chi2(0.99,9);
1134 (%i1) load ("distrib")$
1135 (%i2) quantile_chi2(0.99,9);
1136 (%o2) 21.66599433346194
1139 @opencatbox{Categories:}
1140 @category{Package distrib}
1147 @deffn {Function} mean_chi2 (@var{n})
1148 Returns the mean of a Chi-square random variable m4_chi2(n), with @math{n>0}.
1150 The m4_chi2(n) random variable is equivalent to the m4_GammaRV(n/2,2).
1153 @c load ("distrib")$
1157 (%i1) load ("distrib")$
1162 @opencatbox{Categories:}
1163 @category{Package distrib}
1170 @deffn {Function} var_chi2 (@var{n})
1171 Returns the variance of a Chi-square random variable m4_chi2(n), with @math{n>0}.
1173 The m4_chi2(n) random variable is equivalent to the m4_GammaRV(n/2,2).
1176 @c load ("distrib")$
1180 (%i1) load ("distrib")$
1185 @opencatbox{Categories:}
1186 @category{Package distrib}
1193 @deffn {Function} std_chi2 (@var{n})
1194 Returns the standard deviation of a Chi-square random variable m4_chi2(n), with @math{n>0}.
1196 The m4_chi2(n) random variable is equivalent to the m4_GammaRV(n/2,2).
1199 @c load ("distrib")$
1203 (%i1) load ("distrib")$
1205 (%o2) sqrt(2) sqrt(n)
1208 @opencatbox{Categories:}
1209 @category{Package distrib}
1215 @anchor{skewness_chi2}
1216 @deffn {Function} skewness_chi2 (@var{n})
1217 Returns the skewness coefficient of a Chi-square random variable m4_chi2(n), with @math{n>0}.
1219 The m4_chi2(n) random variable is equivalent to the m4_GammaRV(n/2,2).
1222 @c load ("distrib")$
1223 @c skewness_chi2(n);
1226 (%i1) load ("distrib")$
1227 (%i2) skewness_chi2(n);
1234 @opencatbox{Categories:}
1235 @category{Package distrib}
1241 @anchor{kurtosis_chi2}
1242 @deffn {Function} kurtosis_chi2 (@var{n})
1243 Returns the kurtosis coefficient of a Chi-square random variable m4_chi2(n), with @math{n>0}.
1245 The m4_chi2(n) random variable is equivalent to the m4_GammaRV(n/2,2).
1248 @c load ("distrib")$
1249 @c kurtosis_chi2(n);
1252 (%i1) load ("distrib")$
1253 (%i2) kurtosis_chi2(n);
1259 @opencatbox{Categories:}
1260 @category{Package distrib}
1266 @anchor{random_chi2}
1267 @deffn {Function} random_chi2 (@var{n}) @
1268 @fname{random_chi2} (@var{n},@var{m})
1270 Returns a Chi-square random variate m4_chi2(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.
1272 The simulation is based on the Ahrens-Cheng algorithm. See @code{random_gamma} for details.
1274 To make use of this function, write first @code{load("distrib")}.
1276 @opencatbox{Categories:}
1277 @category{Package distrib}
1278 @category{Random numbers}
1284 @node Noncentral Chi-squared Random Variable, F Random Variable, Chi-squared Random Variable, Normal Random Variable
1285 @subsection Noncentral Chi-squared Random Variable
1286 @node Introduction to Noncentral Chi-squared Random Variable
1287 @subsubsection Introduction to Noncentral Chi-squared Random Variable
1289 Let m4_math(<<<X_1, X_2, ..., X_n>>>, <<<@math{X[1], X[2], ..., X[n]}>>>) be @math{n}
1290 independent normally distributed random variables with
1291 means m4_math(\mu_k, mu[k]) and unit variances. Then the random variable
1294 <<<\sum_{k=1}^n X_k^2>>>,
1295 <<<@math{sum(X[k]^2, k, 1, n)}>>>)
1297 has a noncentral m4_math(\chi^2, chi-squared) distribution. The
1298 number of degrees of freedom is @math{n}, and the noncentrality
1299 parameter is defined by
1302 <<<\sum_{k=1}^n \mu_k^2>>>,
1303 <<<@math{sum(mu[k]^2, k, 1, n)}>>>)
1306 @node Functions and Variables for Noncentral Chi-squared Random Variable
1307 @subsubsection Functions and Variables for Noncentral Chi-squared Random Variable
1308 @anchor{pdf_noncentral_chi2}
1309 @deffn {Function} pdf_noncentral_chi2 (@var{x},@var{n},@var{ncp})
1310 Returns the value at @math{x} of the density function of a
1311 noncentral m4_math(\chi^2, Chi-square) random
1312 variable m4_noncentral_chi2(n,ncp), with @math{n>0} and noncentrality parameter @math{ncp>=0}. To
1313 make use of this function, write first @code{load("distrib")}.
1315 For @math{x < 0}, the pdf is 0, and for m4_math(x \ge 0, @math{x >= 0}) the pdf is
1317 <<<{\rm pdf\_noncentral\_chi2}(x, n,\lambda) =
1318 {1\over 2}e^{-(x+\lambda)/2} \left(x\over
1319 \lambda\right)^{n/4-1/2}I_{{n\over 2} - 1}\left(\sqrt{n \lambda}\right)
1323 pdf_noncentral_chi2(x, n, ncp) =
1327 bessel_i(- - 1, sqrt(ncp x)) (---) %e unit_step(x)
1329 ----------------------------------------------------------------------
1334 @opencatbox{Categories:}
1335 @category{Package distrib}
1341 @anchor{cdf_noncentral_chi2}
1342 @deffn {Function} cdf_noncentral_chi2 (@var{x},@var{n},@var{ncp})
1343 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")}.
1345 @opencatbox{Categories:}
1346 @category{Package distrib}
1352 @anchor{quantile_noncentral_chi2}
1353 @deffn {Function} quantile_noncentral_chi2 (@var{q},@var{n},@var{ncp})
1354 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]}.
1356 This function has no closed form and it is numerically computed.
1358 @opencatbox{Categories:}
1359 @category{Package distrib}
1365 @anchor{mean_noncentral_chi2}
1366 @deffn {Function} mean_noncentral_chi2 (@var{n},@var{ncp})
1367 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}.
1369 @opencatbox{Categories:}
1370 @category{Package distrib}
1376 @anchor{var_noncentral_chi2}
1377 @deffn {Function} var_noncentral_chi2 (@var{n},@var{ncp})
1378 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}.
1380 @opencatbox{Categories:}
1381 @category{Package distrib}
1387 @anchor{std_noncentral_chi2}
1388 @deffn {Function} std_noncentral_chi2 (@var{n},@var{ncp})
1389 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}.
1391 @opencatbox{Categories:}
1392 @category{Package distrib}
1398 @anchor{skewness_noncentral_chi2}
1399 @deffn {Function} skewness_noncentral_chi2 (@var{n},@var{ncp})
1400 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}.
1402 @opencatbox{Categories:}
1403 @category{Package distrib}
1409 @anchor{kurtosis_noncentral_chi2}
1410 @deffn {Function} kurtosis_noncentral_chi2 (@var{n},@var{ncp})
1411 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}.
1413 @opencatbox{Categories:}
1414 @category{Package distrib}
1420 @anchor{random_noncentral_chi2}
1421 @deffn {Function} random_noncentral_chi2 (@var{n},@var{ncp}) @
1422 @fname{random_noncentral_chi2} (@var{n},@var{ncp},@var{m})
1424 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.
1426 To make use of this function, write first @code{load("distrib")}.
1428 @opencatbox{Categories:}
1429 @category{Package distrib}
1430 @category{Random numbers}
1437 @node F Random Variable, Exponential Random Variable, Noncentral Chi-squared Random Variable, Normal Random Variable
1438 @subsection F Random Variable
1439 @node Introduction to F Random Variable
1440 @subsubsection Introduction to F Random Variable
1441 Let @math{S_1} and @math{S_2} be independent random variables with
1442 a m4_math(\chi^2, chi-squared) distribution with degrees of freedom
1443 @math{n} and @math{m}, respectively. Then
1445 <<<F = {S_1/n \over S_2/m}>>>,
1446 <<<@math{F = (S_1/n)/(S_2/m)}>>>) has an @math{F} distribution with @math{n} and @math{m} degrees of
1449 @node Functions and Variables for F Random Variable
1450 @subsubsection Functions and Variables for F Random Variable
1452 @deffn {Function} pdf_f (@var{x},@var{m},@var{n})
1453 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")}.
1457 <<<{\rm pdf\_f}(x,n,m) =
1459 B\left({n\over 2},{m\over 2}\right)^{-1}
1460 \left(\displaystyle{n\over m}\right)^{n/ 2}
1462 \left(1 + \displaystyle{n\over m}x\right)^{-\left(n+m\right)/2} & $x > 0$ \cr
1470 n n/2 n + m n/2 - 1 n x 2
1471 (-) gamma(-----) x (--- + 1) unit_step(x)
1473 ------------------------------------------------------------
1480 @opencatbox{Categories:}
1481 @category{Package distrib}
1488 @deffn {Function} cdf_f (@var{x},@var{m},@var{n})
1489 Returns the value at @var{x} of the distribution function of a F random variable @math{F(m,n)}, with @math{m,n>0}.
1493 <<<{\rm cdf\_f}(x,n,m) =
1495 1 - I_z\left(\displaystyle{n\over 2}, {m\over 2}\right) & $x > 0$ \cr
1501 cdf_f(x, n, m) = (1 - beta_incomplete_regularized(-, -, -------))
1510 <<<z = {m\over nx+m}>>>,
1513 and m4_math(I_z(a,b)) is the @ref{beta_incomplete_regularized}
1517 @c load ("distrib")$
1522 (%i1) load ("distrib")$
1523 (%i2) cdf_f(2,3,9/4);
1525 (%o2) 1 - beta_incomplete_regularized(-, -, --)
1528 (%o3) 0.66756728179008
1531 @opencatbox{Categories:}
1532 @category{Package distrib}
1539 @deffn {Function} quantile_f (@var{q},@var{m},@var{n})
1540 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]}.
1543 @c load ("distrib")$
1544 @c quantile_f(2/5,sqrt(3),5);
1547 (%i1) load ("distrib")$
1548 (%i2) quantile_f(2/5,sqrt(3),5);
1549 (%o2) 0.518947838573693
1552 @opencatbox{Categories:}
1553 @category{Package distrib}
1560 @deffn {Function} mean_f (@var{m},@var{n})
1561 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")}.
1563 @opencatbox{Categories:}
1564 @category{Package distrib}
1571 @deffn {Function} var_f (@var{m},@var{n})
1572 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")}.
1574 @opencatbox{Categories:}
1575 @category{Package distrib}
1582 @deffn {Function} std_f (@var{m},@var{n})
1583 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")}.
1585 @opencatbox{Categories:}
1586 @category{Package distrib}
1593 @deffn {Function} skewness_f (@var{m},@var{n})
1594 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")}.
1596 @opencatbox{Categories:}
1597 @category{Package distrib}
1604 @deffn {Function} kurtosis_f (@var{m},@var{n})
1605 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")}.
1607 @opencatbox{Categories:}
1608 @category{Package distrib}
1615 @deffn {Function} random_f (@var{m},@var{n}) @
1616 @fname{random_f} (@var{m},@var{n},@var{k})
1618 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.
1620 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(n) random variable, then
1622 <<<F={{n X}\over{m Y}}>>>,
1630 is a F random variable with @var{m} and @var{n} degrees of freedom, @math{F(m,n)}.
1632 To make use of this function, write first @code{load("distrib")}.
1634 @opencatbox{Categories:}
1635 @category{Package distrib}
1636 @category{Random numbers}
1642 @node Exponential Random Variable, Lognormal Random Variable, F Random Variable, Normal Random Variable
1643 @subsection Exponential Random Variable
1644 @node Introduction to Exponential Random Variable
1645 @subsubsection Introduction to Exponential Random Variable
1646 The @emph{exponential distribution} is the probablity distribution of
1647 the time between events in a process where the events occur
1648 continuously and independently at a constant average rate.
1650 @node Functions and Variables for Exponential Random Variable
1651 @subsubsection Functions and Variables for Exponential Random Variable
1653 @deffn {Function} pdf_exp (@var{x},@var{m})
1654 Returns the value at @var{x} of the density function of an m4_exponentialRV(m) random variable, with @math{m>0}.
1656 The m4_exponentialRV(m) random variable is equivalent to the m4_weibullRV(1,1/m).
1660 <<<{\rm pdf\_exp}(x,m) =
1662 me^{-mx} & $x \ge 0$ \cr
1668 @c load ("distrib")$
1672 (%i1) load ("distrib")$
1678 @opencatbox{Categories:}
1679 @category{Package distrib}
1686 @deffn {Function} cdf_exp (@var{x},@var{m})
1687 Returns the value at @var{x} of the distribution function of an m4_exponentialRV(m) random variable, with @math{m>0}.
1689 The m4_exponentialRV(m) random variable is equivalent to the m4_weibullRV(1,1/m).
1693 <<<{\rm cdf\_exp}(x,m) =
1695 1 - e^{-mx} & $x \ge 0$ \cr
1700 @c load ("distrib")$
1704 (%i1) load ("distrib")$
1710 @opencatbox{Categories:}
1711 @category{Package distrib}
1717 @anchor{quantile_exp}
1718 @deffn {Function} quantile_exp (@var{q},@var{m})
1719 Returns the @var{q}-quantile of an m4_exponentialRV(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]}.
1721 The m4_exponentialRV(m) random variable is equivalent to the m4_weibullRV(1,1/m).
1724 @c load ("distrib")$
1725 @c quantile_exp(0.56,5);
1726 @c quantile_exp(0.56,m);
1729 (%i1) load ("distrib")$
1730 (%i2) quantile_exp(0.56,5);
1731 (%o2) .1641961104139661
1732 (%i3) quantile_exp(0.56,m);
1734 (%o3) ------------------
1738 @opencatbox{Categories:}
1739 @category{Package distrib}
1746 @deffn {Function} mean_exp (@var{m})
1747 Returns the mean of an m4_exponentialRV(m) random variable, with @math{m>0}.
1749 The m4_exponentialRV(m) random variable is equivalent to the m4_weibullRV(1,1/m).
1752 @c load ("distrib")$
1756 (%i1) load ("distrib")$
1763 @opencatbox{Categories:}
1764 @category{Package distrib}
1771 @deffn {Function} var_exp (@var{m})
1772 Returns the variance of an m4_exponentialRV(m) random variable, with @math{m>0}.
1774 The m4_exponentialRV(m) random variable is equivalent to the m4_weibullRV(1,1/m).
1777 @c load ("distrib")$
1781 (%i1) load ("distrib")$
1789 @opencatbox{Categories:}
1790 @category{Package distrib}
1797 @deffn {Function} std_exp (@var{m})
1798 Returns the standard deviation of an m4_exponentialRV(m) random variable, with @math{m>0}.
1800 The m4_exponentialRV(m) random variable is equivalent to the m4_weibullRV(1,1/m).
1803 @c load ("distrib")$
1807 (%i1) load ("distrib")$
1814 @opencatbox{Categories:}
1815 @category{Package distrib}
1821 @anchor{skewness_exp}
1822 @deffn {Function} skewness_exp (@var{m})
1823 Returns the skewness coefficient of an m4_exponentialRV(m) random variable, with @math{m>0}.
1825 The m4_exponentialRV(m) random variable is equivalent to the m4_weibullRV(1,1/m).
1828 @c load ("distrib")$
1832 (%i1) load ("distrib")$
1833 (%i2) skewness_exp(m);
1837 @opencatbox{Categories:}
1838 @category{Package distrib}
1844 @anchor{kurtosis_exp}
1845 @deffn {Function} kurtosis_exp (@var{m})
1846 Returns the kurtosis coefficient of an m4_exponentialRV(m) random variable, with @math{m>0}.
1848 The m4_exponentialRV(m) random variable is equivalent to the m4_weibullRV(1,1/m).
1851 @c load ("distrib")$
1855 (%i1) load ("distrib")$
1856 (%i2) kurtosis_exp(m);
1860 @opencatbox{Categories:}
1861 @category{Package distrib}
1868 @deffn {Function} random_exp (@var{m}) @
1869 @fname{random_exp} (@var{m},@var{k})
1871 Returns an m4_exponentialRV(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.
1873 The simulation algorithm is based on the general inverse method.
1875 To make use of this function, write first @code{load("distrib")}.
1877 @opencatbox{Categories:}
1878 @category{Package distrib}
1879 @category{Random numbers}
1885 @node Lognormal Random Variable, Gamma Random Variable, Exponential Random Variable, Normal Random Variable
1886 @subsection Lognormal Random Variable
1887 @node Introduction to Lognormal Random Variable
1888 @subsubsection Introduction to Lognormal Random Variable
1889 The @emph{lognormal} distribution is distribution for a random
1890 variable whose logarithm is normally distributed.
1892 @node Functions and Variables for Lognormal Random Variable
1893 @subsubsection Functions and Variables for Lognormal Random Variable
1894 @anchor{pdf_lognormal}
1895 @deffn {Function} pdf_lognormal (@var{x},@var{m},@var{s})
1896 Returns the value at @var{x} of the density function of a m4_lognormalRV(m,s) random variable, with @math{s>0}. To make use of this function, write first @code{load("distrib")}.
1898 The pdf is 0 for @math{x < 0}. Otherwise it is
1900 <<<{1\over x s \sqrt{2\pi}}
1901 \exp\left(-{\left(\log x - m\right)^2\over 2s^2}\right)>>>,
1903 @opencatbox{Categories:}
1904 @category{Package distrib}
1910 @anchor{cdf_lognormal}
1911 @deffn {Function} cdf_lognormal (@var{x},@var{m},@var{s})
1912 Returns the value at @var{x} of the distribution function of a m4_lognormalRV(m,s) random variable, with @math{s>0}. This function is defined in terms of Maxima's built-in error function @code{erf}.
1915 @c load ("distrib")$
1916 @c cdf_lognormal(x,m,s);
1919 (%i1) load ("distrib")$
1920 (%i2) cdf_lognormal(x,m,s);
1925 (%o2) --------------- + -
1930 See also @mrefdot{erf}
1932 @opencatbox{Categories:}
1933 @category{Package distrib}
1939 @anchor{quantile_lognormal}
1940 @deffn {Function} quantile_lognormal (@var{q},@var{m},@var{s})
1941 Returns the @var{q}-quantile of a m4_lognormalRV(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")}.
1944 @c load ("distrib")$
1945 @c quantile_lognormal(95/100,0,1);
1949 (%i1) load ("distrib")$
1950 (%i2) quantile_lognormal(95/100,0,1);
1951 sqrt(2) inverse_erf(9/10)
1954 (%o3) 5.180251602233015
1957 @opencatbox{Categories:}
1958 @category{Package distrib}
1964 @anchor{mean_lognormal}
1965 @deffn {Function} mean_lognormal (@var{m},@var{s})
1966 Returns the mean of a m4_lognormalRV(m,s) random variable, with @math{s>0}. To make use of this function, write first @code{load("distrib")}.
1968 @opencatbox{Categories:}
1969 @category{Package distrib}
1975 @anchor{var_lognormal}
1976 @deffn {Function} var_lognormal (@var{m},@var{s})
1977 Returns the variance of a m4_lognormalRV(m,s) random variable, with @math{s>0}. To make use of this function, write first @code{load("distrib")}.
1979 @opencatbox{Categories:}
1980 @category{Package distrib}
1985 @anchor{std_lognormal}
1986 @deffn {Function} std_lognormal (@var{m},@var{s})
1987 Returns the standard deviation of a m4_lognormalRV(m,s) random variable, with @math{s>0}. To make use of this function, write first @code{load("distrib")}.
1989 @opencatbox{Categories:}
1990 @category{Package distrib}
1996 @anchor{skewness_lognormal}
1997 @deffn {Function} skewness_lognormal (@var{m},@var{s})
1998 Returns the skewness coefficient of a m4_lognormalRV(m,s) random variable, with @math{s>0}. To make use of this function, write first @code{load("distrib")}.
2000 @opencatbox{Categories:}
2001 @category{Package distrib}
2007 @anchor{kurtosis_lognormal}
2008 @deffn {Function} kurtosis_lognormal (@var{m},@var{s})
2009 Returns the kurtosis coefficient of a m4_lognormalRV(m,s) random variable, with @math{s>0}. To make use of this function, write first @code{load("distrib")}.
2011 @opencatbox{Categories:}
2012 @category{Package distrib}
2018 @anchor{random_lognormal}
2019 @deffn {Function} random_lognormal (@var{m},@var{s}) @
2020 @fname{random_lognormal} (@var{m},@var{s},@var{n})
2022 Returns a m4_lognormalRV(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.
2024 Log-normal variates are simulated by means of random normal variates. See @code{random_normal} for details.
2026 To make use of this function, write first @code{load("distrib")}.
2028 @opencatbox{Categories:}
2029 @category{Package distrib}
2030 @category{Random numbers}
2036 @node Gamma Random Variable, Beta Random Variable, Lognormal Random Variable, Normal Random Variable
2037 @subsection Gamma Random Variable
2038 @node Introduction to Gamma Random Variable
2039 @subsubsection Introduction to Gamma Random Variable
2040 The @emph{gamma distribution} is a two-parameter family of probability
2041 distributions. Maxima uses the parameterization using the shape and
2042 scale for the first and second parameters of the distribution.
2044 @node Functions and Variables for Gamma Random Variable
2045 @subsubsection Functions and Variables for Gamma Random Variable
2047 @deffn {Function} pdf_gamma (@var{x},@var{a},@var{b})
2048 Returns the value at @var{x} of the density function of a m4_GammaRV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2050 The shape parameter is @math{a}, and the scale parameter is @math{b}.
2052 The pdf is 0 for @math{x<0} and for m4_math(x \ge 0, @math{x >= 0})
2054 <<<{x^{a-1}e^{-x/b}\over b^a \Gamma(a)}>>>,
2055 <<<@math{x^(a-1)*exp(-x/b)/(b^a*gamma(a))>>>)
2057 @opencatbox{Categories:}
2058 @category{Package distrib}
2065 @deffn {Function} cdf_gamma (@var{x},@var{a},@var{b})
2066 Returns the value at @var{x} of the distribution function of a m4_GammaRV(a,b) random variable, with @math{a,b>0}.
2068 The cdf is 0 for @math{x < 0}. Otherwise it is
2070 <<<1-Q(a,{x\over b})>>>,
2071 <<<@math{1-gamma_incomplete_regularized(a,x/b)}>>>)
2073 where @math{Q(a,z)} is the @ref{gamma_incomplete_regularized}
2077 @c load ("distrib")$
2078 @c cdf_gamma(3,5,21);
2082 (%i1) load ("distrib")$
2083 (%i2) cdf_gamma(3,5,21);
2085 (%o2) 1 - gamma_incomplete_regularized(5, -)
2088 (%o3) 4.402663157376807E-7
2091 @opencatbox{Categories:}
2092 @category{Package distrib}
2098 @anchor{quantile_gamma}
2099 @deffn {Function} quantile_gamma (@var{q},@var{a},@var{b})
2100 Returns the @var{q}-quantile of a m4_GammaRV(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")}.
2102 @opencatbox{Categories:}
2103 @category{Package distrib}
2110 @deffn {Function} mean_gamma (@var{a},@var{b})
2111 Returns the mean of a m4_GammaRV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2113 @opencatbox{Categories:}
2114 @category{Package distrib}
2121 @deffn {Function} var_gamma (@var{a},@var{b})
2122 Returns the variance of a m4_GammaRV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2124 @opencatbox{Categories:}
2125 @category{Package distrib}
2131 @deffn {Function} std_gamma (@var{a},@var{b})
2132 Returns the standard deviation of a m4_GammaRV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2134 @opencatbox{Categories:}
2135 @category{Package distrib}
2141 @anchor{skewness_gamma}
2142 @deffn {Function} skewness_gamma (@var{a},@var{b})
2143 Returns the skewness coefficient of a m4_GammaRV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2145 @opencatbox{Categories:}
2146 @category{Package distrib}
2152 @anchor{kurtosis_gamma}
2153 @deffn {Function} kurtosis_gamma (@var{a},@var{b})
2154 Returns the kurtosis coefficient of a m4_GammaRV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2156 @opencatbox{Categories:}
2157 @category{Package distrib}
2163 @anchor{random_gamma}
2164 @deffn {Function} random_gamma (@var{a},@var{b}) @
2165 @fname{random_gamma} (@var{a},@var{b},@var{n})
2167 Returns a m4_GammaRV(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.
2169 The implemented algorithm is a combination of two procedures, depending on the value of parameter @var{a}:
2171 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.
2173 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.
2175 To make use of this function, write first @code{load("distrib")}.
2177 @opencatbox{Categories:}
2178 @category{Package distrib}
2179 @category{Random numbers}
2185 @node Beta Random Variable, Continuous Uniform Random Variable, Gamma Random Variable, Normal Random Variable
2186 @subsection Beta Random Variable
2187 @node Introduction to Beta Random Variable
2188 @subsubsection Introduction to Beta Random Variable
2189 The @emph{beta} distribution is a family of distributions defined over
2190 @math{[0,1]} parameterized by two positive shape parameters @math{a},
2193 @node Functions and Variables for Beta Random Variable
2194 @subsubsection Functions and Variables for Beta Random Variable
2196 @deffn {Function} pdf_beta (@var{x},@var{a},@var{b})
2197 Returns the value at @var{x} of the density function of a m4_betaRV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2199 For m4_math(<<<0 \le x \le 1>>>, <<<@math{0 <= x <= 1}>>>), the pdf is
2201 <<<{1\over B(a,b)}x^{a-1}(1-x)^{b-1}>>>,
2202 <<<@math{x^(a-1)*(1-x)^(b-1)/beta(a,b)}>>>)
2203 Otherwise, the pdf is 0.
2205 @opencatbox{Categories:}
2206 @category{Package distrib}
2214 @deffn {Function} cdf_beta (@var{x},@var{a},@var{b})
2215 Returns the value at @var{x} of the distribution function of a m4_betaRV(a,b) random variable, with @math{a,b>0}.
2219 <<<{\rm cdf\_beta}(x,a,b) =
2222 I_x(a,b) & $0 \le x \le 1$ \cr
2227 @c load ("distrib")$
2228 @c cdf_beta(1/3,15,2);
2232 (%i1) load ("distrib")$
2233 (%i2) cdf_beta(1/3,15,2);
2238 (%o3) 7.666089131388195E-7
2241 @opencatbox{Categories:}
2242 @category{Package distrib}
2248 @anchor{quantile_beta}
2249 @deffn {Function} quantile_beta (@var{q},@var{a},@var{b})
2250 Returns the @var{q}-quantile of a m4_betaRV(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")}.
2252 @opencatbox{Categories:}
2253 @category{Package distrib}
2260 @deffn {Function} mean_beta (@var{a},@var{b})
2261 Returns the mean of a m4_betaRV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2263 @opencatbox{Categories:}
2264 @category{Package distrib}
2271 @deffn {Function} var_beta (@var{a},@var{b})
2272 Returns the variance of a m4_betaRV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2274 @opencatbox{Categories:}
2275 @category{Package distrib}
2281 @deffn {Function} std_beta (@var{a},@var{b})
2282 Returns the standard deviation of a m4_betaRV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2284 @opencatbox{Categories:}
2285 @category{Package distrib}
2291 @anchor{skewness_beta}
2292 @deffn {Function} skewness_beta (@var{a},@var{b})
2293 Returns the skewness coefficient of a m4_betaRV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2295 @opencatbox{Categories:}
2296 @category{Package distrib}
2302 @anchor{kurtosis_beta}
2303 @deffn {Function} kurtosis_beta (@var{a},@var{b})
2304 Returns the kurtosis coefficient of a m4_betaRV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2306 @opencatbox{Categories:}
2307 @category{Package distrib}
2313 @anchor{random_beta}
2314 @deffn {Function} random_beta (@var{a},@var{b}) @
2315 @fname{random_beta} (@var{a},@var{b},@var{n})
2317 Returns a m4_betaRV(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.
2319 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
2321 To make use of this function, write first @code{load("distrib")}.
2323 @opencatbox{Categories:}
2324 @category{Package distrib}
2325 @category{Random numbers}
2330 @node Continuous Uniform Random Variable, Logistic Random Variable, Beta Random Variable, Normal Random Variable
2331 @subsection Continuous Uniform Random Variable
2332 @node Introduction to Continuous Uniform Random Variable
2333 @subsubsection Introduction to Continuous Uniform Random Variable
2334 The @emph{continuous uniform} distribution is constant over the
2335 interval @math{[a,b]} and is zero elsewhere.
2336 @node Functions and Variables for Continuous Uniform Random Variable
2337 @subsubsection Functions and Variables for Continuous Uniform Random Variable
2338 @anchor{pdf_continuous_uniform}
2339 @deffn {Function} pdf_continuous_uniform (@var{x},@var{a},@var{b})
2340 Returns the value at @var{x} of the density function of a m4_continuous_uniformRV(a,b) random variable, with @math{a<b}. To make use of this function, write first @code{load("distrib")}.
2342 The pdf for m4_math(<<<x \in [0,1]>>>, <<<@math{x in [0,1]}>>>) is
2345 <<<@math{1/(b-a)}>>>)
2348 @opencatbox{Categories:}
2349 @category{Package distrib}
2355 @anchor{cdf_continuous_uniform}
2356 @deffn {Function} cdf_continuous_uniform (@var{x},@var{a},@var{b})
2357 Returns the value at @var{x} of the distribution function of a m4_continuous_uniformRV(a,b) random variable, with @math{a<b}. To make use of this function, write first @code{load("distrib")}.
2361 <<<{\rm cdf\_continuous\_uniform}(x,a,b) =
2365 \displaystyle{x-a\over b-a} & for $a \le x \le b$ \cr
2370 @opencatbox{Categories:}
2371 @category{Package distrib}
2377 @anchor{quantile_continuous_uniform}
2378 @deffn {Function} quantile_continuous_uniform (@var{q},@var{a},@var{b})
2379 Returns the @var{q}-quantile of a m4_continuous_uniformRV(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")}.
2381 @opencatbox{Categories:}
2382 @category{Package distrib}
2388 @anchor{mean_continuous_uniform}
2389 @deffn {Function} mean_continuous_uniform (@var{a},@var{b})
2390 Returns the mean of a m4_continuous_uniformRV(a,b) random variable, with @math{a<b}. To make use of this function, write first @code{load("distrib")}.
2392 @opencatbox{Categories:}
2393 @category{Package distrib}
2399 @anchor{var_continuous_uniform}
2400 @deffn {Function} var_continuous_uniform (@var{a},@var{b})
2401 Returns the variance of a m4_continuous_uniformRV(a,b) random variable, with @math{a<b}. To make use of this function, write first @code{load("distrib")}.
2403 @opencatbox{Categories:}
2404 @category{Package distrib}
2409 @anchor{std_continuous_uniform}
2410 @deffn {Function} std_continuous_uniform (@var{a},@var{b})
2411 Returns the standard deviation of a m4_continuous_uniformRV(a,b) random variable, with @math{a<b}. To make use of this function, write first @code{load("distrib")}.
2413 @opencatbox{Categories:}
2414 @category{Package distrib}
2420 @anchor{skewness_continuous_uniform}
2421 @deffn {Function} skewness_continuous_uniform (@var{a},@var{b})
2422 Returns the skewness coefficient of a m4_continuous_uniformRV(a,b) random variable, with @math{a<b}. To make use of this function, write first @code{load("distrib")}.
2424 @opencatbox{Categories:}
2425 @category{Package distrib}
2431 @anchor{kurtosis_continuous_uniform}
2432 @deffn {Function} kurtosis_continuous_uniform (@var{a},@var{b})
2433 Returns the kurtosis coefficient of a m4_continuous_uniformRV(a,b) random variable, with @math{a<b}. To make use of this function, write first @code{load("distrib")}.
2435 @opencatbox{Categories:}
2436 @category{Package distrib}
2442 @anchor{random_continuous_uniform}
2443 @deffn {Function} random_continuous_uniform (@var{a},@var{b}) @
2444 @fname{random_continuous_uniform} (@var{a},@var{b},@var{n})
2446 Returns a m4_continuous_uniformRV(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.
2448 This is a direct application of the @code{random} built-in Maxima function.
2450 See also @mrefdot{random} To make use of this function, write first @code{load("distrib")}.
2452 @opencatbox{Categories:}
2453 @category{Package distrib}
2454 @category{Random numbers}
2460 @node Logistic Random Variable, Pareto Random Variable, Continuous Uniform Random Variable, Normal Random Variable
2461 @subsection Logistic Random Variable
2462 @node Introduction to Logistic Random Variable
2463 @subsubsection Introduction to Logistic Random Variable
2464 The @emph{logistic} distribution is a continuous distribution where
2465 it's cumulative distribution function is the logistic function.
2467 @node Functions and Variables for Logistic Random Variable
2468 @subsubsection Functions and Variables for Logistic Random Variable
2469 @anchor{pdf_logistic}
2470 @deffn {Function} pdf_logistic (@var{x},@var{a},@var{b})
2471 Returns the value at @var{x} of the density function of a m4_logisticRV(a,b) random variable , with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
2473 @math{a} is the location parameter and @math{b} is the scale
2478 <<<{e^{-(x-a)/b} \over b\left(1 + e^{-(x-a)/b}\right)^2}>>>,
2479 <<<@math{exp(-(x-a)/b)/(b*(1+exp(-(x-a)/b))^2)}>>>)
2480 @opencatbox{Categories:}
2481 @category{Package distrib}
2487 @anchor{cdf_logistic}
2488 @deffn {Function} cdf_logistic (@var{x},@var{a},@var{b})
2489 Returns the value at @var{x} of the distribution function of a m4_logisticRV(a,b) random variable , with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
2493 <<<1\over 1+e^{-(x-a)/b}>>>,
2494 <<<@math{1/(1+exp(-(x-a)/b))}>>>)
2496 @opencatbox{Categories:}
2497 @category{Package distrib}
2503 @anchor{quantile_logistic}
2504 @deffn {Function} quantile_logistic (@var{q},@var{a},@var{b})
2505 Returns the @var{q}-quantile of a m4_logisticRV(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")}.
2507 @opencatbox{Categories:}
2508 @category{Package distrib}
2514 @anchor{mean_logistic}
2515 @deffn {Function} mean_logistic (@var{a},@var{b})
2516 Returns the mean of a m4_logisticRV(a,b) random variable , with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
2518 @opencatbox{Categories:}
2519 @category{Package distrib}
2525 @anchor{var_logistic}
2526 @deffn {Function} var_logistic (@var{a},@var{b})
2527 Returns the variance of a m4_logisticRV(a,b) random variable , with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
2529 @opencatbox{Categories:}
2530 @category{Package distrib}
2536 @anchor{std_logistic}
2537 @deffn {Function} std_logistic (@var{a},@var{b})
2538 Returns the standard deviation of a m4_logisticRV(a,b) random variable , with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
2540 @opencatbox{Categories:}
2541 @category{Package distrib}
2547 @anchor{skewness_logistic}
2548 @deffn {Function} skewness_logistic (@var{a},@var{b})
2549 Returns the skewness coefficient of a m4_logisticRV(a,b) random variable , with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
2551 @opencatbox{Categories:}
2552 @category{Package distrib}
2558 @anchor{kurtosis_logistic}
2559 @deffn {Function} kurtosis_logistic (@var{a},@var{b})
2560 Returns the kurtosis coefficient of a m4_logisticRV(a,b) random variable , with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
2562 @opencatbox{Categories:}
2563 @category{Package distrib}
2569 @anchor{random_logistic}
2570 @deffn {Function} random_logistic (@var{a},@var{b}) @
2571 @fname{random_logistic} (@var{a},@var{b},@var{n})
2573 Returns a m4_logisticRV(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.
2575 The implemented algorithm is based on the general inverse method.
2577 To make use of this function, write first @code{load("distrib")}.
2579 @opencatbox{Categories:}
2580 @category{Package distrib}
2581 @category{Random numbers}
2587 @node Pareto Random Variable, Weibull Random Variable, Logistic Random Variable, Normal Random Variable
2588 @subsection Pareto Random Variable
2589 @node Introduction to Pareto Random Variable
2590 @subsubsection Introduction to Pareto Random Variable
2591 @node Functions and Variables for Pareto Random Variable
2592 @subsubsection Functions and Variables for Pareto Random Variable
2594 @deffn {Function} pdf_pareto (@var{x},@var{a},@var{b})
2595 Returns the value at @var{x} of the density function of a m4_paretoRV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2599 <<<{\rm pdf\_pareto}(x,a,b) =
2601 \displaystyle{a b^a \over x^{a+1}} & for $x \ge b$ \cr
2607 @opencatbox{Categories:}
2608 @category{Package distrib}
2615 @deffn {Function} cdf_pareto (@var{x},@var{a},@var{b})
2616 Returns the value at @var{x} of the distribution function of a m4_paretoRV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2620 <<<{\rm cdf\_pareto}(x,a,b) =
2622 1-\left(\displaystyle{b\over x}\right)^a & for $x \ge b$\cr
2626 @opencatbox{Categories:}
2627 @category{Package distrib}
2633 @anchor{quantile_pareto}
2634 @deffn {Function} quantile_pareto (@var{q},@var{a},@var{b})
2635 Returns the @var{q}-quantile of a m4_paretoRV(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")}.
2637 @opencatbox{Categories:}
2638 @category{Package distrib}
2644 @anchor{mean_pareto}
2645 @deffn {Function} mean_pareto (@var{a},@var{b})
2646 Returns the mean of a m4_paretoRV(a,b) random variable, with @math{a>1,b>0}. To make use of this function, write first @code{load("distrib")}.
2648 @opencatbox{Categories:}
2649 @category{Package distrib}
2656 @deffn {Function} var_pareto (@var{a},@var{b})
2657 Returns the variance of a m4_paretoRV(a,b) random variable, with @math{a>2,b>0}. To make use of this function, write first @code{load("distrib")}.
2659 @opencatbox{Categories:}
2660 @category{Package distrib}
2666 @deffn {Function} std_pareto (@var{a},@var{b})
2667 Returns the standard deviation of a m4_paretoRV(a,b) random variable, with @math{a>2,b>0}. To make use of this function, write first @code{load("distrib")}.
2669 @opencatbox{Categories:}
2670 @category{Package distrib}
2677 @anchor{skewness_pareto}
2678 @deffn {Function} skewness_pareto (@var{a},@var{b})
2679 Returns the skewness coefficient of a m4_paretoRV(a,b) random variable, with @math{a>3,b>0}. To make use of this function, write first @code{load("distrib")}.
2681 @opencatbox{Categories:}
2682 @category{Package distrib}
2688 @anchor{kurtosis_pareto}
2689 @deffn {Function} kurtosis_pareto (@var{a},@var{b})
2690 Returns the kurtosis coefficient of a m4_paretoRV(a,b) random variable, with @math{a>4,b>0}. To make use of this function, write first @code{load("distrib")}.
2692 @opencatbox{Categories:}
2693 @category{Package distrib}
2699 @anchor{random_pareto}
2700 @deffn {Function} random_pareto (@var{a},@var{b}) @
2701 @fname{random_pareto} (@var{a},@var{b},@var{n})
2703 Returns a m4_paretoRV(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.
2705 The implemented algorithm is based on the general inverse method.
2707 To make use of this function, write first @code{load("distrib")}.
2709 @opencatbox{Categories:}
2710 @category{Package distrib}
2711 @category{Random numbers}
2717 @node Weibull Random Variable, Rayleigh Random Variable, Pareto Random Variable, Normal Random Variable
2718 @subsection Weibull Random Variable
2719 @node Introduction to Weibull Random Variable
2720 @subsubsection Introduction to Weibull Random Variable
2721 @node Functions and Variables for Weibull Random Variable
2722 @subsubsection Functions and Variables for Weibull Random Variable
2723 @anchor{pdf_weibull}
2724 @deffn {Function} pdf_weibull (@var{x},@var{a},@var{b})
2725 Returns the value at @var{x} of the density function of a m4_weibullRV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2729 <<<{\rm pdf\_weibull}(x,a,b) =
2731 \displaystyle{1\over b} \left({x\over b}\right)^{a-1} e^{-(x/b)^a} &
2737 @opencatbox{Categories:}
2738 @category{Package distrib}
2744 @anchor{cdf_weibull}
2745 @deffn {Function} cdf_weibull (@var{x},@var{a},@var{b})
2746 Returns the value at @var{x} of the distribution function of a m4_weibullRV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2750 <<<{\rm cdf\_weibull}(x,a,b) =
2752 1 - e^{-(x/b)^a} & for $x \ge 0$ \cr
2756 @opencatbox{Categories:}
2757 @category{Package distrib}
2763 @anchor{quantile_weibull}
2764 @deffn {Function} quantile_weibull (@var{q},@var{a},@var{b})
2765 Returns the @var{q}-quantile of a m4_weibullRV(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")}.
2767 @opencatbox{Categories:}
2768 @category{Package distrib}
2774 @anchor{mean_weibull}
2775 @deffn {Function} mean_weibull (@var{a},@var{b})
2776 Returns the mean of a m4_weibullRV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2778 @opencatbox{Categories:}
2779 @category{Package distrib}
2785 @anchor{var_weibull}
2786 @deffn {Function} var_weibull (@var{a},@var{b})
2787 Returns the variance of a m4_weibullRV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2789 @opencatbox{Categories:}
2790 @category{Package distrib}
2795 @anchor{std_weibull}
2796 @deffn {Function} std_weibull (@var{a},@var{b})
2797 Returns the standard deviation of a m4_weibullRV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2799 @opencatbox{Categories:}
2800 @category{Package distrib}
2807 @anchor{skewness_weibull}
2808 @deffn {Function} skewness_weibull (@var{a},@var{b})
2809 Returns the skewness coefficient of a m4_weibullRV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2811 @opencatbox{Categories:}
2812 @category{Package distrib}
2818 @anchor{kurtosis_weibull}
2819 @deffn {Function} kurtosis_weibull (@var{a},@var{b})
2820 Returns the kurtosis coefficient of a m4_weibullRV(a,b) random variable, with @math{a,b>0}. To make use of this function, write first @code{load("distrib")}.
2822 @opencatbox{Categories:}
2823 @category{Package distrib}
2829 @anchor{random_weibull}
2830 @deffn {Function} random_weibull (@var{a},@var{b}) @
2831 @fname{random_weibull} (@var{a},@var{b},@var{n})
2833 Returns a m4_weibullRV(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.
2835 The implemented algorithm is based on the general inverse method.
2837 To make use of this function, write first @code{load("distrib")}.
2839 @opencatbox{Categories:}
2840 @category{Package distrib}
2841 @category{Random numbers}
2848 @node Rayleigh Random Variable, Laplace Random Variable, Weibull Random Variable, Normal Random Variable
2849 @subsection Rayleigh Random Variable
2850 @node Introduction to Rayleigh Random Variable
2851 @subsubsection Introduction to Rayleigh Random Variable
2852 The @emph{Rayleigh} distribution coincides with the m4_math(\chi^2,
2853 chi-squared) distribution with two degrees of freedom.
2855 @node Functions and Variables for Rayleigh Random Variable
2856 @subsubsection Functions and Variables for Rayleigh Random Variable
2857 @anchor{pdf_rayleigh}
2858 @deffn {Function} pdf_rayleigh (@var{x},@var{b})
2859 Returns the value at @var{x} of the density function of a m4_rayleighRV(b) random variable, with @math{b>0}.
2861 The m4_rayleighRV(b) random variable is equivalent to the m4_weibullRV(2,1/b).
2865 <<<{\rm pdf\_rayleigh}(x,b) =
2867 2b^2 x e^{-b^2 x^2} & for $x \ge 0$ \cr
2872 @c load ("distrib")$
2873 @c pdf_rayleigh(x,b);
2876 (%i1) load ("distrib")$
2877 (%i2) pdf_rayleigh(x,b);
2883 @opencatbox{Categories:}
2884 @category{Package distrib}
2890 @anchor{cdf_rayleigh}
2891 @deffn {Function} cdf_rayleigh (@var{x},@var{b})
2892 Returns the value at @var{x} of the distribution function of a m4_rayleighRV(b) random variable, with @math{b>0}.
2894 The m4_rayleighRV(b) random variable is equivalent to the m4_weibullRV(2,1/b).
2898 <<<{\rm cdf\_rayleigh}(x,b) =
2900 1 - e^{-b^2 x^2} & for $x \ge 0$\cr
2905 @c load ("distrib")$
2906 @c cdf_rayleigh(x,b);
2909 (%i1) load ("distrib")$
2910 (%i2) cdf_rayleigh(x,b);
2916 @opencatbox{Categories:}
2917 @category{Package distrib}
2923 @anchor{quantile_rayleigh}
2924 @deffn {Function} quantile_rayleigh (@var{q},@var{b})
2925 Returns the @var{q}-quantile of a m4_rayleighRV(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]}.
2927 The m4_rayleighRV(b) random variable is equivalent to the m4_weibullRV(2,1/b).
2930 @c load ("distrib")$
2931 @c quantile_rayleigh(0.99,b);
2934 (%i1) load ("distrib")$
2935 (%i2) quantile_rayleigh(0.99,b);
2937 (%o2) -----------------
2941 @opencatbox{Categories:}
2942 @category{Package distrib}
2948 @anchor{mean_rayleigh}
2949 @deffn {Function} mean_rayleigh (@var{b})
2950 Returns the mean of a m4_rayleighRV(b) random variable, with @math{b>0}.
2952 The m4_rayleighRV(b) random variable is equivalent to the m4_weibullRV(2,1/b).
2955 @c load ("distrib")$
2956 @c mean_rayleigh(b);
2959 (%i1) load ("distrib")$
2960 (%i2) mean_rayleigh(b);
2966 @opencatbox{Categories:}
2967 @category{Package distrib}
2973 @anchor{var_rayleigh}
2974 @deffn {Function} var_rayleigh (@var{b})
2975 Returns the variance of a m4_rayleighRV(b) random variable, with @math{b>0}.
2977 The m4_rayleighRV(b) random variable is equivalent to the m4_weibullRV(2,1/b).
2980 @c load ("distrib")$
2984 (%i1) load ("distrib")$
2985 (%i2) var_rayleigh(b);
2994 @opencatbox{Categories:}
2995 @category{Package distrib}
3001 @anchor{std_rayleigh}
3002 @deffn {Function} std_rayleigh (@var{b})
3003 Returns the standard deviation of a m4_rayleighRV(b) random variable, with @math{b>0}.
3005 The m4_rayleighRV(b) random variable is equivalent to the m4_weibullRV(2,1/b).
3008 @c load ("distrib")$
3012 (%i1) load ("distrib")$
3013 (%i2) std_rayleigh(b);
3021 @opencatbox{Categories:}
3022 @category{Package distrib}
3028 @anchor{skewness_rayleigh}
3029 @deffn {Function} skewness_rayleigh (@var{b})
3030 Returns the skewness coefficient of a m4_rayleighRV(b) random variable, with @math{b>0}.
3032 The m4_rayleighRV(b) random variable is equivalent to the m4_weibullRV(2,1/b).
3035 @c load ("distrib")$
3036 @c skewness_rayleigh(b);
3039 (%i1) load ("distrib")$
3040 (%i2) skewness_rayleigh(b);
3043 ------ - -----------
3045 (%o2) --------------------
3051 @opencatbox{Categories:}
3052 @category{Package distrib}
3058 @anchor{kurtosis_rayleigh}
3059 @deffn {Function} kurtosis_rayleigh (@var{b})
3060 Returns the kurtosis coefficient of a m4_rayleighRV(b) random variable, with @math{b>0}.
3062 The m4_rayleighRV(b) random variable is equivalent to the m4_weibullRV(2,1/b).
3065 @c load ("distrib")$
3066 @c kurtosis_rayleigh(b);
3069 (%i1) load ("distrib")$
3070 (%i2) kurtosis_rayleigh(b);
3075 (%o2) ---------- - 3
3081 @opencatbox{Categories:}
3082 @category{Package distrib}
3088 @anchor{random_rayleigh}
3089 @deffn {Function} random_rayleigh (@var{b}) @
3090 @fname{random_rayleigh} (@var{b},@var{n})
3092 Returns a m4_rayleighRV(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.
3094 The implemented algorithm is based on the general inverse method.
3096 To make use of this function, write first @code{load("distrib")}.
3098 @opencatbox{Categories:}
3099 @category{Package distrib}
3100 @category{Random numbers}
3107 @node Laplace Random Variable, Cauchy Random Variable, Rayleigh Random Variable, Normal Random Variable
3108 @subsection Laplace Random Variable
3109 @node Introduction to Laplace Random Variable
3110 @subsubsection Introduction to Laplace Random Variable
3111 @node Functions and Variables for Laplace Random Variable
3112 @subsubsection Functions and Variables for Laplace Random Variable
3113 @anchor{pdf_laplace}
3114 @deffn {Function} pdf_laplace (@var{x},@var{a},@var{b})
3115 Returns the value at @var{x} of the density function of a @math{Laplace(a,b)} random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3117 @opencatbox{Categories:}
3118 @category{Package distrib}
3124 @anchor{cdf_laplace}
3125 @deffn {Function} cdf_laplace (@var{x},@var{a},@var{b})
3126 Returns the value at @var{x} of the distribution function of a @math{Laplace(a,b)} random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3128 @opencatbox{Categories:}
3129 @category{Package distrib}
3135 @anchor{quantile_laplace}
3136 @deffn {Function} quantile_laplace (@var{q},@var{a},@var{b})
3137 Returns the @var{q}-quantile of a @math{Laplace(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")}.
3139 @opencatbox{Categories:}
3140 @category{Package distrib}
3146 @anchor{mean_laplace}
3147 @deffn {Function} mean_laplace (@var{a},@var{b})
3148 Returns the mean of a @math{Laplace(a,b)} random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3150 @opencatbox{Categories:}
3151 @category{Package distrib}
3157 @anchor{var_laplace}
3158 @deffn {Function} var_laplace (@var{a},@var{b})
3159 Returns the variance of a @math{Laplace(a,b)} random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3161 @opencatbox{Categories:}
3162 @category{Package distrib}
3168 @anchor{std_laplace}
3169 @deffn {Function} std_laplace (@var{a},@var{b})
3170 Returns the standard deviation of a @math{Laplace(a,b)} random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3172 @opencatbox{Categories:}
3173 @category{Package distrib}
3179 @anchor{skewness_laplace}
3180 @deffn {Function} skewness_laplace (@var{a},@var{b})
3181 Returns the skewness coefficient of a @math{Laplace(a,b)} random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3183 @opencatbox{Categories:}
3184 @category{Package distrib}
3190 @anchor{kurtosis_laplace}
3191 @deffn {Function} kurtosis_laplace (@var{a},@var{b})
3192 Returns the kurtosis coefficient of a @math{Laplace(a,b)} random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3194 @opencatbox{Categories:}
3195 @category{Package distrib}
3201 @anchor{random_laplace}
3202 @deffn {Function} random_laplace (@var{a},@var{b}) @
3203 @fname{random_laplace} (@var{a},@var{b},@var{n})
3205 Returns a @math{Laplace(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.
3207 The implemented algorithm is based on the general inverse method.
3209 To make use of this function, write first @code{load("distrib")}.
3211 @opencatbox{Categories:}
3212 @category{Package distrib}
3213 @category{Random numbers}
3220 @node Cauchy Random Variable, Gumbel Random Variable, Laplace Random Variable, Normal Random Variable
3221 @subsection Cauchy Random Variable
3222 @node Introduction to Cauchy Random Variable
3223 @subsubsection Introduction to Cauchy Random Variable
3224 @node Functions and Variables for Cauchy Random Variable
3225 @subsubsection Functions and Variables for Cauchy Random Variable
3227 @deffn {Function} pdf_cauchy (@var{x},@var{a},@var{b})
3228 Returns the value at @var{x} of the density function of a @math{Cauchy(a,b)} random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3230 @opencatbox{Categories:}
3231 @category{Package distrib}
3238 @deffn {Function} cdf_cauchy (@var{x},@var{a},@var{b})
3239 Returns the value at @var{x} of the distribution function of a @math{Cauchy(a,b)} random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3241 @opencatbox{Categories:}
3242 @category{Package distrib}
3248 @anchor{quantile_cauchy}
3249 @deffn {Function} quantile_cauchy (@var{q},@var{a},@var{b})
3250 Returns the @var{q}-quantile of a @math{Cauchy(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")}.
3252 @opencatbox{Categories:}
3253 @category{Package distrib}
3259 @anchor{random_cauchy}
3260 @deffn {Function} random_cauchy (@var{a},@var{b}) @
3261 @fname{random_cauchy} (@var{a},@var{b},@var{n})
3263 Returns a @math{Cauchy(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.
3265 The implemented algorithm is based on the general inverse method.
3267 To make use of this function, write first @code{load("distrib")}.
3269 @opencatbox{Categories:}
3270 @category{Package distrib}
3271 @category{Random numbers}
3278 @node Gumbel Random Variable, , Cauchy Random Variable, Normal Random Variable
3279 @subsection Gumbel Random Variable
3280 @node Introduction to Gumbel Random Variable
3281 @subsubsection Introduction to Gumbel Random Variable
3282 @node Functions and Variables for Gumbel Random Variable
3283 @subsubsection Functions and Variables for Gumbel Random Variable
3285 @deffn {Function} pdf_gumbel (@var{x},@var{a},@var{b})
3286 Returns the value at @var{x} of the density function of a @math{Gumbel(a,b)} random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3288 @opencatbox{Categories:}
3289 @category{Package distrib}
3296 @deffn {Function} cdf_gumbel (@var{x},@var{a},@var{b})
3297 Returns the value at @var{x} of the distribution function of a @math{Gumbel(a,b)} random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3299 @opencatbox{Categories:}
3300 @category{Package distrib}
3306 @anchor{quantile_gumbel}
3307 @deffn {Function} quantile_gumbel (@var{q},@var{a},@var{b})
3308 Returns the @var{q}-quantile of a @math{Gumbel(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")}.
3310 @opencatbox{Categories:}
3311 @category{Package distrib}
3317 @anchor{mean_gumbel}
3318 @deffn {Function} mean_gumbel (@var{a},@var{b})
3319 Returns the mean of a @math{Gumbel(a,b)} random variable, with @math{b>0}.
3322 @c load ("distrib")$
3323 @c mean_gumbel(a,b);
3326 (%i1) load ("distrib")$
3327 (%i2) mean_gumbel(a,b);
3330 where symbol @code{%gamma} stands for the Euler-Mascheroni constant. See also @mrefdot{%gamma}
3332 @opencatbox{Categories:}
3333 @category{Package distrib}
3340 @deffn {Function} var_gumbel (@var{a},@var{b})
3341 Returns the variance of a @math{Gumbel(a,b)} random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3343 @opencatbox{Categories:}
3344 @category{Package distrib}
3351 @deffn {Function} std_gumbel (@var{a},@var{b})
3352 Returns the standard deviation of a @math{Gumbel(a,b)} random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3354 @opencatbox{Categories:}
3355 @category{Package distrib}
3361 @anchor{skewness_gumbel}
3362 @deffn {Function} skewness_gumbel (@var{a},@var{b})
3363 Returns the skewness coefficient of a @math{Gumbel(a,b)} random variable, with @math{b>0}.
3366 @c load ("distrib")$
3367 @c skewness_gumbel(a,b);
3370 (%i1) load ("distrib")$
3371 (%i2) skewness_gumbel(a,b);
3374 (%o2) --------------
3378 where @code{zeta} stands for the Riemann's zeta function.
3380 @opencatbox{Categories:}
3381 @category{Package distrib}
3387 @anchor{kurtosis_gumbel}
3388 @deffn {Function} kurtosis_gumbel (@var{a},@var{b})
3389 Returns the kurtosis coefficient of a @math{Gumbel(a,b)} random variable, with @math{b>0}. To make use of this function, write first @code{load("distrib")}.
3391 @opencatbox{Categories:}
3392 @category{Package distrib}
3393 @category{Package distrib}
3399 @anchor{random_gumbel}
3400 @deffn {Function} random_gumbel (@var{a},@var{b}) @
3401 @fname{random_gumbel} (@var{a},@var{b},@var{n})
3403 Returns a @math{Gumbel(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.
3405 The implemented algorithm is based on the general inverse method.
3407 To make use of this function, write first @code{load("distrib")}.
3409 @opencatbox{Categories:}
3410 @category{Package distrib}
3411 @category{Random numbers}
3417 @node Functions and Variables for discrete distributions, , Normal Random Variable
3418 @section Functions and Variables for discrete distributions
3421 @anchor{pdf_general_finite_discrete}
3422 @deffn {Function} pdf_general_finite_discrete (@var{x},@var{v})
3423 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")}.
3426 @c load ("distrib")$
3427 @c pdf_general_finite_discrete(2, [1/7, 4/7, 2/7]);
3428 @c pdf_general_finite_discrete(2, [1, 4, 2]);
3431 (%i1) load ("distrib")$
3432 (%i2) pdf_general_finite_discrete(2, [1/7, 4/7, 2/7]);
3436 (%i3) pdf_general_finite_discrete(2, [1, 4, 2]);
3442 @opencatbox{Categories:}
3443 @category{Package distrib}
3449 @anchor{cdf_general_finite_discrete}
3450 @deffn {Function} cdf_general_finite_discrete (@var{x},@var{v})
3451 Returns the value at @var{x} of the distribution function of a general finite discrete random variable, with vector probabilities @math{v}.
3453 See @code{pdf_general_finite_discrete} for more details.
3456 @c load ("distrib")$
3457 @c cdf_general_finite_discrete(2, [1/7, 4/7, 2/7]);
3458 @c cdf_general_finite_discrete(2, [1, 4, 2]);
3459 @c cdf_general_finite_discrete(2+1/2, [1, 4, 2]);
3462 (%i1) load ("distrib")$
3463 (%i2) cdf_general_finite_discrete(2, [1/7, 4/7, 2/7]);
3467 (%i3) cdf_general_finite_discrete(2, [1, 4, 2]);
3471 (%i4) cdf_general_finite_discrete(2+1/2, [1, 4, 2]);
3477 @opencatbox{Categories:}
3478 @category{Package distrib}
3484 @anchor{quantile_general_finite_discrete}
3485 @deffn {Function} quantile_general_finite_discrete (@var{q},@var{v})
3486 Returns the @var{q}-quantile of a general finite discrete random variable, with vector probabilities @math{v}.
3488 See @code{pdf_general_finite_discrete} for more details.
3490 @opencatbox{Categories:}
3491 @category{Package distrib}
3497 @anchor{mean_general_finite_discrete}
3498 @deffn {Function} mean_general_finite_discrete (@var{v})
3499 Returns the mean of a general finite discrete random variable, with vector probabilities @math{v}.
3501 See @code{pdf_general_finite_discrete} for more details.
3503 @opencatbox{Categories:}
3504 @category{Package distrib}
3510 @anchor{var_general_finite_discrete}
3511 @deffn {Function} var_general_finite_discrete (@var{v})
3512 Returns the variance of a general finite discrete random variable, with vector probabilities @math{v}.
3514 See @code{pdf_general_finite_discrete} for more details.
3516 @opencatbox{Categories:}
3517 @category{Package distrib}
3523 @anchor{std_general_finite_discrete}
3524 @deffn {Function} std_general_finite_discrete (@var{v})
3525 Returns the standard deviation of a general finite discrete random variable, with vector probabilities @math{v}.
3527 See @code{pdf_general_finite_discrete} for more details.
3529 @opencatbox{Categories:}
3530 @category{Package distrib}
3536 @anchor{skewness_general_finite_discrete}
3537 @deffn {Function} skewness_general_finite_discrete (@var{v})
3538 Returns the skewness coefficient of a general finite discrete random variable, with vector probabilities @math{v}.
3540 See @code{pdf_general_finite_discrete} for more details.
3542 @opencatbox{Categories:}
3543 @category{Package distrib}
3549 @anchor{kurtosis_general_finite_discrete}
3550 @deffn {Function} kurtosis_general_finite_discrete (@var{v})
3551 Returns the kurtosis coefficient of a general finite discrete random variable, with vector probabilities @math{v}.
3553 See @code{pdf_general_finite_discrete} for more details.
3555 @opencatbox{Categories:}
3556 @category{Package distrib}
3562 @anchor{random_general_finite_discrete}
3563 @deffn {Function} random_general_finite_discrete (@var{v}) @
3564 @fname{random_general_finite_discrete} (@var{v},@var{m})
3566 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.
3568 See @code{pdf_general_finite_discrete} for more details.
3571 @c load ("distrib")$
3572 @c random_general_finite_discrete([1,3,1,5]);
3573 @c random_general_finite_discrete([1,3,1,5], 10);
3576 (%i1) load ("distrib")$
3577 (%i2) random_general_finite_discrete([1,3,1,5]);
3579 (%i3) random_general_finite_discrete([1,3,1,5], 10);
3580 (%o3) [4, 2, 2, 3, 2, 4, 4, 1, 2, 2]
3583 @opencatbox{Categories:}
3584 @category{Package distrib}
3585 @category{Random numbers}
3591 @anchor{pdf_binomial}
3592 @deffn {Function} pdf_binomial (@var{x},@var{n},@var{p})
3593 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")}.
3595 @opencatbox{Categories:}
3596 @category{Package distrib}
3602 @anchor{cdf_binomial}
3603 @deffn {Function} cdf_binomial (@var{x},@var{n},@var{p})
3604 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.
3607 @c load ("distrib")$
3608 @c cdf_binomial(5,7,1/6);
3612 (%i1) load ("distrib")$
3613 (%i2) cdf_binomial(5,7,1/6);
3618 (%o3) .9998713991769548
3621 @opencatbox{Categories:}
3622 @category{Package distrib}
3628 @anchor{quantile_binomial}
3629 @deffn {Function} quantile_binomial (@var{q},@var{n},@var{p})
3630 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")}.
3632 @opencatbox{Categories:}
3633 @category{Package distrib}
3639 @anchor{mean_binomial}
3640 @deffn {Function} mean_binomial (@var{n},@var{p})
3641 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")}.
3643 @opencatbox{Categories:}
3644 @category{Package distrib}
3650 @anchor{var_binomial}
3651 @deffn {Function} var_binomial (@var{n},@var{p})
3652 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")}.
3654 @opencatbox{Categories:}
3655 @category{Package distrib}
3661 @anchor{std_binomial}
3662 @deffn {Function} std_binomial (@var{n},@var{p})
3663 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")}.
3665 @opencatbox{Categories:}
3666 @category{Package distrib}
3672 @anchor{skewness_binomial}
3673 @deffn {Function} skewness_binomial (@var{n},@var{p})
3674 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")}.
3676 @opencatbox{Categories:}
3677 @category{Package distrib}
3683 @anchor{kurtosis_binomial}
3684 @deffn {Function} kurtosis_binomial (@var{n},@var{p})
3685 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")}.
3687 @opencatbox{Categories:}
3688 @category{Package distrib}
3694 @anchor{random_binomial}
3695 @deffn {Function} random_binomial (@var{n},@var{p}) @
3696 @fname{random_binomial} (@var{n},@var{p},@var{m})
3698 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.
3700 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.
3702 To make use of this function, write first @code{load("distrib")}.
3704 @opencatbox{Categories:}
3705 @category{Package distrib}
3706 @category{Random numbers}
3712 @anchor{pdf_poisson}
3713 @deffn {Function} pdf_poisson (@var{x},@var{m})
3714 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")}.
3716 @opencatbox{Categories:}
3717 @category{Package distrib}
3723 @anchor{cdf_poisson}
3724 @deffn {Function} cdf_poisson (@var{x},@var{m})
3725 Returns the value at @var{x} of the distribution function of a @math{Poisson(m)} random variable, with @math{m>0}.
3728 @c load ("distrib")$
3729 @c cdf_poisson(3,5);
3733 (%i1) load ("distrib")$
3734 (%i2) cdf_poisson(3,5);
3735 (%o2) gamma_incomplete_regularized(4, 5)
3737 (%o3) .2650259152973623
3740 @opencatbox{Categories:}
3741 @category{Package distrib}
3747 @anchor{quantile_poisson}
3748 @deffn {Function} quantile_poisson (@var{q},@var{m})
3749 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")}.
3751 @opencatbox{Categories:}
3752 @category{Package distrib}
3758 @anchor{mean_poisson}
3759 @deffn {Function} mean_poisson (@var{m})
3760 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")}.
3762 @opencatbox{Categories:}
3763 @category{Package distrib}
3769 @anchor{var_poisson}
3770 @deffn {Function} var_poisson (@var{m})
3771 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")}.
3773 @opencatbox{Categories:}
3774 @category{Package distrib}
3780 @anchor{std_poisson}
3781 @deffn {Function} std_poisson (@var{m})
3782 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")}.
3784 @opencatbox{Categories:}
3785 @category{Package distrib}
3791 @anchor{skewness_poisson}
3792 @deffn {Function} skewness_poisson (@var{m})
3793 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")}.
3795 @opencatbox{Categories:}
3796 @category{Package distrib}
3802 @anchor{kurtosis_poisson}
3803 @deffn {Function} kurtosis_poisson (@var{m})
3804 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")}.
3806 @opencatbox{Categories:}
3807 @category{Package distrib}
3813 @anchor{random_poisson}
3814 @deffn {Function} random_poisson (@var{m}) @
3815 @fname{random_poisson} (@var{m},@var{n})
3817 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.
3819 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.
3821 To make use of this function, write first @code{load("distrib")}.
3823 @opencatbox{Categories:}
3824 @category{Package distrib}
3825 @category{Random numbers}
3831 @anchor{pdf_bernoulli}
3832 @deffn {Function} pdf_bernoulli (@var{x},@var{p})
3833 Returns the value at @var{x} of the probability function of a @math{Bernoulli(p)} random variable, with @math{0 \leq p \leq 1}.
3835 The @math{Bernoulli(p)} random variable is equivalent to the @math{Binomial(1,p)}.
3838 @c load ("distrib")$
3839 @c pdf_bernoulli(1,p);
3842 (%i1) load ("distrib")$
3843 (%i2) pdf_bernoulli(1,p);
3847 @opencatbox{Categories:}
3848 @category{Package distrib}
3854 @anchor{cdf_bernoulli}
3855 @deffn {Function} cdf_bernoulli (@var{x},@var{p})
3856 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")}.
3858 @opencatbox{Categories:}
3859 @category{Package distrib}
3865 @anchor{quantile_bernoulli}
3866 @deffn {Function} quantile_bernoulli (@var{q},@var{p})
3867 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")}.
3869 @opencatbox{Categories:}
3870 @category{Package distrib}
3876 @anchor{mean_bernoulli}
3877 @deffn {Function} mean_bernoulli (@var{p})
3878 Returns the mean of a @math{Bernoulli(p)} random variable, with @math{0 \leq p \leq 1}.
3880 The @math{Bernoulli(p)} random variable is equivalent to the @math{Binomial(1,p)}.
3883 @c load ("distrib")$
3884 @c mean_bernoulli(p);
3887 (%i1) load ("distrib")$
3888 (%i2) mean_bernoulli(p);
3892 @opencatbox{Categories:}
3893 @category{Package distrib}
3899 @anchor{var_bernoulli}
3900 @deffn {Function} var_bernoulli (@var{p})
3901 Returns the variance of a @math{Bernoulli(p)} random variable, with @math{0 \leq p \leq 1}.
3903 The @math{Bernoulli(p)} random variable is equivalent to the @math{Binomial(1,p)}.
3906 @c load ("distrib")$
3907 @c var_bernoulli(p);
3910 (%i1) load ("distrib")$
3911 (%i2) var_bernoulli(p);
3915 @opencatbox{Categories:}
3916 @category{Package distrib}
3922 @anchor{std_bernoulli}
3923 @deffn {Function} std_bernoulli (@var{p})
3924 Returns the standard deviation of a @math{Bernoulli(p)} random variable, with @math{0 \leq p \leq 1}.
3926 The @math{Bernoulli(p)} random variable is equivalent to the @math{Binomial(1,p)}.
3929 @c load ("distrib")$
3930 @c std_bernoulli(p);
3933 (%i1) load ("distrib")$
3934 (%i2) std_bernoulli(p);
3935 (%o2) sqrt((1 - p) p)
3938 @opencatbox{Categories:}
3939 @category{Package distrib}
3945 @anchor{skewness_bernoulli}
3946 @deffn {Function} skewness_bernoulli (@var{p})
3947 Returns the skewness coefficient of a @math{Bernoulli(p)} random variable, with @math{0 \leq p \leq 1}.
3949 The @math{Bernoulli(p)} random variable is equivalent to the @math{Binomial(1,p)}.
3952 @c load ("distrib")$
3953 @c skewness_bernoulli(p);
3956 (%i1) load ("distrib")$
3957 (%i2) skewness_bernoulli(p);
3959 (%o2) ---------------
3963 @opencatbox{Categories:}
3964 @category{Package distrib}
3970 @anchor{kurtosis_bernoulli}
3971 @deffn {Function} kurtosis_bernoulli (@var{p})
3972 Returns the kurtosis coefficient of a @math{Bernoulli(p)} random variable, with @math{0 \leq p \leq 1}.
3974 The @math{Bernoulli(p)} random variable is equivalent to the @math{Binomial(1,p)}.
3977 @c load ("distrib")$
3978 @c kurtosis_bernoulli(p);
3981 (%i1) load ("distrib")$
3982 (%i2) kurtosis_bernoulli(p);
3984 (%o2) ---------------
3988 @opencatbox{Categories:}
3989 @category{Package distrib}
3995 @anchor{random_bernoulli}
3996 @deffn {Function} random_bernoulli (@var{p}) @
3997 @fname{random_bernoulli} (@var{p},@var{n})
3999 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.
4001 This is a direct application of the @code{random} built-in Maxima function.
4003 See also @mrefdot{random} To make use of this function, write first @code{load("distrib")}.
4005 @opencatbox{Categories:}
4006 @category{Package distrib}
4007 @category{Random numbers}
4012 @anchor{pdf_geometric}
4013 @deffn {Function} pdf_geometric (@var{x},@var{p})
4014 Returns the value at @var{x} of the probability function of a @math{Geometric(p)} random variable, with
4019 @math{0 < p \leq 1}.
4022 The probability function is defined as @math{p (1 - p)^x}.
4023 This is interpreted as the probability of @math{x} failures before the first success.
4025 @code{load("distrib")} loads this function.
4027 @opencatbox{Categories:}
4028 @category{Package distrib}
4034 @anchor{cdf_geometric}
4035 @deffn {Function} cdf_geometric (@var{x},@var{p})
4036 Returns the value at @var{x} of the distribution function of a @math{Geometric(p)} random variable, with
4041 @math{0 < p \leq 1}.
4044 The probability from which the distribution function is derived is defined as @math{p (1 - p)^x}.
4045 This is interpreted as the probability of @math{x} failures before the first success.
4047 @code{load("distrib")} loads this function.
4049 @opencatbox{Categories:}
4050 @category{Package distrib}
4056 @anchor{quantile_geometric}
4057 @deffn {Function} quantile_geometric (@var{q},@var{p})
4058 Returns the @var{q}-quantile of a @math{Geometric(p)} random variable, with
4063 @math{0 < p \leq 1};
4065 in other words, this is the inverse of @code{cdf_geometric}.
4066 Argument @var{q} must be an element of @math{[0,1]}.
4068 The probability from which the quantile is derived is defined as @math{p (1 - p)^x}.
4069 This is interpreted as the probability of @math{x} failures before the first success.
4071 @code{load("distrib")} loads this function.
4073 @opencatbox{Categories:}
4074 @category{Package distrib}
4080 @anchor{mean_geometric}
4081 @deffn {Function} mean_geometric (@var{p})
4082 Returns the mean of a @math{Geometric(p)} random variable, with
4087 @math{0 < p \leq 1}.
4090 The probability from which the mean is derived is defined as @math{p (1 - p)^x}.
4091 This is interpreted as the probability of @math{x} failures before the first success.
4093 @code{load("distrib")} loads this function.
4095 @opencatbox{Categories:}
4096 @category{Package distrib}
4102 @anchor{var_geometric}
4103 @deffn {Function} var_geometric (@var{p})
4104 Returns the variance of a @math{Geometric(p)} random variable, with
4109 @math{0 < p \leq 1}.
4112 The probability from which the variance is derived is defined as @math{p (1 - p)^x}.
4113 This is interpreted as the probability of @math{x} failures before the first success.
4115 @code{load("distrib")} loads this function.
4117 @opencatbox{Categories:}
4118 @category{Package distrib}
4124 @anchor{std_geometric}
4125 @deffn {Function} std_geometric (@var{p})
4126 Returns the standard deviation of a @math{Geometric(p)} random variable, with
4131 @math{0 < p \leq 1}.
4134 The probability from which the standard deviation is derived is defined as @math{p (1 - p)^x}.
4135 This is interpreted as the probability of @math{x} failures before the first success.
4137 @code{load("distrib")} loads this function.
4139 @opencatbox{Categories:}
4140 @category{Package distrib}
4146 @anchor{skewness_geometric}
4147 @deffn {Function} skewness_geometric (@var{p})
4148 Returns the skewness coefficient of a @math{Geometric(p)} random variable, with
4153 @math{0 < p \leq 1}.
4156 The probability from which the skewness is derived is defined as @math{p (1 - p)^x}.
4157 This is interpreted as the probability of @math{x} failures before the first success.
4159 @code{load("distrib")} loads this function.
4161 @opencatbox{Categories:}
4162 @category{Package distrib}
4168 @anchor{kurtosis_geometric}
4169 @deffn {Function} kurtosis_geometric (@var{p})
4170 Returns the kurtosis coefficient of a geometric random variable @math{Geometric(p)}, with
4175 @math{0 < p \leq 1}.
4178 The probability from which the kurtosis is derived is defined as @math{p (1 - p)^x}.
4179 This is interpreted as the probability of @math{x} failures before the first success.
4181 @code{load("distrib")} loads this function.
4183 @opencatbox{Categories:}
4184 @category{Package distrib}
4190 @anchor{random_geometric}
4191 @deffn {Function} random_geometric (@var{p}) @
4192 @fname{random_geometric} (@var{p},@var{n})
4194 @code{random_geometric(@var{p})} returns one random sample from a @math{Geometric(p)} distribution, with
4199 @math{0 < p \leq 1}.
4202 @code{random_geometric(@var{p}, @var{n})} returns a list of @var{n} random samples.
4204 The algorithm is based on simulation of Bernoulli trials.
4206 The probability from which the random sample is derived is defined as @math{p (1 - p)^x}.
4207 This is interpreted as the probability of @math{x} failures before the first success.
4209 @code{load("distrib")} loads this function.
4212 @opencatbox{Categories:}
4213 @category{Package distrib}
4214 @category{Random numbers}
4220 @anchor{pdf_discrete_uniform}
4221 @deffn {Function} pdf_discrete_uniform (@var{x},@var{n})
4222 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")}.
4224 @opencatbox{Categories:}
4225 @category{Package distrib}
4231 @anchor{cdf_discrete_uniform}
4232 @deffn {Function} cdf_discrete_uniform (@var{x},@var{n})
4233 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")}.
4235 @opencatbox{Categories:}
4236 @category{Package distrib}
4242 @anchor{quantile_discrete_uniform}
4243 @deffn {Function} quantile_discrete_uniform (@var{q},@var{n})
4244 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")}.
4246 @opencatbox{Categories:}
4247 @category{Package distrib}
4253 @anchor{mean_discrete_uniform}
4254 @deffn {Function} mean_discrete_uniform (@var{n})
4255 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")}.
4257 @opencatbox{Categories:}
4258 @category{Package distrib}
4264 @anchor{var_discrete_uniform}
4265 @deffn {Function} var_discrete_uniform (@var{n})
4266 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")}.
4268 @opencatbox{Categories:}
4269 @category{Package distrib}
4275 @anchor{std_discrete_uniform}
4276 @deffn {Function} std_discrete_uniform (@var{n})
4277 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")}.
4279 @opencatbox{Categories:}
4280 @category{Package distrib}
4286 @anchor{skewness_discrete_uniform}
4287 @deffn {Function} skewness_discrete_uniform (@var{n})
4288 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")}.
4290 @opencatbox{Categories:}
4291 @category{Package distrib}
4297 @anchor{kurtosis_discrete_uniform}
4298 @deffn {Function} kurtosis_discrete_uniform (@var{n})
4299 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")}.
4301 @opencatbox{Categories:}
4302 @category{Package distrib}
4308 @anchor{random_discrete_uniform}
4309 @deffn {Function} random_discrete_uniform (@var{n}) @
4310 @fname{random_discrete_uniform} (@var{n},@var{m})
4312 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.
4314 This is a direct application of the @code{random} built-in Maxima function.
4316 See also @mrefdot{random} To make use of this function, write first @code{load("distrib")}.
4318 @opencatbox{Categories:}
4319 @category{Package distrib}
4320 @category{Random numbers}
4326 @anchor{pdf_hypergeometric}
4327 @deffn {Function} pdf_hypergeometric (@var{x},@var{n1},@var{n2},@var{n})
4328 Returns the value at @var{x} of the probability function of a @math{Hypergeometric(n1,n2,n)}
4329 random variable, with @var{n1}, @var{n2} and @var{n} non negative integers and @math{n<=n1+n2}.
4330 Being @var{n1} the number of objects of class A, @var{n2} the number of objects of class B, and
4331 @var{n} the size of the sample without replacement, this function returns the probability of
4332 event "exactly @var{x} objects are of class A".
4334 To make use of this function, write first @code{load("distrib")}.
4336 @opencatbox{Categories:}
4337 @category{Package distrib}
4343 @anchor{cdf_hypergeometric}
4344 @deffn {Function} cdf_hypergeometric (@var{x},@var{n1},@var{n2},@var{n})
4345 Returns the value at @var{x} of the distribution function of a @math{Hypergeometric(n1,n2,n)}
4346 random variable, with @var{n1}, @var{n2} and @var{n} non negative integers and @math{n<=n1+n2}.
4347 See @code{pdf_hypergeometric} for a more complete description.
4349 To make use of this function, write first @code{load("distrib")}.
4351 @opencatbox{Categories:}
4352 @category{Package distrib}
4358 @anchor{quantile_hypergeometric}
4359 @deffn {Function} quantile_hypergeometric (@var{q},@var{n1},@var{n2},@var{n})
4360 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")}.
4362 @opencatbox{Categories:}
4363 @category{Package distrib}
4369 @anchor{mean_hypergeometric}
4370 @deffn {Function} mean_hypergeometric (@var{n1},@var{n2},@var{n})
4371 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")}.
4373 @opencatbox{Categories:}
4374 @category{Package distrib}
4380 @anchor{var_hypergeometric}
4381 @deffn {Function} var_hypergeometric (@var{n1},@var{n2},@var{n})
4382 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")}.
4384 @opencatbox{Categories:}
4385 @category{Package distrib}
4391 @anchor{std_hypergeometric}
4392 @deffn {Function} std_hypergeometric (@var{n1},@var{n2},@var{n})
4393 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")}.
4395 @opencatbox{Categories:}
4396 @category{Package distrib}
4402 @anchor{skewness_hypergeometric}
4403 @deffn {Function} skewness_hypergeometric (@var{n1},@var{n2},@var{n})
4404 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")}.
4406 @opencatbox{Categories:}
4407 @category{Package distrib}
4413 @anchor{kurtosis_hypergeometric}
4414 @deffn {Function} kurtosis_hypergeometric (@var{n1},@var{n2},@var{n})
4415 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")}.
4417 @opencatbox{Categories:}
4418 @category{Package distrib}
4424 @anchor{random_hypergeometric}
4425 @deffn {Function} random_hypergeometric (@var{n1},@var{n2},@var{n}) @
4426 @fname{random_hypergeometric} (@var{n1},@var{n2},@var{n},@var{m})
4428 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.
4430 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.
4432 To make use of this function, write first @code{load("distrib")}.
4434 @opencatbox{Categories:}
4435 @category{Package distrib}
4436 @category{Random numbers}
4442 @anchor{pdf_negative_binomial}
4443 @deffn {Function} pdf_negative_binomial (@var{x},@var{n},@var{p})
4444 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")}.
4446 @opencatbox{Categories:}
4447 @category{Package distrib}
4453 @anchor{cdf_negative_binomial}
4454 @deffn {Function} cdf_negative_binomial (@var{x},@var{n},@var{p})
4455 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.
4458 @c load ("distrib")$
4459 @c cdf_negative_binomial(3,4,1/8);
4462 (%i1) load ("distrib")$
4463 (%i2) cdf_negative_binomial(3,4,1/8);
4469 @opencatbox{Categories:}
4470 @category{Package distrib}
4476 @anchor{quantile_negative_binomial}
4477 @deffn {Function} quantile_negative_binomial (@var{q},@var{n},@var{p})
4478 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")}.
4480 @opencatbox{Categories:}
4481 @category{Package distrib}
4487 @anchor{mean_negative_binomial}
4488 @deffn {Function} mean_negative_binomial (@var{n},@var{p})
4489 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")}.
4491 @opencatbox{Categories:}
4492 @category{Package distrib}
4498 @anchor{var_negative_binomial}
4499 @deffn {Function} var_negative_binomial (@var{n},@var{p})
4500 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")}.
4502 @opencatbox{Categories:}
4503 @category{Package distrib}
4509 @anchor{std_negative_binomial}
4510 @deffn {Function} std_negative_binomial (@var{n},@var{p})
4511 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")}.
4513 @opencatbox{Categories:}
4514 @category{Package distrib}
4520 @anchor{skewness_negative_binomial}
4521 @deffn {Function} skewness_negative_binomial (@var{n},@var{p})
4522 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")}.
4524 @opencatbox{Categories:}
4525 @category{Package distrib}
4531 @anchor{kurtosis_negative_binomial}
4532 @deffn {Function} kurtosis_negative_binomial (@var{n},@var{p})
4533 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")}.
4535 @opencatbox{Categories:}
4536 @category{Package distrib}
4542 @anchor{random_negative_binomial}
4543 @deffn {Function} random_negative_binomial (@var{n},@var{p}) @
4544 @fname{random_negative_binomial} (@var{n},@var{p},@var{m})
4546 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.
4548 Algorithm described in Devroye, L. (1986) @var{Non-Uniform Random Variate Generation}. Springer Verlag, p. 480.
4550 To make use of this function, write first @code{load("distrib")}.
4552 @opencatbox{Categories:}
4553 @category{Package distrib}
4554 @category{Random numbers}
4558 @c Undefine all the m4 macros we defined in this file.
4559 m4_undefine(<<<m4_NormalRV>>>)