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

smile.stat.distribution.AbstractMultivariateDistribution Maven / Gradle / Ivy

There is a newer version: 2.6.0
Show newest version
/******************************************************************************
 *                   Confidential Proprietary                                 *
 *         (c) Copyright Haifeng Li 2011, All Rights Reserved                 *
 ******************************************************************************/

package smile.stat.distribution;

/**
 * This is the base class of multivariate distributions. Likelihood and
 * log likelihood functions are implemented here.
 *
 * @author Haifeng Li
 */
public abstract class AbstractMultivariateDistribution implements MultivariateDistribution {

    /**
     * The likelihood given a sample set following the distribution.
     */
    @Override
    public double likelihood(double[][] x) {
        return Math.exp(logLikelihood(x));
    }

    /**
     * The likelihood given a sample set following the distribution.
     */
    @Override
    public double logLikelihood(double[][] x) {
        double L = 0.0;

        for (double[] xi : x)
            L += logp(xi);

        return L;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy