Home > wafo > wstats > wchi2inv.m

# wchi2inv

## PURPOSE

Inverse of the Chi squared distribution function

## SYNOPSIS

x = wchi2inv(F,p)

## DESCRIPTION

``` WCHI2INV Inverse of the Chi squared distribution function

CALL:  x = wchi2inv(F,p)

x = inverse cdf for the Chi squared distribution evaluated at F
p = degrees of freedom

Example:
F = linspace(0,1,100);
x = wchi2inv(F,1);
plot(F,x)```

## CROSS-REFERENCE INFORMATION

This function calls:
 comnsize Check if all input arguments are either scalar or of common size. wgaminv Inverse of the Gamma distribution function error Display message and abort function. warning Display warning message; disable or enable warning messages.
This function is called by:
 dat2spec Estimate one-sided spectral density from data. wlognfit Parameter estimates for Lognormal data. wnormfit Parameter estimates for Normal data.

## SOURCE CODE

```001 function x = wchi2inv(F,p)
002 %WCHI2INV Inverse of the Chi squared distribution function
003 %
004 % CALL:  x = wchi2inv(F,p)
005 %
006 %        x = inverse cdf for the Chi squared distribution evaluated at F
007 %        p = degrees of freedom
008 %
009 %
010 % Example:
011 %     F = linspace(0,1,100);
012 %     x = wchi2inv(F,1);
013 %     plot(F,x)
014
015 % Reference: Johnson, Kotz and Balakrishnan (1994)
016 % "Continuous Univariate Distributions, vol. 1", p. 415 ff
017 % Wiley
018
019 % Tested on; Matlab 5.3
020 % History:
021 % revised pab 25.10.2000
022 %  - added comnsize, nargchk
024 error(nargchk(2,2,nargin))
025
026 if any(p~=round(p)),
027   warning('p should be an integer')
028 end
029 [errorcode,F,p2,b] = comnsize(F,p/2,2);
030 if errorcode > 0
031   error('F and p must be of common size or scalar.');
032 end
033
034 x=wgaminv(F,p/2,2);
035```

Mathematical Statistics
Centre for Mathematical Sciences
Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group

Generated on Thu 06-Oct-2005 02:21:16 for WAFO by m2html © 2003