rmath-statistical-functions.html 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <html lang="en">
  2. <head>
  3. <title>rmath statistical functions - avram - a virtual machine code interpreter</title>
  4. <meta http-equiv="Content-Type" content="text/html">
  5. <meta name="description" content="avram - a virtual machine code interpreter">
  6. <meta name="generator" content="makeinfo 4.13">
  7. <link title="Top" rel="start" href="index.html#Top">
  8. <link rel="up" href="rmath.html#rmath" title="rmath">
  9. <link rel="prev" href="rmath.html#rmath" title="rmath">
  10. <link rel="next" href="rmath-miscellaneous-functions.html#rmath-miscellaneous-functions" title="rmath miscellaneous functions">
  11. <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
  12. <meta http-equiv="Content-Style-Type" content="text/css">
  13. <style type="text/css"><!--
  14. pre.display { font-family:inherit }
  15. pre.format { font-family:inherit }
  16. pre.smalldisplay { font-family:inherit; font-size:smaller }
  17. pre.smallformat { font-family:inherit; font-size:smaller }
  18. pre.smallexample { font-size:smaller }
  19. pre.smalllisp { font-size:smaller }
  20. span.sc { font-variant:small-caps }
  21. span.roman { font-family:serif; font-weight:normal; }
  22. span.sansserif { font-family:sans-serif; font-weight:normal; }
  23. --></style>
  24. </head>
  25. <body>
  26. <div class="node">
  27. <a name="rmath-statistical-functions"></a>
  28. <p>
  29. Next:&nbsp;<a rel="next" accesskey="n" href="rmath-miscellaneous-functions.html#rmath-miscellaneous-functions">rmath miscellaneous functions</a>,
  30. Previous:&nbsp;<a rel="previous" accesskey="p" href="rmath.html#rmath">rmath</a>,
  31. Up:&nbsp;<a rel="up" accesskey="u" href="rmath.html#rmath">rmath</a>
  32. <hr>
  33. </div>
  34. <h4 class="subsection">D.16.1 <code>rmath</code> statistical functions</h4>
  35. <p>Functions for evaluating random draws, density, cumulative probability
  36. and inverse cumulative probability are provided for some of the more
  37. frequently used probability distributions, which are chi-squared,
  38. non-central chi-squared, exponential, lognormal, normal, poisson,
  39. Student's t, and uniform.
  40. <p>Each distribution is known by an abbreviated name and specified by one
  41. <a name="index-distributions-806"></a><a name="index-probability-distributions-807"></a><a name="index-statistical-distributions-808"></a>or two real parameters as listed below. Names of distributions in this
  42. table form the stem of a library function name. The names of the
  43. parameters such as <var>mu</var> and <var>sigma</var> are not explicitly
  44. mentioned when invoking the functions, but are listed here for
  45. reference. The precise definitions of the distribution functions and
  46. interpretations of these parameters can be found in standard texts on
  47. probability and statistics.
  48. <pre class="example"> chisq <var>df</var>
  49. nchisq <var>df</var>, <var>lambda</var>
  50. exp <var>scale</var>
  51. lnorm <var>logmean</var>, <var>logsd</var>
  52. norm <var>mu</var>, <var>sigma</var>
  53. pois <var>lambda</var>
  54. t <var>n</var>
  55. unif <var>a</var>, <var>b</var>
  56. </pre>
  57. <p>The virtual code interface follows a naming convention similar to the
  58. native API, in that function names beginning with <code>r</code> represent
  59. random draws from a distribution, with the argument to the function
  60. being the parameters specifying the distribution. Functions in this
  61. first group return a random draw from a distribution described by a
  62. single real parameter.
  63. <ul>
  64. <li><code>rchisq</code>
  65. <li><code>rexp</code>
  66. <li><code>rpois</code>
  67. <li><code>rt</code>
  68. </ul>
  69. <p class="noindent">These next functions return random draws from distributions specified
  70. by a pair of parameters, <code>(</code><var>x</var><code>,</code><var>y</var><code>)</code>.
  71. <ul>
  72. <li><code>rnchisq</code>
  73. <li><code>rlnorm</code>
  74. <li><code>rnorm</code>
  75. <li><code>runif</code>
  76. </ul>
  77. <p>Functions whose names begin with <code>d</code> evaluate the probability
  78. density of a distribution at a given point. They require at least two
  79. real arguments, the first being the point whose probability density is
  80. sought, and the remaining ones being the parameters that specify the
  81. distribution. A boolean operand, which is <code>nil</code> for false and
  82. <code>(nil,nil)</code> for true, requests the logarithm of the density when
  83. true.
  84. <p>Functions with names in the following group take a triple with two
  85. real operands and a boolean, <code>(</code><var>x</var><code>,(</code><var>y</var><code>,</code><var>a</var><code>))</code>, and
  86. return a probabiity density.
  87. <ul>
  88. <li><code>dchisq</code>
  89. <li><code>dexp</code>
  90. <li><code>dpois</code>
  91. <li><code>dt</code>
  92. </ul>
  93. <p class="noindent">The next functions pertain to distributions requiring two paramters to
  94. specify them, so they take a quadruple with three real operands and a
  95. boolean, <code>(</code><var>x</var><code>,(</code><var>y</var><code>,(</code><var>z</var><code>,</code><var>a</var><code>)))</code>.
  96. <ul>
  97. <li><code>dnchisq</code>
  98. <li><code>dlnorm</code>
  99. <li><code>dnorm</code>
  100. <li><code>dunif</code>
  101. </ul>
  102. <p>Functions whose names begin with <code>p</code> or <code>q</code> obtain
  103. <a name="index-cumulative-probability-809"></a>cumulative probabilities or inverse cumulative probabilities
  104. respectively for a specified distribution. They require one real
  105. operand to identify the point whose probability or inverse probability
  106. is sought, and other real operands to parameterize the distribution,
  107. as above. There are also two boolean operands. The first is true in
  108. order to request a probability or inverse probability with respect to
  109. the lower tail as opposed to the upper, and the other is true to
  110. indicate that probabilities are to be expressed logarithmically.
  111. <p>The argument to these functions is a quadruple with two real operands
  112. and two booleans, <code>(</code><var>x</var><code>,(</code><var>y</var><code>,(</code><var>a</var><code>,</code><var>b</var><code>)))</code>.
  113. <ul>
  114. <li><code>pchisq</code>, <code>qchisq</code>
  115. <li><code>pexp</code>, <code>qexp</code>
  116. <li><code>ppois</code>, <code>qpois</code>
  117. <li><code>pt</code>, <code>qt</code>
  118. </ul>
  119. <p class="noindent">The remaining functions pertain to distributions parameterized by two
  120. real operands. These take a quintuple with three real operands and two
  121. booleans, <code>(</code><var>x</var><code>,(</code><var>y</var><code>,(</code><var>z</var><code>,(</code><var>a</var><code>,</code><var>b</var><code>))))</code>.
  122. <ul>
  123. <li><code>pnchisq</code>,
  124. <code>qnchisq</code>
  125. <li><code>plnorm</code>,
  126. <code>qlnorm</code>
  127. <li><code>pnorm</code>,
  128. <code>qnorm</code>
  129. <li><code>punif</code>,
  130. <code>qunif</code>
  131. </ul>
  132. </body></html>