<< distfun_chi2cdf Chi-Squared distfun_chi2pdf >>

distfun >> distfun > Chi-Squared > distfun_chi2inv

distfun_chi2inv

Chi-squared Inverse CDF

Calling Sequence

x = distfun_chi2cdf(p,k)
x = distfun_chi2cdf(p,k,lowertail)

Parameters

p :

a matrix of doubles, the probability.

k :

a matrix of doubles, the number of degrees of freedom, k>0 (can be non integer)

lowertail :

a 1-by-1 matrix of booleans, the tail (default lowertail=%t). If lowertail is true (the default), then considers P(X<=x) otherwise P(X>x).

x :

a matrix of doubles, the outcome. x belongs to the set {0,1,2,3,......}

Description

Computes the Inverse cumulative distribution function of the Chi-squared distribution function.

Any scalar input argument is expanded to a matrix of doubles of the same size as the other input arguments.

Examples

// Test with p scalar, k scalar
computed = distfun_chi2inv(0.4,5)
expected = 3.6554996

// Test with expanded p, k scalar
computed = distfun_chi2inv([0.2 0.6],5)
expected = [2.3425343 5.1318671]

// Test with p scalar, k expanded
computed = distfun_chi2inv(0.44,[4 7])
expected = [2.9870195 5.827751]

// Test with both p,k expanded
computed = distfun_chi2inv([0.22 0.66],[3 4])
expected = [1.0878828 4.5215487]

// Test small values of p
x = distfun_chi2inv(1.e-15,6)
expected = 0.0000363
x = distfun_chi2inv(1.e-15,6,%f)
expected = 82.67507

Bibliography

http://en.wikipedia.org/wiki/Chi-squared_distribution

Authors


Report an issue
<< distfun_chi2cdf Chi-Squared distfun_chi2pdf >>