Java Code Examples for org.apache.commons.math3.exception.util.LocalizedFormats#SIGNIFICANCE_LEVEL

The following examples show how to use org.apache.commons.math3.exception.util.LocalizedFormats#SIGNIFICANCE_LEVEL . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Check significance level.
 *
 * @param alpha significance level
 * @throws OutOfRangeException if the significance level is out of bounds.
 */
private void checkSignificanceLevel(final double alpha)
    throws OutOfRangeException {

    if (alpha <= 0 || alpha > 0.5) {
        throw new OutOfRangeException(LocalizedFormats.SIGNIFICANCE_LEVEL,
                                      alpha, 0.0, 0.5);
    }

}
 
Example 2
Source File: TTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Check significance level.
 *
 * @param alpha significance level
 * @throws OutOfRangeException if the significance level is out of bounds.
 */
private void checkSignificanceLevel(final double alpha)
    throws OutOfRangeException {

    if (alpha <= 0 || alpha > 0.5) {
        throw new OutOfRangeException(LocalizedFormats.SIGNIFICANCE_LEVEL,
                                      alpha, 0.0, 0.5);
    }

}
 
Example 3
Source File: TTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Check significance level.
 *
 * @param alpha significance level
 * @throws OutOfRangeException if the significance level is out of bounds.
 */
private void checkSignificanceLevel(final double alpha)
    throws OutOfRangeException {

    if (alpha <= 0 || alpha > 0.5) {
        throw new OutOfRangeException(LocalizedFormats.SIGNIFICANCE_LEVEL,
                                      alpha, 0.0, 0.5);
    }

}
 
Example 4
Source File: TTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Check significance level.
 *
 * @param alpha significance level
 * @throws OutOfRangeException if the significance level is out of bounds.
 */
private void checkSignificanceLevel(final double alpha)
    throws OutOfRangeException {

    if (alpha <= 0 || alpha > 0.5) {
        throw new OutOfRangeException(LocalizedFormats.SIGNIFICANCE_LEVEL,
                                      alpha, 0.0, 0.5);
    }

}
 
Example 5
Source File: TTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Check significance level.
 *
 * @param alpha significance level
 * @throws OutOfRangeException if the significance level is out of bounds.
 */
private void checkSignificanceLevel(final double alpha)
    throws OutOfRangeException {

    if (alpha <= 0 || alpha > 0.5) {
        throw new OutOfRangeException(LocalizedFormats.SIGNIFICANCE_LEVEL,
                                      alpha, 0.0, 0.5);
    }

}
 
Example 6
Source File: TTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Check significance level.
 *
 * @param alpha significance level
 * @throws OutOfRangeException if the significance level is out of bounds.
 */
private void checkSignificanceLevel(final double alpha)
    throws OutOfRangeException {

    if (alpha <= 0 || alpha > 0.5) {
        throw new OutOfRangeException(LocalizedFormats.SIGNIFICANCE_LEVEL,
                                      alpha, 0.0, 0.5);
    }

}
 
Example 7
Source File: TTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Check significance level.
 *
 * @param alpha significance level
 * @throws OutOfRangeException if the significance level is out of bounds.
 */
private void checkSignificanceLevel(final double alpha)
    throws OutOfRangeException {

    if (alpha <= 0 || alpha > 0.5) {
        throw new OutOfRangeException(LocalizedFormats.SIGNIFICANCE_LEVEL,
                                      alpha, 0.0, 0.5);
    }

}
 
Example 8
Source File: TTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Check significance level.
 *
 * @param alpha significance level
 * @throws OutOfRangeException if the significance level is out of bounds.
 */
private void checkSignificanceLevel(final double alpha)
    throws OutOfRangeException {

    if (alpha <= 0 || alpha > 0.5) {
        throw new OutOfRangeException(LocalizedFormats.SIGNIFICANCE_LEVEL,
                                      alpha, 0.0, 0.5);
    }

}
 
Example 9
Source File: SimpleRegression.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns the half-width of a (100-100*alpha)% confidence interval for
 * the slope estimate.
 * <p>
 * The (100-100*alpha)% confidence interval is </p>
 * <p>
 * <code>(getSlope() - getSlopeConfidenceInterval(),
 * getSlope() + getSlopeConfidenceInterval())</code></p>
 * <p>
 * To request, for example, a 99% confidence interval, use
 * <code>alpha = .01</code></p>
 * <p>
 * <strong>Usage Note</strong>:<br>
 * The validity of this statistic depends on the assumption that the
 * observations included in the model are drawn from a
 * <a href="http://mathworld.wolfram.com/BivariateNormalDistribution.html">
 * Bivariate Normal Distribution</a>.</p>
 * <p>
 * <strong> Preconditions:</strong><ul>
 * <li>If there are fewer that <strong>three</strong> observations in the
 * model, or if there is no variation in x, this returns
 * <code>Double.NaN</code>.
 * </li>
 * <li><code>(0 < alpha < 1)</code>; otherwise an
 * <code>OutOfRangeException</code> is thrown.
 * </li></ul></p>
 *
 * @param alpha the desired significance level
 * @return half-width of 95% confidence interval for the slope estimate
 * @throws OutOfRangeException if the confidence interval can not be computed.
 */
