List of usage examples for org.apache.commons.math.distribution TDistribution inverseCumulativeProbability
double inverseCumulativeProbability(double p) throws MathException;
From source file:de.tud.kom.p2psim.impl.util.stats.ConfidenceInterval.java
/** * Returns the delta between the mean and the lower(x1)/upper(x2) bound as * positive number. That is, the probabilistic bounds of x1 and x2 are given * by x1 <= mean <= x2 <=> mean-delta <= mean <= mean + delta * /* w w w.j a v a 2 s .co m*/ * @param sdev * the given standard deviation * @param n * the given sample size * @param alpha * the given significance level * @return the upper/lower bound as positiv number */ public static double getDeltaBound(double sdev, int n, double alpha) { TDistribution tDist = DistributionFactory.newInstance().createTDistribution(n - 1); double errorConfCoeff = 1d - (alpha / 2); double delta; try { double t = Math.abs(tDist.inverseCumulativeProbability(errorConfCoeff)); delta = t * sdev / Math.sqrt(n); } catch (MathException e) { throw new IllegalStateException(e); } return delta; }
From source file:geogebra.kernel.statistics.AlgoInverseTDistribution.java
protected final void compute() { if (input[0].isDefined() && input[1].isDefined()) { double param = a.getDouble(); double val = b.getDouble(); try {/*from w ww . j a v a2 s . com*/ TDistribution t = getTDistribution(param); num.setValue(t.inverseCumulativeProbability(val)); } catch (Exception e) { num.setUndefined(); } } else num.setUndefined(); }
From source file:geogebra.common.kernel.statistics.AlgoInverseTDistribution.java
@Override public final void compute() { if (input[0].isDefined() && input[1].isDefined()) { double param = a.getDouble(); double val = b.getDouble(); try {//from www .j a v a2s . com TDistribution t = getTDistribution(param); num.setValue(t.inverseCumulativeProbability(val)); } catch (Exception e) { num.setUndefined(); } } else num.setUndefined(); }
From source file:org.peerfact.impl.util.stats.ConfidenceInterval.java
/** * Returns the delta between the mean and the lower(x1)/upper(x2) bound as * positive number. That is, the probabilistic bounds of x1 and x2 are given * by x1 <= mean <= x2 <=> mean-delta <= mean <= mean + delta * /*from w w w . j a v a 2 s . c o m*/ * @param sdev * the given standard deviation * @param n * the given sample size * @param alpha * the given significance level * @return the upper/lower bound as positive number */ public static double getDeltaBound(double sdev, int n, double alpha) { TDistribution tDist = new TDistributionImpl(n - 1); double errorConfCoeff = 1d - (alpha / 2); double delta; try { double t = Math.abs(tDist.inverseCumulativeProbability(errorConfCoeff)); delta = t * sdev / Math.sqrt(n); } catch (MathException e) { throw new IllegalStateException(e); } return delta; }
From source file:weka.classifiers.functions.SimpleLinearRegressionIntervalEstimator.java
/** * Returns an N * 2 array, where N is the number of prediction * intervals. In each row, the first element contains the lower * boundary of the corresponding prediction interval and the second * element the upper boundary.//from w ww . j a v a2 s . co m * * @param inst the instance to make the prediction for. * @param confidenceLevel the percentage of cases that the interval should cover. * @return an array of prediction intervals * @throws Exception if the intervals can't be computed */ @Override public double[][] predictIntervals(Instance inst, double confidenceLevel) throws Exception { double alpha; double critProb; TDistribution td; double critValue; double marginError; if (m_df < 1) throw new WekaException("No degrees of freedom!"); alpha = 1 - confidenceLevel; critProb = 1 - alpha / 2; td = new TDistributionImpl(m_df); critValue = td.inverseCumulativeProbability(critProb); marginError = critValue * getSlopeSE(); return new double[][] { { getSlope() - marginError, getSlope() + marginError } }; }