* @param confidenceLevel The confidence level for the interval
* @param n Degrees of freedom
* @return The confidence interval
*/
public ConfidenceInterval getConfidenceInterval(final double volatility, final double confidenceLevel, final int n) {
_chiSquare = new ChiSquareDistribution(n - 1);
final double alpha = 1 - confidenceLevel;
final double lower = volatility * Math.sqrt((n - 1) / _chiSquare.getInverseCDF(1 - alpha / 2));
final double upper = volatility * Math.sqrt((n - 1) / _chiSquare.getInverseCDF(alpha / 2));
return new ConfidenceInterval(volatility, lower, upper, confidenceLevel);
}