 # Statistics

#### object Statistics

Class implementing some distributions, tests, etc. The code is mostly adapted from the CERN Jet Java libraries:

Copyright 2001 University of Waikato Copyright 1999 CERN - European Organization for Nuclear Research. Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. CERN and the University of Waikato make no representations about the suitability of this software for any purpose. It is provided "as is" without expressed or implied warranty.

Version

\$Revision: 5619 \$

Linear Supertypes
AnyRef, Any
Ordering
1. Alphabetic
2. By inheritance
Inherited
1. Statistics
2. AnyRef
3. Any
1. Hide All
2. Show all
Visibility
1. Public
2. All

### Value Members

1. #### final def !=(arg0: AnyRef): Boolean

Definition Classes
AnyRef
2. #### final def !=(arg0: Any): Boolean

Definition Classes
Any
3. #### final def ##(): Int

Definition Classes
AnyRef → Any
4. #### final def ==(arg0: AnyRef): Boolean

Definition Classes
AnyRef
5. #### final def ==(arg0: Any): Boolean

Definition Classes
Any
6. #### def FProbability(F: Double, df1: Int, df2: Int): Double

Computes probability of F-ratio.

Computes probability of F-ratio.

F

the F-ratio

df1

the first number of degrees of freedom

df2

the second number of degrees of freedom

returns

the probability of the F-ratio.

8. #### val MACHEP: Double

Some constants

20. #### final def asInstanceOf[T0]: T0

Definition Classes
Any

23. #### def binomialStandardError(p: Double, n: Int): Double

Computes standard error for observed values of a binomial random variable.

Computes standard error for observed values of a binomial random variable.

p

the probability of success

n

the size of the sample

returns

the standard error

24. #### def chiSquaredProbability(x: Double, v: Double): Double

Returns chi-squared probability for given value and degrees of freedom.

Returns chi-squared probability for given value and degrees of freedom. (The probability that the chi-squared variate will be greater than x for the given degrees of freedom.)

x

the value

v

the number of degrees of freedom

returns

the chi-squared probability

25. #### def clone(): AnyRef

Attributes
protected[java.lang]
Definition Classes
AnyRef
Annotations
@throws( ... )
26. #### final def eq(arg0: AnyRef): Boolean

Definition Classes
AnyRef
27. #### def equals(arg0: Any): Boolean

Definition Classes
AnyRef → Any
28. #### def errorFunction(x: Double): Double

Returns the error function of the normal distribution.

Returns the error function of the normal distribution. The integral is

```                          x
-
2         | |          2
erf(x)  =  --------     |    exp( - t  ) dt.
sqrt(pi)   | |
-
0
```
Implementation: For 0 <= |x| < 1, erf(x) = x * P4(x**2)/Q5(x**2); otherwise erf(x) = 1 - erfc(x).

Code adapted from the <A HREF="http://www.sci.usq.edu.au/staff/leighb/graph/Top.html"> Java 2D Graph Package 2.4</A>, which in turn is a port from the <A HREF="http://people.ne.mediaone.net/moshier/index.html#Cephes">Cephes 2.2</A> Math Library (C).

29. #### def errorFunctionComplemented(a: Double): Double

Returns the complementary Error function of the normal distribution.

Returns the complementary Error function of the normal distribution.

``` 1 - erf(x) =

inf.
-
2         | |          2
erfc(x)  =  --------     |    exp( - t  ) dt
sqrt(pi)   | |
-
x
```
Implementation: For small x, erfc(x) = 1 - erf(x); otherwise rational approximations are computed.

Code adapted from the <A HREF="http://www.sci.usq.edu.au/staff/leighb/graph/Top.html"> Java 2D Graph Package 2.4</A>, which in turn is a port from the <A HREF="http://people.ne.mediaone.net/moshier/index.html#Cephes">Cephes 2.2</A> Math Library (C).

a

the argument to the function.

30. #### def finalize(): Unit

Attributes
protected[java.lang]
Definition Classes
AnyRef
Annotations
@throws( classOf[java.lang.Throwable] )
31. #### def gamma(what: Double): Double

Returns the Gamma function of the argument.

32. #### final def getClass(): Class[_]

Definition Classes
AnyRef → Any
33. #### def hashCode(): Int

Definition Classes
AnyRef → Any
34. #### def incompleteBeta(aa: Double, bb: Double, xx: Double): Double

Returns the Incomplete Beta Function evaluated from zero to xx.

Returns the Incomplete Beta Function evaluated from zero to xx.

aa

the alpha parameter of the beta distribution.

bb

the beta parameter of the beta distribution.

xx

the integration end point.

35. #### def incompleteBetaFraction1(a: Double, b: Double, x: Double): Double

Continued fraction expansion #1 for incomplete beta integral.

