invchi(P, df [,noncen, epsilon:eps] [,upper:T or lower:F]), P, df and noncen REAL, elements of P between 0 and 1, elements df > 0, elements of noncen >= 0, eps > 0 small. |

invchi(p,df) computes the pth quantile (100*p percent point, critical value) of the chi squared distribution with df degrees of freedom. invchi(p,df,Noncen [, epsilon:eps]) computes the pth quantile of non-central chi-squared with non-centrality parameter Noncen. The accuracy of the inverse is controled by eps which has default value 1e-10. The elements of p must be between 0 and 1 and the elements of df must be positive but need not be integers. If present, the elements of Noncen must be non-negative. Any of p, df or Noncen that are not scalars (single numbers) must be the same size and shape. Any argument that is a scalar is used to compute all elements of the result. invchi(p,df [,Noncen], upper:T) and invchi(p,df [,Noncen], lower:F) compute an upper tail quantile mathematically equivalent to invchi(1 - p, df [,Noncen]). It may be more accurate for p very close to 1. invchi() is the inverse of cumchi(). If alpha is small, invchi(alpha,df,upper:T) or invchi(1-alpha,df) is the critical value for a chi-squared test of significance level alpha. If Ssq is the sample variance from a normally distributed random sample of size n, then (n-1)*Ssq/invchi(vector(1-alpha/2, alpha/2),n-1) is a 1-alpha confidence interval for the population variance. invchi(runi(n),df [,Noncen]) will generate a random sample of size n from a possibly non-central chi-squared distribution . See also cumchi(), runi().

Gary Oehlert 2003-01-15