FUNCTION
CDF_inv
Inverse of the complemented chi-square distribution
Interface
#include <codecogs/statistics/distributions/continuous/chisquared/cdf_inv.h>
using namespace Statistics::Distributions::Continuous::Chisquared;
Finds the Chi-square argument x such that the integral from x to infinity of the Chi-square PDF (in other words the upper CDF) is equal to the given cumulative probability y. This is accomplished using the inverse gamma integral function and the relation: x/2 = gammaUpper_reg_inv( r/2, y );
Example:
#include <stdio.h>
#include <codecogs/stats/dists/continuous/chisquared/cdf_inv.h>
#include <codecogs/stats/dists/continuous/chisquared/cdf.h>
using namespace Stats::Dists::Continuous::ChiSquared;
int main()
{
printf( " x CDF INV \n" );
for( double x=1; x<10; x+=0.5 )
{
double y = CDF( 5, x, true );
double z = CDF_inv( 5, y );
printf( "%f \t %f \t %f \n", x, y, z );
}
return getchar();
}
Output:
x CDF INV
1.000000 0.962566 1.000000
1.500000 0.913070 1.500000
2.000000 0.849145 2.000000
2.500000 0.776495 2.500000
3.000000 0.699986 3.000000
3.500000 0.623388 3.500000
4.000000 0.549416 4.000000
4.500000 0.479883 4.500000
5.000000 0.415880 5.000000
5.500000 0.357946 5.500000
6.000000 0.306219 6.000000
6.500000 0.260558 6.500000
7.000000 0.220640 7.000000
7.500000 0.186030 7.500000
8.000000 0.156236 8.000000
8.500000 0.130748 8.500000
9.000000 0.109064 9.000000
9.500000 0.090707 9.500000
Parameters
r
the number of degrees of freedom, must be at least 1
y
the cumulative probability at which to evaluate the function, must be
Blank
between 0 and 1
if r<1, y<0 or y>1 this function writes to the error stream and returns -1
Interactive Calculator
r
y
Result
Computing…
Set a range above first to export a graph.
This function's source code is only visible to registered users — documentation and the calculator above are free to use either way. Sign in to see it.