All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ojalgo.random.ContinuousDistribution Maven / Gradle / Ivy

Go to download

oj! Algorithms - ojAlgo - is Open Source Java code that has to do with mathematics, linear algebra and optimisation.

There is a newer version: 55.0.1
Show newest version
/*
 * Copyright 1997-2022 Optimatika
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package org.ojalgo.random;

import static org.ojalgo.function.constant.PrimitiveMath.*;

public interface ContinuousDistribution extends Distribution {

    /**
     * In probability theory, a probability density function (pdf), or density of a continuous random variable
     * is a function that describes the relative likelihood for this random variable to occur at a given
     * point. The probability for the random variable to fall within a particular region is given by the
     * integral of this variable's density over the region. The probability density function is nonnegative
     * everywhere, and its integral over the entire space is equal to one.
     * WikipediA
     *
     * @param value x
     * @return P(x)
     */
    double getDensity(double value);

    /**
     * In probability theory and statistics, the cumulative distribution function (CDF), or just distribution
     * function, describes the probability that a real-valued random variable X with a given probability
     * distribution will be found at a value less than or equal to x. Intuitively, it is the "area so far"
     * function of the probability distribution. Cumulative distribution functions are also used to specify
     * the distribution of multivariate random variables.
     * WikipediA
     *
     * @param value x
     * @return P(≤x)
     */
    double getDistribution(double value);

    default double getLowerConfidenceQuantile(final double confidence) {
        return this.getQuantile((ONE - confidence) / TWO);
    }

    /**
     * The quantile function, for any distribution, is defined for real variables between zero and one and is
     * mathematically the inverse of the cumulative distribution function.
     * WikipediA The input probability absolutely
     * has to be [0.0, 1.0], but values close to 0.0 and 1.0 may be problematic
     *
     * @param probability P(<=x)
     * @return x
     */
    double getQuantile(double probability);

    default double getUpperConfidenceQuantile(final double confidence) {
        return this.getQuantile(ONE - ((ONE - confidence) / TWO));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy