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

The following examples show how to use org.apache.commons.math3.exception.util.LocalizedFormats#DEGREES_OF_FREEDOM . 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: Math_22_FDistribution_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Creates an F distribution.
 *
 * @param rng Random number generator.
 * @param numeratorDegreesOfFreedom Numerator degrees of freedom.
 * @param denominatorDegreesOfFreedom Denominator degrees of freedom.
 * @param inverseCumAccuracy the maximum absolute error in inverse
 * cumulative probability estimates.
 * @throws NotStrictlyPositiveException if
 * {@code numeratorDegreesOfFreedom <= 0} or
 * {@code denominatorDegreesOfFreedom <= 0}.
 * @since 3.1
 */
public FDistribution(RandomGenerator rng,
                     double numeratorDegreesOfFreedom,
                     double denominatorDegreesOfFreedom,
                     double inverseCumAccuracy)
    throws NotStrictlyPositiveException {
    super(rng);

    if (numeratorDegreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               numeratorDegreesOfFreedom);
    }
    if (denominatorDegreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               denominatorDegreesOfFreedom);
    }
    this.numeratorDegreesOfFreedom = numeratorDegreesOfFreedom;
    this.denominatorDegreesOfFreedom = denominatorDegreesOfFreedom;
    solverAbsoluteAccuracy = inverseCumAccuracy;
}
 
Example 2
Source File: TDistribution.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates a t distribution.
 *
 * @param rng Random number generator.
 * @param degreesOfFreedom Degrees of freedom.
 * @param inverseCumAccuracy the maximum absolute error in inverse
 * cumulative probability estimates
 * (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
 * @throws NotStrictlyPositiveException if {@code degreesOfFreedom <= 0}
 * @since 3.1
 */
public TDistribution(RandomGenerator rng,
                     double degreesOfFreedom,
                     double inverseCumAccuracy)
    throws NotStrictlyPositiveException {
    super(rng);

    if (degreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               degreesOfFreedom);
    }
    this.degreesOfFreedom = degreesOfFreedom;
    solverAbsoluteAccuracy = inverseCumAccuracy;

    final double n = degreesOfFreedom;
    final double nPlus1Over2 = (n + 1) / 2;
    factor = Gamma.logGamma(nPlus1Over2) -
             0.5 * (FastMath.log(FastMath.PI) + FastMath.log(n)) -
             Gamma.logGamma(n / 2);
}
 
Example 3
Source File: FDistribution.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates an F distribution.
 *
 * @param rng Random number generator.
 * @param numeratorDegreesOfFreedom Numerator degrees of freedom.
 * @param denominatorDegreesOfFreedom Denominator degrees of freedom.
 * @param inverseCumAccuracy the maximum absolute error in inverse
 * cumulative probability estimates.
 * @throws NotStrictlyPositiveException if {@code numeratorDegreesOfFreedom <= 0} or
 * {@code denominatorDegreesOfFreedom <= 0}.
 * @since 3.1
 */
public FDistribution(RandomGenerator rng,
                     double numeratorDegreesOfFreedom,
                     double denominatorDegreesOfFreedom,
                     double inverseCumAccuracy)
    throws NotStrictlyPositiveException {
    super(rng);

    if (numeratorDegreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               numeratorDegreesOfFreedom);
    }
    if (denominatorDegreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               denominatorDegreesOfFreedom);
    }
    this.numeratorDegreesOfFreedom = numeratorDegreesOfFreedom;
    this.denominatorDegreesOfFreedom = denominatorDegreesOfFreedom;
    solverAbsoluteAccuracy = inverseCumAccuracy;
}
 
Example 4
Source File: FDistribution.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates an F distribution.
 *
 * @param rng Random number generator.
 * @param numeratorDegreesOfFreedom Numerator degrees of freedom.
 * @param denominatorDegreesOfFreedom Denominator degrees of freedom.
 * @param inverseCumAccuracy the maximum absolute error in inverse
 * cumulative probability estimates.
 * @throws NotStrictlyPositiveException if
 * {@code numeratorDegreesOfFreedom <= 0} or
 * {@code denominatorDegreesOfFreedom <= 0}.
 * @since 3.1
 */
public FDistribution(RandomGenerator rng,
                     double numeratorDegreesOfFreedom,
                     double denominatorDegreesOfFreedom,
                     double inverseCumAccuracy)
    throws NotStrictlyPositiveException {
    super(rng);

    if (numeratorDegreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               numeratorDegreesOfFreedom);
    }
    if (denominatorDegreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               denominatorDegreesOfFreedom);
    }
    this.numeratorDegreesOfFreedom = numeratorDegreesOfFreedom;
    this.denominatorDegreesOfFreedom = denominatorDegreesOfFreedom;
    solverAbsoluteAccuracy = inverseCumAccuracy;
}
 