public double getSlopeConfidenceInterval(final double alpha)
throws OutOfRangeException {
    if (n < 3) {
        return Double.NaN;
    }
    if (alpha >= 1 || alpha <= 0) {
        throw new OutOfRangeException(LocalizedFormats.SIGNIFICANCE_LEVEL,
                                      alpha, 0, 1);
    }
    // No advertised NotStrictlyPositiveException here - will return NaN above
    TDistribution distribution = new TDistribution(n - 2);
    return getSlopeStdErr() *
        distribution.inverseCumulativeProbability(1d - alpha / 2d);
}
 
Example 10
Source File: SimpleRegression.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns the half-width of a (100-100*alpha)% confidence interval for
 * the slope estimate.
 * <p>
 * The (100-100*alpha)% confidence interval is </p>
 * <p>
 * <code>(getSlope() - getSlopeConfidenceInterval(),
 * getSlope() + getSlopeConfidenceInterval())</code></p>
 * <p>
 * To request, for example, a 99% confidence interval, use
 * <code>alpha = .01</code></p>
 * <p>
 * <strong>Usage Note</strong>:<br>
 * The validity of this statistic depends on the assumption that the
 * observations included in the model are drawn from a
 * <a href="http://mathworld.wolfram.com/BivariateNormalDistribution.html">
 * Bivariate Normal Distribution</a>.</p>
 * <p>
 * <strong> Preconditions:</strong><ul>
 * <li>If there are fewer that <strong>three</strong> observations in the
 * model, or if there is no variation in x, this returns
 * <code>Double.NaN</code>.
 * </li>
 * <li><code>(0 < alpha < 1)</code>; otherwise an
 * <code>OutOfRangeException</code> is thrown.
 * </li></ul></p>
 *
 * @param alpha the desired significance level
 * @return half-width of 95% confidence interval for the slope estimate
 * @throws OutOfRangeException if the confidence interval can not be computed.
 */
public double getSlopeConfidenceInterval(final double alpha) {
    if (alpha >= 1 || alpha <= 0) {
        throw new OutOfRangeException(LocalizedFormats.SIGNIFICANCE_LEVEL,
                                      alpha, 0, 1);
    }
    TDistribution distribution = new TDistribution(n - 2);
    return getSlopeStdErr() *
        distribution.inverseCumulativeProbability(1d - alpha / 2d);
}
 
Example 11
Source File: SimpleRegression.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns the half-width of a (100-100*alpha)% confidence interval for
 * the slope estimate.
 * <p>
 * The (100-100*alpha)% confidence interval is </p>
 * <p>
 * <code>(getSlope() - getSlopeConfidenceInterval(),
 * getSlope() + getSlopeConfidenceInterval())</code></p>
 * <p>
 * To request, for example, a 99% confidence interval, use
 * <code>alpha = .01</code></p>
 * <p>
 * <strong>Usage Note</strong>:<br>
 * The validity of this statistic depends on the assumption that the
 * observations included in the model are drawn from a
 * <a href="http://mathworld.wolfram.com/BivariateNormalDistribution.html">
 * Bivariate Normal Distribution</a>.</p>
 * <p>
 * <strong> Preconditions:</strong><ul>
 * <li>If there are fewer that <strong>three</strong> observations in the
 * model, or if there is no variation in x, this returns
 * <code>Double.NaN</code>.
 * </li>
 * <li><code>(0 < alpha < 1)</code>; otherwise an
 * <code>OutOfRangeException</code> is thrown.
 * </li></ul></p>
 *
 * @param alpha the desired significance level
 * @return half-width of 95% confidence interval for the slope estimate
 * @throws OutOfRangeException if the confidence interval can not be computed.
 */
public double getSlopeConfidenceInterval(final double alpha) {
    if (alpha >= 1 || alpha <= 0) {
        throw new OutOfRangeException(LocalizedFormats.SIGNIFICANCE_LEVEL,
                                      alpha, 0, 1);
    }
    TDistribution distribution = new TDistribution(n - 2);
    return getSlopeStdErr() *
        distribution.inverseCumulativeProbability(1d - alpha / 2d);
}
 
