rmath-statistical-functions.html 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
  2. <html>
  3. <!-- Created on November 8, 2012 by texi2html 1.82
  4. texi2html was written by:
  5. Lionel Cons <[email protected]> (original author)
  6. Karl Berry <[email protected]>
  7. Olaf Bachmann <[email protected]>
  8. and many others.
  9. Maintained by: Many creative people.
  10. Send bugs and suggestions to <[email protected]>
  11. -->
  12. <head>
  13. <title>avram - a virtual machine code interpreter: D.16.1 rmath statistical functions</title>
  14. <meta name="description" content="avram - a virtual machine code interpreter: D.16.1 rmath statistical functions">
  15. <meta name="keywords" content="avram - a virtual machine code interpreter: D.16.1 rmath statistical functions">
  16. <meta name="resource-type" content="document">
  17. <meta name="distribution" content="global">
  18. <meta name="Generator" content="texi2html 1.82">
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  20. <style type="text/css">
  21. <!--
  22. a.summary-letter {text-decoration: none}
  23. blockquote.smallquotation {font-size: smaller}
  24. pre.display {font-family: serif}
  25. pre.format {font-family: serif}
  26. pre.menu-comment {font-family: serif}
  27. pre.menu-preformatted {font-family: serif}
  28. pre.smalldisplay {font-family: serif; font-size: smaller}
  29. pre.smallexample {font-size: smaller}
  30. pre.smallformat {font-family: serif; font-size: smaller}
  31. pre.smalllisp {font-size: smaller}
  32. span.roman {font-family:serif; font-weight:normal;}
  33. span.sansserif {font-family:sans-serif; font-weight:normal;}
  34. ul.toc {list-style: none}
  35. -->
  36. </style>
  37. </head>
  38. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  39. <a name="rmath-statistical-functions"></a>
  40. <table cellpadding="1" cellspacing="1" border="0">
  41. <tr><td valign="middle" align="left">[<a href="rmath.html#rmath" title="Previous section in reading order"> &lt; </a>]</td>
  42. <td valign="middle" align="left">[<a href="rmath-miscellaneous-functions.html#rmath-miscellaneous-functions" title="Next section in reading order"> &gt; </a>]</td>
  43. <td valign="middle" align="left"> &nbsp; </td>
  44. <td valign="middle" align="left">[<a href="External-Libraries.html#External-Libraries" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
  45. <td valign="middle" align="left">[<a href="rmath.html#rmath" title="Up section"> Up </a>]</td>
  46. <td valign="middle" align="left">[<a href="Copying.html#Copying" title="Next chapter"> &gt;&gt; </a>]</td>
  47. <td valign="middle" align="left"> &nbsp; </td>
  48. <td valign="middle" align="left"> &nbsp; </td>
  49. <td valign="middle" align="left"> &nbsp; </td>
  50. <td valign="middle" align="left"> &nbsp; </td>
  51. <td valign="middle" align="left">[<a href="avram.html#Top" title="Cover (top) of document">Top</a>]</td>
  52. <td valign="middle" align="left">[<a href="avram_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
  53. <td valign="middle" align="left">[<a href="Function-Index.html#Function-Index" title="Index">Index</a>]</td>
  54. <td valign="middle" align="left">[<a href="avram_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
  55. </tr></table>
  56. <hr size="1">
  57. <a name="rmath-statistical-functions-1"></a>
  58. <h3 class="subsection">D.16.1 <code>rmath</code> statistical functions</h3>
  59. <p>Functions for evaluating random draws, density, cumulative probability
  60. and inverse cumulative probability are provided for some of the more
  61. frequently used probability distributions, which are chi-squared,
  62. non-central chi-squared, exponential, lognormal, normal, poisson,
  63. Student&rsquo;s t, and uniform.
  64. </p>
  65. <p>Each distribution is known by an abbreviated name and specified by one
  66. <a name="index-distributions"></a>
  67. <a name="index-probability-distributions"></a>
  68. <a name="index-statistical-distributions"></a>
  69. or two real parameters as listed below. Names of distributions in this
  70. table form the stem of a library function name. The names of the
  71. parameters such as <var>mu</var> and <var>sigma</var> are not explicitly
  72. mentioned when invoking the functions, but are listed here for
  73. reference. The precise definitions of the distribution functions and
  74. interpretations of these parameters can be found in standard texts on
  75. probability and statistics.
  76. </p>
  77. <table><tr><td>&nbsp;</td><td><pre class="example">chisq <var>df</var>
  78. nchisq <var>df</var>, <var>lambda</var>
  79. exp <var>scale</var>
  80. lnorm <var>logmean</var>, <var>logsd</var>
  81. norm <var>mu</var>, <var>sigma</var>
  82. pois <var>lambda</var>
  83. t <var>n</var>
  84. unif <var>a</var>, <var>b</var>
  85. </pre></td></tr></table>
  86. <p>The virtual code interface follows a naming convention similar to the
  87. native API, in that function names beginning with <code>r</code> represent
  88. random draws from a distribution, with the argument to the function
  89. being the parameters specifying the distribution. Functions in this
  90. first group return a random draw from a distribution described by a
  91. single real parameter.
  92. </p>
  93. <ul>
  94. <li> <code>rchisq</code>
  95. </li><li> <code>rexp</code>
  96. </li><li> <code>rpois</code>
  97. </li><li> <code>rt</code>
  98. </li></ul>
  99. <p>These next functions return random draws from distributions specified
  100. by a pair of parameters, <code>(<var>x</var>,<var>y</var>)</code>.
  101. </p>
  102. <ul>
  103. <li> <code>rnchisq</code>
  104. </li><li> <code>rlnorm</code>
  105. </li><li> <code>rnorm</code>
  106. </li><li> <code>runif</code>
  107. </li></ul>
  108. <p>Functions whose names begin with <code>d</code> evaluate the probability
  109. density of a distribution at a given point. They require at least two
  110. real arguments, the first being the point whose probability density is
  111. sought, and the remaining ones being the parameters that specify the
  112. distribution. A boolean operand, which is <code>nil</code> for false and
  113. <code>(nil,nil)</code> for true, requests the logarithm of the density when
  114. true.
  115. </p>
  116. <p>Functions with names in the following group take a triple with two
  117. real operands and a boolean, <code>(<var>x</var>,(<var>y</var>,<var>a</var>))</code>, and
  118. return a probabiity density.
  119. </p>
  120. <ul>
  121. <li> <code>dchisq</code>
  122. </li><li> <code>dexp</code>
  123. </li><li> <code>dpois</code>
  124. </li><li> <code>dt</code>
  125. </li></ul>
  126. <p>The next functions pertain to distributions requiring two paramters to
  127. specify them, so they take a quadruple with three real operands and a
  128. boolean, <code>(<var>x</var>,(<var>y</var>,(<var>z</var>,<var>a</var>)))</code>.
  129. </p>
  130. <ul>
  131. <li> <code>dnchisq</code>
  132. </li><li> <code>dlnorm</code>
  133. </li><li> <code>dnorm</code>
  134. </li><li> <code>dunif</code>
  135. </li></ul>
  136. <p>Functions whose names begin with <code>p</code> or <code>q</code> obtain
  137. <a name="index-cumulative-probability"></a>
  138. cumulative probabilities or inverse cumulative probabilities
  139. respectively for a specified distribution. They require one real
  140. operand to identify the point whose probability or inverse probability
  141. is sought, and other real operands to parameterize the distribution,
  142. as above. There are also two boolean operands. The first is true in
  143. order to request a probability or inverse probability with respect to
  144. the lower tail as opposed to the upper, and the other is true to
  145. indicate that probabilities are to be expressed logarithmically.
  146. </p>
  147. <p>The argument to these functions is a quadruple with two real operands
  148. and two booleans, <code>(<var>x</var>,(<var>y</var>,(<var>a</var>,<var>b</var>)))</code>.
  149. </p>
  150. <ul>
  151. <li> <code>pchisq</code>, <code>qchisq</code>
  152. </li><li> <code>pexp</code>, <code>qexp</code>
  153. </li><li> <code>ppois</code>, <code>qpois</code>
  154. </li><li> <code>pt</code>, <code>qt</code>
  155. </li></ul>
  156. <p>The remaining functions pertain to distributions parameterized by two
  157. real operands. These take a quintuple with three real operands and two
  158. booleans, <code>(<var>x</var>,(<var>y</var>,(<var>z</var>,(<var>a</var>,<var>b</var>))))</code>.
  159. </p>
  160. <ul>
  161. <li> <code>pnchisq</code>,
  162. <code>qnchisq</code>
  163. </li><li> <code>plnorm</code>,
  164. <code>qlnorm</code>
  165. </li><li> <code>pnorm</code>,
  166. <code>qnorm</code>
  167. </li><li> <code>punif</code>,
  168. <code>qunif</code>
  169. </li></ul>
  170. <hr size="1">
  171. <table cellpadding="1" cellspacing="1" border="0">
  172. <tr><td valign="middle" align="left">[<a href="rmath.html#rmath" title="Previous section in reading order"> &lt; </a>]</td>
  173. <td valign="middle" align="left">[<a href="rmath-miscellaneous-functions.html#rmath-miscellaneous-functions" title="Next section in reading order"> &gt; </a>]</td>
  174. <td valign="middle" align="left"> &nbsp; </td>
  175. <td valign="middle" align="left">[<a href="External-Libraries.html#External-Libraries" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
  176. <td valign="middle" align="left">[<a href="rmath.html#rmath" title="Up section"> Up </a>]</td>
  177. <td valign="middle" align="left">[<a href="Copying.html#Copying" title="Next chapter"> &gt;&gt; </a>]</td>
  178. <td valign="middle" align="left"> &nbsp; </td>
  179. <td valign="middle" align="left"> &nbsp; </td>
  180. <td valign="middle" align="left"> &nbsp; </td>
  181. <td valign="middle" align="left"> &nbsp; </td>
  182. <td valign="middle" align="left">[<a href="avram.html#Top" title="Cover (top) of document">Top</a>]</td>
  183. <td valign="middle" align="left">[<a href="avram_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
  184. <td valign="middle" align="left">[<a href="Function-Index.html#Function-Index" title="Index">Index</a>]</td>
  185. <td valign="middle" align="left">[<a href="avram_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
  186. </tr></table>
  187. <p>
  188. <font size="-1">
  189. This document was generated on <i>November 8, 2012</i> using <a href="http://www.nongnu.org/texi2html/"><i>texi2html 1.82</i></a>.
  190. </font>
  191. <br>
  192. </p>
  193. </body>
  194. </html>