Example 5
Source File: FDistribution.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates an F distribution.
 *
 * @param rng Random number generator.
 * @param numeratorDegreesOfFreedom Numerator degrees of freedom.
 * @param denominatorDegreesOfFreedom Denominator degrees of freedom.
 * @param inverseCumAccuracy the maximum absolute error in inverse
 * cumulative probability estimates.
 * @throws NotStrictlyPositiveException if
 * {@code numeratorDegreesOfFreedom <= 0} or
 * {@code denominatorDegreesOfFreedom <= 0}.
 * @since 3.1
 */
public FDistribution(RandomGenerator rng,
                     double numeratorDegreesOfFreedom,
                     double denominatorDegreesOfFreedom,
                     double inverseCumAccuracy)
    throws NotStrictlyPositiveException {
    super(rng);

    if (numeratorDegreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               numeratorDegreesOfFreedom);
    }
    if (denominatorDegreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               denominatorDegreesOfFreedom);
    }
    this.numeratorDegreesOfFreedom = numeratorDegreesOfFreedom;
    this.denominatorDegreesOfFreedom = denominatorDegreesOfFreedom;
    solverAbsoluteAccuracy = inverseCumAccuracy;
}
 
Example 6
Source File: FDistribution.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create an F distribution using the given degrees of freedom
 * and inverse cumulative probability accuracy.
 * @param numeratorDegreesOfFreedom Numerator degrees of freedom.
 * @param denominatorDegreesOfFreedom Denominator degrees of freedom.
 * @param inverseCumAccuracy the maximum absolute error in inverse
 * cumulative probability estimates.
 * (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY})
 * @throws NotStrictlyPositiveException if
 * {@code numeratorDegreesOfFreedom <= 0} or
 * {@code denominatorDegreesOfFreedom <= 0}.
 * @since 2.1
 */
public FDistribution(double numeratorDegreesOfFreedom,
                         double denominatorDegreesOfFreedom,
                         double inverseCumAccuracy)
    throws NotStrictlyPositiveException {
    if (numeratorDegreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               numeratorDegreesOfFreedom);
    }
    if (denominatorDegreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               denominatorDegreesOfFreedom);
    }
    this.numeratorDegreesOfFreedom = numeratorDegreesOfFreedom;
    this.denominatorDegreesOfFreedom = denominatorDegreesOfFreedom;
    solverAbsoluteAccuracy = inverseCumAccuracy;
}
 
Example 7
Source File: FDistribution.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates an F distribution.
 *
 * @param rng Random number generator.
 * @param numeratorDegreesOfFreedom Numerator degrees of freedom.
 * @param denominatorDegreesOfFreedom Denominator degrees of freedom.
 * @param inverseCumAccuracy the maximum absolute error in inverse
 * cumulative probability estimates.
 * @throws NotStrictlyPositiveException if
 * {@code numeratorDegreesOfFreedom <= 0} or
 * {@code denominatorDegreesOfFreedom <= 0}.
 * @since 3.1
 */
public FDistribution(RandomGenerator rng,
                     double numeratorDegreesOfFreedom,
                     double denominatorDegreesOfFreedom,
                     double inverseCumAccuracy)
    throws NotStrictlyPositiveException {
    super(rng);

    if (numeratorDegreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               numeratorDegreesOfFreedom);
    }
    if (denominatorDegreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               denominatorDegreesOfFreedom);
    }
    this.numeratorDegreesOfFreedom = numeratorDegreesOfFreedom;
    this.denominatorDegreesOfFreedom = denominatorDegreesOfFreedom;
    solverAbsoluteAccuracy = inverseCumAccuracy;
}
 
Example 8
Source File: FDistribution.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates an F distribution.
 *
 * @param rng Random number generator.
 * @param numeratorDegreesOfFreedom Numerator degrees of freedom.
 * @param denominatorDegreesOfFreedom Denominator degrees of freedom.
 * @param inverseCumAccuracy the maximum absolute error in inverse
 * cumulative probability estimates.
 * @throws NotStrictlyPositiveException if
 * {@code numeratorDegreesOfFreedom <= 0} or
 * {@code denominatorDegreesOfFreedom <= 0}.
 * @since 3.1
 */
public FDistribution(RandomGenerator rng,
                     double numeratorDegreesOfFreedom,
                     double denominatorDegreesOfFreedom,
                     double inverseCumAccuracy)
    throws NotStrictlyPositiveException {
    super(rng);

    if (numeratorDegreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               numeratorDegreesOfFreedom);
    }
    if (denominatorDegreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               denominatorDegreesOfFreedom);
    }
    this.numeratorDegreesOfFreedom = numeratorDegreesOfFreedom;
    this.denominatorDegreesOfFreedom = denominatorDegreesOfFreedom;
    solverAbsoluteAccuracy = inverseCumAccuracy;
}
 