Example 12
Source File: SimpleRegression.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns the half-width of a (100-100*alpha)% confidence interval for
 * the slope estimate.
 * <p>
 * The (100-100*alpha)% confidence interval is </p>
 * <p>
 * <code>(getSlope() - getSlopeConfidenceInterval(),
 * getSlope() + getSlopeConfidenceInterval())</code></p>
 * <p>
 * To request, for example, a 99% confidence interval, use
 * <code>alpha = .01</code></p>
 * <p>
 * <strong>Usage Note</strong>:<br>
 * The validity of this statistic depends on the assumption that the
 * observations included in the model are drawn from a
 * <a href="http://mathworld.wolfram.com/BivariateNormalDistribution.html">
 * Bivariate Normal Distribution</a>.</p>
 * <p>
 * <strong> Preconditions:</strong><ul>
 * <li>If there are fewer that <strong>three</strong> observations in the
 * model, or if there is no variation in x, this returns
 * <code>Double.NaN</code>.
 * </li>
 * <li><code>(0 < alpha < 1)</code>; otherwise an
 * <code>OutOfRangeException</code> is thrown.
 * </li></ul></p>
 *
 * @param alpha the desired significance level
 * @return half-width of 95% confidence interval for the slope estimate
 * @throws OutOfRangeException if the confidence interval can not be computed.
 */
public double getSlopeConfidenceInterval(final double alpha)
throws OutOfRangeException {
    if (n < 3) {
        return Double.NaN;
    }
    if (alpha >= 1 || alpha <= 0) {
        throw new OutOfRangeException(LocalizedFormats.SIGNIFICANCE_LEVEL,
                                      alpha, 0, 1);
    }
    // No advertised NotStrictlyPositiveException here - will return NaN above
    TDistribution distribution = new TDistribution(n - 2);
    return getSlopeStdErr() *
        distribution.inverseCumulativeProbability(1d - alpha / 2d);
}
 
Example 13
Source File: SimpleRegression.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns the half-width of a (100-100*alpha)% confidence interval for
 * the slope estimate.
 * <p>
 * The (100-100*alpha)% confidence interval is </p>
 * <p>
 * <code>(getSlope() - getSlopeConfidenceInterval(),
 * getSlope() + getSlopeConfidenceInterval())</code></p>
 * <p>
 * To request, for example, a 99% confidence interval, use
 * <code>alpha = .01</code></p>
 * <p>
 * <strong>Usage Note</strong>:<br>
 * The validity of this statistic depends on the assumption that the
 * observations included in the model are drawn from a
 * <a href="http://mathworld.wolfram.com/BivariateNormalDistribution.html">
 * Bivariate Normal Distribution</a>.</p>
 * <p>
 * <strong> Preconditions:</strong><ul>
 * <li>If there are fewer that <strong>three</strong> observations in the
 * model, or if there is no variation in x, this returns
 * <code>Double.NaN</code>.
 * </li>
 * <li><code>(0 < alpha < 1)</code>; otherwise an
 * <code>OutOfRangeException</code> is thrown.
 * </li></ul></p>
 *
 * @param alpha the desired significance level
 * @return half-width of 95% confidence interval for the slope estimate
 * @throws OutOfRangeException if the confidence interval can not be computed.
 */
public double getSlopeConfidenceInterval(final double alpha) {
    if (alpha >= 1 || alpha <= 0) {
        throw new OutOfRangeException(LocalizedFormats.SIGNIFICANCE_LEVEL,
                                      alpha, 0, 1);
    }
    TDistribution distribution = new TDistribution(n - 2);
    return getSlopeStdErr() *
        distribution.inverseCumulativeProbability(1d - alpha / 2d);
}
 
Example 14
Source File: SimpleRegression.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns the half-width of a (100-100*alpha)% confidence interval for
 * the slope estimate.
 * <p>
 * The (100-100*alpha)% confidence interval is </p>
 * <p>
 * <code>(getSlope() - getSlopeConfidenceInterval(),
 * getSlope() + getSlopeConfidenceInterval())</code></p>
 * <p>
 * To request, for example, a 99% confidence interval, use
 * <code>alpha = .01</code></p>
 * <p>
 * <strong>Usage Note</strong>:<br>
 * The validity of this statistic depends on the assumption that the
 * observations included in the model are drawn from a
 * <a href="http://mathworld.wolfram.com/BivariateNormalDistribution.html">
 * Bivariate Normal Distribution</a>.</p>
 * <p>
 * <strong> Preconditions:</strong><ul>
 * <li>If there are fewer that <strong>three</strong> observations in the
 * model, or if there is no variation in x, this returns
 * <code>Double.NaN</code>.
 * </li>
 * <li><code>(0 < alpha < 1)</code>; otherwise an
 * <code>OutOfRangeException</code> is thrown.
 * </li></ul></p>
 *
 * @param alpha the desired significance level
 * @return half-width of 95% confidence interval for the slope estimate
 * @throws OutOfRangeException if the confidence interval can not be computed.
 */
