ichi2cdf

The ichi2cdf function calculates the inverse chi-squared cumulative distribution function (CDF).

Synopsis

ichi2cdf(p,k)

Summary

The inverse chi-squared CDF returns the inverse of the chi-squared CDF with degrees of freedom k for the corresponding probability p.

Example

To calculate the inverse chi-squared distribution for a system consisting of numbers 1–10 with degree of freedom 5, do the following:

 

  1. Create a 1-dimensional array called system_array of size 10 and a double attribute called system, and fill it with values 1–10.

    AFL% store(build(<system:double>[i=0:9], double(i+1)), system_array); 
  2. Apply the direct chi2cdf to the system attribute and store the result in target_array:

    AFL% store(apply(system_array, direct, chi2cdf(system, 5)), target_array);

     

    The output is:

     

    {i} system,direct
    {0} 1,0.0374342
    {1} 2,0.150855
    {2} 3,0.300014
    {3} 4,0.450584
    {4} 5,0.58412
    {5} 6,0.693781
    {6} 7,0.77936
    {7} 8,0.843764
    {8} 9,0.890936
    {9} 10,0.924765

     

     

     

  3. Apply the ichi2cdf function to the attribute direct:

    AFL% apply(target_array, inverse, ichi2cdf(direct, 5.0)); 


    The output is:

    {i} system,direct,inverse
    {0} 1,0.0374342,1
    {1} 2,0.150855,2
    {2} 3,0.300014,3
    {3} 4,0.450584,4
    {4} 5,0.58412,5
    {5} 6,0.693781,6
    {6} 7,0.77936,7
    {7} 8,0.843764,8
    {8} 9,0.890936,9
    {9} 10,0.924765,10

    Note that the new attribute inverse is equal to the original system attribute.

  4. Remove the example arrays:

    AFL% remove(system_array); remove(target_array);