Example 9
Source File: FDistribution.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates an F distribution.
 *
 * @param rng Random number generator.
 * @param numeratorDegreesOfFreedom Numerator degrees of freedom.
 * @param denominatorDegreesOfFreedom Denominator degrees of freedom.
 * @param inverseCumAccuracy the maximum absolute error in inverse
 * cumulative probability estimates.
 * @throws NotStrictlyPositiveException if
 * {@code numeratorDegreesOfFreedom <= 0} or
 * {@code denominatorDegreesOfFreedom <= 0}.
 * @since 3.1
 */
public FDistribution(RandomGenerator rng,
                     double numeratorDegreesOfFreedom,
                     double denominatorDegreesOfFreedom,
                     double inverseCumAccuracy)
    throws NotStrictlyPositiveException {
    super(rng);

    if (numeratorDegreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               numeratorDegreesOfFreedom);
    }
    if (denominatorDegreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               denominatorDegreesOfFreedom);
    }
    this.numeratorDegreesOfFreedom = numeratorDegreesOfFreedom;
    this.denominatorDegreesOfFreedom = denominatorDegreesOfFreedom;
    solverAbsoluteAccuracy = inverseCumAccuracy;
}
 
Example 10
Source File: TDistribution.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates a t distribution.
 *
 * @param rng Random number generator.
 * @param degreesOfFreedom Degrees of freedom.
 * @param inverseCumAccuracy the maximum absolute error in inverse
 * cumulative probability estimates
 * (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
 * @throws NotStrictlyPositiveException if {@code degreesOfFreedom <= 0}
 * @since 3.1
 */
public TDistribution(RandomGenerator rng,
                     double degreesOfFreedom,
                     double inverseCumAccuracy)
    throws NotStrictlyPositiveException {
    super(rng);

    if (degreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               degreesOfFreedom);
    }
    this.degreesOfFreedom = degreesOfFreedom;
    solverAbsoluteAccuracy = inverseCumAccuracy;

    final double n = degreesOfFreedom;
    final double nPlus1Over2 = (n + 1) / 2;
    factor = Gamma.logGamma(nPlus1Over2) -
             0.5 * (FastMath.log(FastMath.PI) + FastMath.log(n)) -
             Gamma.logGamma(n / 2);
}
 
Example 11
Source File: FDistribution.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates an F distribution.
 *
 * @param rng Random number generator.
 * @param numeratorDegreesOfFreedom Numerator degrees of freedom.
 * @param denominatorDegreesOfFreedom Denominator degrees of freedom.
 * @param inverseCumAccuracy the maximum absolute error in inverse
 * cumulative probability estimates.
 * @throws NotStrictlyPositiveException if {@code numeratorDegreesOfFreedom <= 0} or
 * {@code denominatorDegreesOfFreedom <= 0}.
 * @since 3.1
 */
public FDistribution(RandomGenerator rng,
                     double numeratorDegreesOfFreedom,
                     double denominatorDegreesOfFreedom,
                     double inverseCumAccuracy)
    throws NotStrictlyPositiveException {
    super(rng);

    if (numeratorDegreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               numeratorDegreesOfFreedom);
    }
    if (denominatorDegreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               denominatorDegreesOfFreedom);
    }
    this.numeratorDegreesOfFreedom = numeratorDegreesOfFreedom;
    this.denominatorDegreesOfFreedom = denominatorDegreesOfFreedom;
    solverAbsoluteAccuracy = inverseCumAccuracy;
}
 
Example 12
Source File: Math_22_FDistribution_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Creates an F distribution.
 *
 * @param rng Random number generator.
 * @param numeratorDegreesOfFreedom Numerator degrees of freedom.
 * @param denominatorDegreesOfFreedom Denominator degrees of freedom.
 * @param inverseCumAccuracy the maximum absolute error in inverse
 * cumulative probability estimates.
 * @throws NotStrictlyPositiveException if
 * {@code numeratorDegreesOfFreedom <= 0} or
 * {@code denominatorDegreesOfFreedom <= 0}.
 * @since 3.1
 */
public FDistribution(RandomGenerator rng,
                     double numeratorDegreesOfFreedom,
                     double denominatorDegreesOfFreedom,
                     double inverseCumAccuracy)
    throws NotStrictlyPositiveException {
    super(rng);

    if (numeratorDegreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               numeratorDegreesOfFreedom);
    }
    if (denominatorDegreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               denominatorDegreesOfFreedom);
    }
    this.numeratorDegreesOfFreedom = numeratorDegreesOfFreedom;
    this.denominatorDegreesOfFreedom = denominatorDegreesOfFreedom;
    solverAbsoluteAccuracy = inverseCumAccuracy;
}
 
