g01fc returns the deviate associated with the given lower tail probability of the ${\chi}^{2}$-distribution with real degrees of freedom.

# Syntax

C# |
---|

public static double g01fc( double p, double df, out int ifail ) |

Visual Basic |
---|

Public Shared Function g01fc ( _ p As Double, _ df As Double, _ <OutAttribute> ByRef ifail As Integer _ ) As Double |

Visual C++ |
---|

public: static double g01fc( double p, double df, [OutAttribute] int% ifail ) |

F# |
---|

static member g01fc : p : float * df : float * ifail : int byref -> float |

#### Parameters

- p
- Type: System..::..Double
*On entry*: $p$, the lower tail probability from the required ${\chi}^{2}$-distribution.*Constraint*: $0.0\le {\mathbf{p}}<1.0$.

- df
- Type: System..::..Double
*On entry*: $\nu $, the degrees of freedom of the ${\chi}^{2}$-distribution.*Constraint*: ${\mathbf{df}}>0.0$.

- ifail
- Type: System..::..Int32%
*On exit*: ${\mathbf{ifail}}={0}$ unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

#### Return Value

g01fc returns the deviate associated with the given lower tail probability of the ${\chi}^{2}$-distribution with real degrees of freedom.

# Description

The deviate, ${x}_{p}$, associated with the lower tail probability $p$ of the ${\chi}^{2}$-distribution with $\nu $ degrees of freedom is defined as the solution to

The required ${x}_{p}$ is found by using the relationship between a ${\chi}^{2}$-distribution and a gamma distribution, i.e., a ${\chi}^{2}$-distribution with $\nu $ degrees of freedom is equal to a gamma distribution with scale parameter $2$ and shape parameter $\nu /2$.

$$P\left(X\le {x}_{p}:\nu \right)=p=\frac{1}{{2}^{\nu /2}\Gamma \left(\nu /2\right)}\underset{0}{\overset{{x}_{p}}{\int}}{e}^{-X/2}{X}^{v/2-1}dX\text{, \hspace{1em}}0\le {x}_{p}<\infty \text{;}\nu >0\text{.}$$ |

For very large values of $\nu $, greater than ${10}^{5}$, Wilson and Hilferty's normal approximation to the ${\chi}^{2}$ is used; see Kendall and Stuart (1969).

# References

Best D J and Roberts D E (1975) Algorithm AS 91. The percentage points of the ${\chi}^{2}$ distribution

*Appl. Statist.***24**385–388Hastings N A J and Peacock J B (1975)

*Statistical Distributions*ButterworthKendall M G and Stuart A (1969)

*The Advanced Theory of Statistics (Volume 1)*(3rd Edition) Griffin# Error Indicators and Warnings

**Note:**g01fc may return useful information for one or more of the following detected errors or warnings.

Errors or warnings detected by the method:

- ${\mathbf{ifail}}=1$
On entry, ${\mathbf{p}}<0.0$, or ${\mathbf{p}}\ge 1.0$.

- ${\mathbf{ifail}}=2$
On entry, ${\mathbf{df}}\le 0.0$.

- ${\mathbf{ifail}}=3$

- ${\mathbf{ifail}}=4$
- The solution has failed to converge. The result should be a reasonable approximation.

- ${\mathbf{ifail}}=5$
- The series used to calculate the gamma function has failed to converge. This is an unlikely error exit.

# Accuracy

The results should be accurate to five significant digits for most parameter values. Some accuracy is lost for $p$ close to $0.0$.

# Parallelism and Performance

None.

# Further Comments

For higher accuracy the relationship described in [Description] may be used and a direct call to g01ff made.

# Example

This example reads lower tail probabilities for several ${\chi}^{2}$-distributions, and calculates and prints the corresponding deviates until the end of data is reached.

Example program (C#): g01fce.cs