The R Project SVN R

Rev

Rev 89404 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 89404 Rev 89663
Line 50... Line 50...
50
  The functions \code{beta} and \code{lbeta} return the beta function
50
  The functions \code{beta} and \code{lbeta} return the beta function
51
  and the natural logarithm of the beta function,
51
  and the natural logarithm of the beta function,
52
  \deqn{B(a,b) = \frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)}.}{B(a,b) = \Gamma(a)\Gamma(b)/\Gamma(a+b).}
52
  \deqn{B(a,b) = \frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)}.}{B(a,b) = \Gamma(a)\Gamma(b)/\Gamma(a+b).}
53
  The formal definition is
53
  The formal definition is
54
  \deqn{B(a, b) = \int_0^1 t^{a-1} (1-t)^{b-1} dt}{integral_0^1 t^(a-1) (1-t)^(b-1) dt}
54
  \deqn{B(a, b) = \int_0^1 t^{a-1} (1-t)^{b-1} dt}{integral_0^1 t^(a-1) (1-t)^(b-1) dt}
55
  \bibcitep{|R:Abramowitz+Stegun:1972|section 6.2.1\, page 258}.
55
  \bibcitep{|R:Abramowitz+Stegun:1972|page 258 in section 6.2.1}.
56
  Note that it is only
56
  Note that it is only
57
  defined in \R for non-negative \code{a} and \code{b}, and is infinite
57
  defined in \R for non-negative \code{a} and \code{b}, and is infinite
58
  if either is zero.
58
  if either is zero.
59
 
59
 
60
  The functions \code{gamma} and \code{lgamma} return the gamma function
60
  The functions \code{gamma} and \code{lgamma} return the gamma function
61
  \eqn{\Gamma(x)} and the natural logarithm of \emph{the absolute value of} the
61
  \eqn{\Gamma(x)} and the natural logarithm of \emph{the absolute value of} the
62
  gamma function.  The gamma function is defined by
62
  gamma function.  The gamma function is defined by
63
  \bibcitep{|R:Abramowitz+Stegun:1972|section 6.1.1\, page 255}
63
  \bibcitep{|R:Abramowitz+Stegun:1972|page 255 in section 6.1.1}
64
  \deqn{\Gamma(x) = \int_0^\infty t^{x-1} e^{-t} dt}{\Gamma(x) = integral_0^Inf t^(x-1) exp(-t) dt}
64
  \deqn{\Gamma(x) = \int_0^\infty t^{x-1} e^{-t} dt}{\Gamma(x) = integral_0^Inf t^(x-1) exp(-t) dt}
65
  for all \eqn{x > 0}, from which the recursions \eqn{\Gamma(x+1) =
65
  for all \eqn{x > 0}, from which the recursions \eqn{\Gamma(x+1) =
66
  x\Gamma(x)} and then \eqn{\Gamma(x+n) = (x+n-1)(x+n-2)\cdots x \Gamma(x)}
66
  x\Gamma(x)} and then \eqn{\Gamma(x+n) = (x+n-1)(x+n-2)\cdots x \Gamma(x)}
67
  for all non-negative integers \eqn{n}.  Solving  for \eqn{\Gamma(x)} and
67
  for all non-negative integers \eqn{n}.  Solving  for \eqn{\Gamma(x)} and
68
  analytic continuation leads to the expression for non-integer negative real numbers,
68
  analytic continuation leads to the expression for non-integer negative real numbers,
69
  \deqn{\Gamma(x) = \frac{\Gamma(x + n)}{(x + n -1) \cdots (x + 1)x}, \ n \in \mathbb{Z}^{+}, -n < x < 0,%
69
  \deqn{\Gamma(x) = \frac{\Gamma(x + n)}{(x + n -1) \cdots (x + 1)x}, \ n \in \mathbb{Z}^{+}, -n < x < 0,%
70
  }{\Gamma(x) = \Gamma(x + n)/((x + n -1) ... (x + 1)x), n in N, -n < x < 0,}
70
  }{\Gamma(x) = \Gamma(x + n)/((x + n -1) ... (x + 1)x), n in N, -n < x < 0,}
71
  see \bibcitet{|R:Abramowitz+Stegun:1972|6.1.16 or 6.1.22\, page 256}.
71
  see \bibcitet{|R:Abramowitz+Stegun:1972|equations 6.1.16 or 6.1.22 on page 256}.
72
  %
72
  %
73
  The gamma function is not defined for zero and negative integers (when
73
  The gamma function is not defined for zero and negative integers (when
74
  \code{NaN} is returned).  There will be a warning on possible loss of
74
  \code{NaN} is returned).  There will be a warning on possible loss of
75
  precision for values which are too close (within about
75
  precision for values which are too close (within about
76
  \eqn{10^{-8}}{1e-8}) to a negative integer less than \samp{-10}.
76
  \eqn{10^{-8}}{1e-8}) to a negative integer less than \samp{-10}.
Line 85... Line 85...
85
  \code{deriv}-th derivative of \eqn{\psi(x)}.
85
  \code{deriv}-th derivative of \eqn{\psi(x)}.
86
  \deqn{\code{digamma(x)} = \psi(x) = \frac{d}{dx}\ln\Gamma(x) =
86
  \deqn{\code{digamma(x)} = \psi(x) = \frac{d}{dx}\ln\Gamma(x) =
87
    \frac{\Gamma'(x)}{\Gamma(x)}}{digamma(x) = \psi(x) = d/dx{ln \Gamma(x)} = \Gamma'(x) / \Gamma(x)}
87
    \frac{\Gamma'(x)}{\Gamma(x)}}{digamma(x) = \psi(x) = d/dx{ln \Gamma(x)} = \Gamma'(x) / \Gamma(x)}
88
  \eqn{\psi} and its derivatives, the \code{psigamma()} functions, are
88
  \eqn{\psi} and its derivatives, the \code{psigamma()} functions, are
89
  often called the \sQuote{\I{polygamma}} functions, e.g.\sspace{}in
89
  often called the \sQuote{\I{polygamma}} functions, e.g.\sspace{}in
90
  \bibcitet{|R:Abramowitz+Stegun:1972|section 6.4.1\, page 260}; and higher
90
  \bibcitet{|R:Abramowitz+Stegun:1972|page 260 in section 6.4.1}; and higher
91
  derivatives (\code{deriv = 2:4}) have occasionally been called
91
  derivatives (\code{deriv = 2:4}) have occasionally been called
92
  \sQuote{\I{tetragamma}}, \sQuote{\I{pentagamma}}, and \sQuote{\I{hexagamma}}.
92
  \sQuote{\I{tetragamma}}, \sQuote{\I{pentagamma}}, and \sQuote{\I{hexagamma}}.
93
 
93
 
94
  The functions \code{choose} and \code{lchoose} return binomial
94
  The functions \code{choose} and \code{lchoose} return binomial
95
  coefficients and the logarithms of their absolute values.  Note that
95
  coefficients and the logarithms of their absolute values.  Note that