Example 13
Source File: TDistribution.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a t distribution.
 *
 * @param rng Random number generator.
 * @param degreesOfFreedom Degrees of freedom.
 * @param inverseCumAccuracy the maximum absolute error in inverse
 * cumulative probability estimates
 * (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
 * @throws NotStrictlyPositiveException if {@code degreesOfFreedom <= 0}
 * @since 3.1
 */
public TDistribution(RandomGenerator rng,
                     double degreesOfFreedom,
                     double inverseCumAccuracy)
    throws NotStrictlyPositiveException {
    super(rng);

    if (degreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               degreesOfFreedom);
    }
    this.degreesOfFreedom = degreesOfFreedom;
    solverAbsoluteAccuracy = inverseCumAccuracy;
}
 
Example 14
Source File: TDistribution.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a t distribution.
 *
 * @param rng Random number generator.
 * @param degreesOfFreedom Degrees of freedom.
 * @param inverseCumAccuracy the maximum absolute error in inverse
 * cumulative probability estimates
 * (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
 * @throws NotStrictlyPositiveException if {@code degreesOfFreedom <= 0}
 * @since 3.1
 */
public TDistribution(RandomGenerator rng,
                     double degreesOfFreedom,
                     double inverseCumAccuracy)
    throws NotStrictlyPositiveException {
    super(rng);

    if (degreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               degreesOfFreedom);
    }
    this.degreesOfFreedom = degreesOfFreedom;
    solverAbsoluteAccuracy = inverseCumAccuracy;
}
 
Example 15
Source File: TDistribution.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a t distribution.
 *
 * @param rng Random number generator.
 * @param degreesOfFreedom Degrees of freedom.
 * @param inverseCumAccuracy the maximum absolute error in inverse
 * cumulative probability estimates
 * (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
 * @throws NotStrictlyPositiveException if {@code degreesOfFreedom <= 0}
 * @since 3.1
 */
public TDistribution(RandomGenerator rng,
                     double degreesOfFreedom,
                     double inverseCumAccuracy)
    throws NotStrictlyPositiveException {
    super(rng);

    if (degreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               degreesOfFreedom);
    }
    this.degreesOfFreedom = degreesOfFreedom;
    solverAbsoluteAccuracy = inverseCumAccuracy;
}
 
Example 16
Source File: TDistribution.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a t distribution.
 *
 * @param rng Random number generator.
 * @param degreesOfFreedom Degrees of freedom.
 * @param inverseCumAccuracy the maximum absolute error in inverse
 * cumulative probability estimates
 * (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
 * @throws NotStrictlyPositiveException if {@code degreesOfFreedom <= 0}
 * @since 3.1
 */
public TDistribution(RandomGenerator rng,
                     double degreesOfFreedom,
                     double inverseCumAccuracy)
    throws NotStrictlyPositiveException {
    super(rng);

    if (degreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               degreesOfFreedom);
    }
    this.degreesOfFreedom = degreesOfFreedom;
    solverAbsoluteAccuracy = inverseCumAccuracy;
}
 
Example 17
Source File: TDistribution.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a t distribution.
 *
 * @param rng Random number generator.
 * @param degreesOfFreedom Degrees of freedom.
 * @param inverseCumAccuracy the maximum absolute error in inverse
 * cumulative probability estimates
 * (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
 * @throws NotStrictlyPositiveException if {@code degreesOfFreedom <= 0}
 * @since 3.1
 */
public TDistribution(RandomGenerator rng,
                     double degreesOfFreedom,
                     double inverseCumAccuracy)
    throws NotStrictlyPositiveException {
    super(rng);

    if (degreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               degreesOfFreedom);
    }
    this.degreesOfFreedom = degreesOfFreedom;
    solverAbsoluteAccuracy = inverseCumAccuracy;
}
 
Example 18
Source File: TDistribution.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Create a t distribution using the given degrees of freedom and the
 * specified inverse cumulative probability absolute accuracy.
 *
 * @param degreesOfFreedom Degrees of freedom.
 * @param inverseCumAccuracy the maximum absolute error in inverse
 * cumulative probability estimates
 * (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
 * @throws NotStrictlyPositiveException if {@code degreesOfFreedom <= 0}
 * @since 2.1
 */
public TDistribution(double degreesOfFreedom, double inverseCumAccuracy)
    throws NotStrictlyPositiveException {
    if (degreesOfFreedom <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                                               degreesOfFreedom);
    }
    this.degreesOfFreedom = degreesOfFreedom;
    solverAbsoluteAccuracy = inverseCumAccuracy;
}