Well I'm programming a test in java for pseudoRandom numbers for simulation subjet, and I need to calculate inverse of Chi squared, so I have alpha and degrees as you can see here.
the book I'm reading, uses Excel function Excel ChiSQ.INV like this:
CHISQ.INV(probability,deg_freedom)
CHISQ.INV(0.025,39) = 58.12005973 <- THIS value is what i need to calculate
The thing is I'm using a table to calculate the chi squared, but I think there's some way to calculate with the computer, I found this Class but I still don't get how it works ChiSquaredDistribution Apache Commons
So the objetive is to calculate Chi Squared Inv with java or with a library for java.
ChiSquaredDistribution x2 = new ChiSquaredDistribution(1, 0.05);
System.out.println(x2.cumulativeProbability(1.96));
System.out.println(x2.getNumericalVariance());
output:
0.8384866815324579
2.0
ChiSquaredDistribution#inverseCumulativeProbabilityInherited from interfaceContinuousDistribution- Bedlax2.cumulativeProbability(1.96), you can usex2.inverseCumulativeProbability(1.96). I wrote it into comment only, because I am not sure, this solution is correct. - Bedla