36. #### def incompleteBetaFraction2(a: Double, b: Double, x: Double): Double

Continued fraction expansion #2 for incomplete beta integral.

37. #### def incompleteGamma(a: Double, x: Double): Double

Returns the Incomplete Gamma function.

Returns the Incomplete Gamma function.

a

the parameter of the gamma distribution.

x

the integration end point.

38. #### def incompleteGammaComplement(a: Double, x: Double): Double

Returns the Complemented Incomplete Gamma function.

Returns the Complemented Incomplete Gamma function.

a

the parameter of the gamma distribution.

x

the integration start point.

39. #### final def isInstanceOf[T0]: Boolean

Definition Classes
Any
40. #### def lnGamma(what: Double): Double

Returns natural logarithm of gamma function.

Returns natural logarithm of gamma function.

returns

natural logarithm of gamma function

41. #### final def ne(arg0: AnyRef): Boolean

Definition Classes
AnyRef
42. #### def normalInverse(y0: Double): Double

Returns the value, x, for which the area under the Normal (Gaussian) probability density function (integrated from minus infinity to x) is equal to the argument y (assumes mean is zero, variance is one).

Returns the value, x, for which the area under the Normal (Gaussian) probability density function (integrated from minus infinity to x) is equal to the argument y (assumes mean is zero, variance is one).

For small arguments 0 < y < exp(-2), the program computes z = sqrt( -2.0 * log(y) ); then the approximation is x = z - log(z)/z - (1/z) P(1/z) / Q(1/z). There are two rational functions P/Q, one for 0 < y < exp(-32) and the other for y up to exp(-2). For larger arguments, w = y - 0.5, and x/sqrt(2pi) = w + w**3 R(w**2)/S(w**2)).

y0

the area under the normal pdf

returns

the z-value

43. #### def normalProbability(a: Double): Double

Returns the area under the Normal (Gaussian) probability density function, integrated from minus infinity to x (assumes mean is zero, variance is one).

Returns the area under the Normal (Gaussian) probability density function, integrated from minus infinity to x (assumes mean is zero, variance is one).

```                           x
-
1        | |          2
normal(x)  = ---------    |    exp( - t /2 ) dt
sqrt(2pi)  | |
-
-inf.

=  ( 1 + erf(z) ) / 2
=  erfc(z) / 2
```
where z = x/sqrt(2). Computation is via the functions errorFunction and errorFunctionComplement.

a

the z-value

returns

the probability of the z value according to the normal pdf

44. #### final def notify(): Unit

Definition Classes
AnyRef
45. #### final def notifyAll(): Unit

Definition Classes
AnyRef
46. #### def p1evl(x: Double, coef: Array[Double], N: Int): Double

Evaluates the given polynomial of degree N at x.

Evaluates the given polynomial of degree N at x. Evaluates polynomial when coefficient of N is 1.0. Otherwise same as polevl().

```                    2          N
y  =  C  + C x + C x  +...+ C x
0    1     2          N

Coefficients are stored in reverse order:

coef = C  , ..., coef[N] = C  .
N                   0
```
The function p1evl() assumes that coef[N] = 1.0 and is omitted from the array. Its calling arguments are otherwise the same as polevl().

In the interest of speed, there are no checks for out of bounds arithmetic.

x

argument to the polynomial.

coef

the coefficients of the polynomial.

N

the degree of the polynomial.

47. #### def polevl(x: Double, coef: Array[Double], N: Int): Double

Evaluates the given polynomial of degree N at x.

Evaluates the given polynomial of degree N at x.

```                    2          N
y  =  C  + C x + C x  +...+ C x
0    1     2          N

Coefficients are stored in reverse order:

coef = C  , ..., coef[N] = C  .
N                   0
```
In the interest of speed, there are no checks for out of bounds arithmetic.

x

argument to the polynomial.

coef

the coefficients of the polynomial.

N

the degree of the polynomial.

48. #### def powerSeries(a: Double, b: Double, x: Double): Double

Power series for incomplete beta integral.

Power series for incomplete beta integral. Use when b*x is small and x not too close to 1.

49. #### def stirlingFormula(x: Double): Double

Returns the Gamma function computed by Stirling's formula.

Returns the Gamma function computed by Stirling's formula. The polynomial STIR is valid for 33 <= x <= 172.

50. #### final def synchronized[T0](arg0: ⇒ T0): T0

Definition Classes
AnyRef
51. #### def toString(): String

Definition Classes
AnyRef → Any
52. #### final def wait(): Unit

Definition Classes
AnyRef
Annotations
@throws( ... )
53. #### final def wait(arg0: Long, arg1: Int): Unit

Definition Classes
AnyRef
Annotations
@throws( ... )
54. #### final def wait(arg0: Long): Unit

Definition Classes
AnyRef
Annotations
@throws( ... )