public double getSlopeConfidenceInterval(final double alpha)
throws OutOfRangeException {
    if (n < 3) {
        return Double.NaN;
    }
    if (alpha >= 1 || alpha <= 0) {
        throw new OutOfRangeException(LocalizedFormats.SIGNIFICANCE_LEVEL,
                                      alpha, 0, 1);
    }
    // No advertised NotStrictlyPositiveException here - will return NaN above
    TDistribution distribution = new TDistribution(n - 2);
    return getSlopeStdErr() *
        distribution.inverseCumulativeProbability(1d - alpha / 2d);
}
 
Example 15
Source File: SimpleRegression.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns the half-width of a (100-100*alpha)% confidence interval for
 * the slope estimate.
 * <p>
 * The (100-100*alpha)% confidence interval is </p>
 * <p>
 * <code>(getSlope() - getSlopeConfidenceInterval(),
 * getSlope() + getSlopeConfidenceInterval())</code></p>
 * <p>
 * To request, for example, a 99% confidence interval, use
 * <code>alpha = .01</code></p>
 * <p>
 * <strong>Usage Note</strong>:<br>
 * The validity of this statistic depends on the assumption that the
 * observations included in the model are drawn from a
 * <a href="http://mathworld.wolfram.com/BivariateNormalDistribution.html">
 * Bivariate Normal Distribution</a>.</p>
 * <p>
 * <strong> Preconditions:</strong><ul>
 * <li>If there are fewer that <strong>three</strong> observations in the
 * model, or if there is no variation in x, this returns
 * <code>Double.NaN</code>.
 * </li>
 * <li><code>(0 < alpha < 1)</code>; otherwise an
 * <code>OutOfRangeException</code> is thrown.
 * </li></ul></p>
 *
 * @param alpha the desired significance level
 * @return half-width of 95% confidence interval for the slope estimate
 * @throws OutOfRangeException if the confidence interval can not be computed.
 */
public double getSlopeConfidenceInterval(final double alpha)
throws OutOfRangeException {
    if (n < 3) {
        return Double.NaN;
    }
    if (alpha >= 1 || alpha <= 0) {
        throw new OutOfRangeException(LocalizedFormats.SIGNIFICANCE_LEVEL,
                                      alpha, 0, 1);
    }
    // No advertised NotStrictlyPositiveException here - will return NaN above
    TDistribution distribution = new TDistribution(n - 2);
    return getSlopeStdErr() *
        distribution.inverseCumulativeProbability(1d - alpha / 2d);
}
 
Example 16
Source File: SimpleRegression.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns the half-width of a (100-100*alpha)% confidence interval for
 * the slope estimate.
 * <p>
 * The (100-100*alpha)% confidence interval is </p>
 * <p>
 * <code>(getSlope() - getSlopeConfidenceInterval(),
 * getSlope() + getSlopeConfidenceInterval())</code></p>
 * <p>
 * To request, for example, a 99% confidence interval, use
 * <code>alpha = .01</code></p>
 * <p>
 * <strong>Usage Note</strong>:<br>
 * The validity of this statistic depends on the assumption that the
 * observations included in the model are drawn from a
 * <a href="http://mathworld.wolfram.com/BivariateNormalDistribution.html">
 * Bivariate Normal Distribution</a>.</p>
 * <p>
 * <strong> Preconditions:</strong><ul>
 * <li>If there are fewer that <strong>three</strong> observations in the
 * model, or if there is no variation in x, this returns
 * <code>Double.NaN</code>.
 * </li>
 * <li><code>(0 < alpha < 1)</code>; otherwise an
 * <code>OutOfRangeException</code> is thrown.
 * </li></ul></p>
 *
 * @param alpha the desired significance level
 * @return half-width of 95% confidence interval for the slope estimate
 * @throws OutOfRangeException if the confidence interval can not be computed.
 */
public double getSlopeConfidenceInterval(final double alpha)
throws OutOfRangeException {
    if (n < 3) {
        return Double.NaN;
    }
    if (alpha >= 1 || alpha <= 0) {
        throw new OutOfRangeException(LocalizedFormats.SIGNIFICANCE_LEVEL,
                                      alpha, 0, 1);
    }
    // No advertised NotStrictlyPositiveException here - will return NaN above
    TDistribution distribution = new TDistribution(n - 2);
    return getSlopeStdErr() *
        distribution.inverseCumulativeProbability(1d - alpha / 2d);
}