PyNGL Home > Functions > General applied math

Ngl.chiinv

Evaluates the inverse chi-squared distribution function.

Available in version 1.3.0 or later.

Prototype

x = Ngl.chiinv(p,df)

Arguments

p

A multi-dimensional array or scalar value equal to the integral of the chi-square distribution. [0<p<1]

df

A multi-dimensional array of the same size as p equal to the degrees of freedom of the chi-square distribution. (0, +infinity)

Return value

x

A multi-dimensional array of the same size as p.

Description

This function evaluates the inverse chi-squared distribution function by calculating the upper integration of the non-central chi-square distribution. This gives the same answers as IMSL's "chiin" function.

Examples

The following:

  import Ngl
  p  = 0.99
  df = 2.
  x  = Ngl.chiinv(p,df)

  print "p =",p,"df =",df,"x=",x

  df = 64.
  x  = Ngl.chiinv(p,df)
produces:
p = 0.99 df = 2.0 x= [ 9.21034037]
p = 0.99 df = 64.0 x= [ 93.21685966]